CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Modified_GLCDLibrary

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
prisim



Joined: 07 Nov 2013
Posts: 6

View user's profile Send private message

Modified_GLCDLibrary
PostPosted: Mon Apr 27, 2015 10:51 pm     Reply with quote

Hi,

Here is Modified version of CCS built in GLCD library for KS0108 based GLCD.(HDM64GS12.c and Graphics.c)

With some new and modified functions from Extended GLCD Library and other by me.

New Functions included in library are,

glcd_3Dbox(x,y,width,height,depth,color)


Draws a 3D box on a graphic LCD (Ex: to make a 3D Button)

glcd_circle_seg(x,y,radius,angle_start,angle_end,color)


Draws a segment of a circle on a graphic LCD

glcd_image(inverse)


Fills the graphic LCD screen with 128x64 bit converted image
with inverse option

glcd_image_xy(x,y,inverse)


Draws less or equal 128x64 pixels of image to the graphic LCD
screen on specified x, y coordinate with inverse option

glcd_putc1116(x,y,textptr,size,color)
* Write Text in 11x16 font




Tested personally! On software and by hardware both (JHD12864E).
Any kind of questions bugs or feedback will be welcomed Smile

Demo Project of CCS compiler and Library files are below

++++++++++++++++++++
CCS portions of code removed.
Reason: Forum rule #10
10. Don't post the CCS example code or drivers
http://www.ccsinfo.com/forum/viewtopic.php?t=26245
- Forum Moderator
++++++++++++++++++++


Code:

#include <16F877A.h>
#device *=16
#include <stdlib.h>
#include <string.h>
#USE DELAY (CLOCK=4000000)
//#include <24512.c> //for the atmel eeprom
#include <math.h>
#include <C:\Users\mPc\Desktop\New folder (2)\HDM64GS12.c>
#include <C:\Users\mPc\Desktop\New folder (2)\GRAPHICS.c>


#fuses  HS,NOWDT,NOLVP

char text[]="PriSim";
char text2[]="A";
char text3[]="TeaM";



void main()
{
 

glcd_init(ON);

delay_ms(200);





glcd_putc1116(1,1,text2,1,ON);
glcd_text57(70,40,text,1,ON);
glcd_text57(70,50,text3,1,ON);


glcd_circle(18,8,5,0,on);
glcd_rect(25, 1, 36, 15, 0, on);
glcd_circle(44,8,5,1,on);
glcd_rect(52, 1, 63, 15, 1, on);
glcd_3Dbox(70,1,15,15,3,ON);
glcd_image_xy(0,32,NO);

delay_ms(1000);

}


Modified HDM64GS12.c
Code:

/////////////////////////////////////////////////////////////////////////
////                           HDM64GS12.c                           ////
////                                                                 ////
// ! DON'T FORGET TO CHANGE YOUR PIN CONFIGURATION FOR YOUR CIRCUIT !  //
//            Modified and Tested on JHD12864E GLCD                    //
//                            BY                                       //
//                        PriSim TeaM                                  //
/////////////////////////////////////////////////////////////////////////
////                                                                 ////
////                 The NEW functions added by me:                  ////
////                                                                 ////
////  glcd_standby(command)                                          ////
////  glcd_3Dbox(x,y,width,height,depth,color)                       ////
////                                                                 ////
////  glcd_image(inverse)                                            ////
////  glcd_image_xy(x,y,inverse)                                     ////
////                                                                 ////
////     !!         YOU CAN FIND DETAILED DESCRIPTIONS        !!     ////
////     !! AND "HOW TO USE" INFORMATIONS ABOVE THE FUNCTIONS !!     ////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////
////                                                                 ////
////                 The NEW functions                               ////
////                                                                 ////
////                                                                 ////
////  glcd_3Dbox(x,y,width,height,depth,color)                       ////
////                                                                 ////
////  glcd_image(inverse)                                            ////
////  glcd_image_xy(x,y,inverse)                                     ////
////                                                                 ////
////     !!         YOU CAN FIND DETAILED DESCRIPTIONS        !!     ////
////     !! AND "HOW TO USE" INFORMATIONS ABOVE THE FUNCTIONS !!     ////
////                                                                 ////

#include <Bitmap.h>

#endif
//****************************************************************************//
// Purpose:       Turns ON-OFF graphic LCD. Good solution on system standby   //
//                GLCD does not clear its memory map on OFF command. So last  //
//                screen shows up when ON command send to GLCD                //
// Inputs:        OFF - Turns the LCD off                                     //
//                ON  - Turns the LCD on                                      //
//****************************************************************************//
void glcd_standby(int1 command)

   output_low(GLCD_E);
   output_low(GLCD_CS1);
   output_low(GLCD_CS2);
   output_low(GLCD_DI);
   if (command)
   {   
      glcd_writeByte(GLCD_CS1,0x3F);
      glcd_writeByte(GLCD_CS2,0x3F);
   }
   else
   {
      glcd_writeByte(GLCD_CS1,0x3E);
      glcd_writeByte(GLCD_CS2,0x3E);   
   }
}
//****************************************************************************//
// Purpose:       Fill the graphic LCD screen with 128x64 bit converted image //
// Inputs:        YES - Inverse of image (Raw data saved in ROM)              //
//                NO - Normal image (Raw data saved in ROM)                   //
// Dependencies:  glcd_pixel(), glcd_init()                                   //
//                                                                            //
//                      !! Check the "Bitmap.h" file !!                       //
//                                                                            //
//****************************************************************************//
void glcd_image(int1 inverse)
{
   unsigned int i, j, k;
   unsigned int16 count=0;
   int width = 128; 
   int height = 64;
   glcd_fillScreen(OFF);                        //Clears the screen (opt.)
   if(inverse)
   {
      for(i=0;i<height;i+=8)
      {
         for(j=0;j<width;j++)
         {
            for(k=0;k<8;k++)
            {
               if(~bit_test(image[count],k))
               {
                  glcd_pixel(j,i+k,ON);
               }         
               
            }
            count++;
         } 
      }
   }
   else
   {
      for(i=0;i<height;i+=8)
      {
         for(j=0;j<width;j++)
         {
            for(k=0;k<8;k++)
            {
               if(bit_test(image[count],k))
               {
                  glcd_pixel(j,i+k,ON);
               }         
               
            }
            count++;
         } 
      }
   }
}
//****************************************************************************//
// Purpose:       Draw a 3D box on a graphic LCD (Ex: to make a 3D Button)    //
// Inputs:        (x, y) - the start point                                    //
//                (width, height) - size of the box                           //
//                depth  - 3D depth effect ratio of the box (2 or 3 is fine)  //
//                color - ON or OFF                                           //
// Dependencies:  glcd_pixel()                                                //   
//****************************************************************************//
void glcd_3Dbox(int16 x,int16 y,int16 width, int16 height, int depth, int1 color)
{
   int16 i,j;
   for(i=x;i<=x+width;i++)
   {
      glcd_pixel(i,y,1);
      glcd_pixel(i,y+height,1);
   }
   for(i=y;i<=y+height;i++)
   {
      glcd_pixel(x,i,1);
      glcd_pixel(x+width,i,1);
   }
   for(j=1;j<=depth;j++)
   {
      for(i=y+j;i<=y+height+j;i++)
      {
         glcd_pixel(x-j,i,1);
      }
   }
   for(j=1;j<=depth;j++)
   {
      for(i=x-j;i<=(x-j+width);i++)
      {
         glcd_pixel(i,y+height+j,color);
      }
   }
}

//****************************************************************************//
// Purpose:       Draw less or equal 128x64 pixels of image to the graphic LCD//
//                screen on specified x, y coordinate                         //
// Inputs:        (x, y) - The start coordinate                               //
//                YES - Inverse of image (Raw data saved in ROM)              //
//                NO - Normal image (Raw data saved in ROM)                   //
// Dependencies:  glcd_pixel(), glcd_init()                                   //
//                                                                            //
//                       !!! PRLEASE BE CAREFULL !!                           //
//                                                                            //
//         First 2 bytes of your image data must be size of your BMP          //
//                                                                            //
// Example:       If your BMP image size is 64x32, first 2 bytes should       //
//                be 0x40, 0x20 --> (64 = 0x40, 32 = 0x20)                    //
//                                                                            //
//                      !! Check the "Bitmap.h" file !!                       //
//                                                                            //
//****************************************************************************//
void glcd_image_xy(int x, int y, int1 inverse)
{
   unsigned int i, j, k;
   unsigned int16 count=2;
   int width  = image_xy[0];
   int height = image_xy[1];
   //glcd_fillScreen(OFF);                        //Clears the screen (opt.)
   if(inverse)
   {
      for(i=0;i<height;i+=8)
      {   
         for(j=0;j<width;j++)
         {
            for(k=0;k<8;k++)
            {
               if(~bit_test(image_xy[count],k))
               {
                  glcd_pixel(x+j,y+i+k,ON);
               }
            }
            count++;
         }
      }
   }
   else
   {
      for(i=0;i<height;i+=8)
      {   
         for(j=0;j<width;j++)
         {
            for(k=0;k<8;k++)
            {
               if(bit_test(image_xy[count],k))
               {
                  glcd_pixel(x+j,y+i+k,ON);
               }
            }
            count++;
         }
      }
   }
}



Modified Graphics.c

Code:

/////////////////////////////////////////////////////////////////////////
////                          graphics.c                             ////
//                                                                     //
//  EXTRA TEXT WRITING ROUTINE                                         //
//                                                                     //
//  There is a one extra font routine:                                 //
//   glcd_putc1116(x,y,textptr,size,color)                             //
//      * Write Text in 11x16 font                                     //
//                                                                     //


/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
#ifndef GRAPHICS_DRAWING_FUNCTIONS
#define GRAPHICS_DRAWING_FUNCTIONS
/////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////
#ifndef ON
#define ON  1
#endif

#ifndef OFF
#define OFF 0
#endif

#ifndef YES
#define YES 1
#endif

#ifndef NO
#define NO  0
#endif
////////////////////////////////Defines 11x16 TEXT Array//////////////////////////////////

const unsigned int16 TEXT_11x16_1[11][11]={
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                                                //   
        0, 0, 0, 124, 13311, 13311, 124, 0, 0, 0, 0,                                    //  !
        0, 0, 60, 60, 0, 0, 60, 60, 0, 0, 0,                                            //  "
        512, 7696, 8080, 1008, 638, 7710, 8080, 1008, 638, 30, 16,                      //  #
        0, 1144, 3324, 3276, 16383, 16383, 3276, 4044, 1928, 0, 0,                      //  $
        12288, 14392, 7224, 3640, 1792, 896, 448, 14560, 14448, 14392, 28,              //  %
        0, 7936, 16312, 12796, 8646, 14306, 7742, 7196, 13824, 8704, 0,                 //  &
        0, 0, 0, 39, 63, 31, 0, 0, 0, 0, 0,                                             //  '
        0, 0, 1008, 4092, 8190, 14343, 8193, 8193, 0, 0, 0,                             //  (
        0, 0, 8193, 8193, 14343, 8190, 4092, 1008, 0, 0, 0,                             //  )
        0, 3224, 3768, 992, 4088, 4088, 992, 3768, 3224, 0, 0,                          //  *
};

const unsigned int16 TEXT_11x16_2[11][11]={
        0, 384, 384, 384, 4080, 4080, 384, 384, 384, 0, 0                               //  +
        0, 0, 0, 47104, 63488, 30720, 0, 0, 0, 0, 0,                                    //  ,
        0, 384, 384, 384, 384, 384, 384, 384, 384, 0, 0,                                //  -
        0, 0, 0, 14336, 14336, 14336, 0, 0, 0, 0, 0,                                    //  .
        6144, 7168, 3584, 1792, 896, 448, 224, 112, 56, 28, 14,                         //  /
        2040, 8190, 7686, 13059, 12675, 12483, 12387, 12339, 6174, 8190, 2040,          //  0
        0, 0, 12300, 12300, 12302, 16383, 16383, 12288, 12288, 12288, 0,                //  1
        12316, 14366, 15367, 15875, 14083, 13187, 12739, 12515, 12407, 12350, 12316,    //  2
        3084, 7182, 14343, 12483, 12483, 12483, 12483, 12483, 14823, 8062, 3644,        //  3
        960, 992, 880, 824, 796, 782, 775, 16383, 16383, 768, 768,                      //  4
        3135, 7295, 14435, 12387, 12387, 12387, 12387, 12387, 14563, 8131, 3971         //  5
};

const unsigned int16 TEXT_11x16_3[11][11]={
        4032, 8176, 14840, 12508, 12494, 12487, 12483, 12483, 14787, 8064, 3840,        //  6
        3, 3, 3, 12291, 15363, 3843, 963, 243, 63, 15, 3,                               //  7
        3840, 8124, 14846, 12519, 12483, 12483, 12483, 12519, 14846, 8124, 3840,        //  8
        60, 126, 12519, 12483, 12483, 14531, 7363, 3779, 2023, 1022, 252,               //  9
        0, 0, 0, 7280, 7280, 7280, 0, 0, 0, 0, 0,                                       //  :
        0, 0, 0, 40048, 64624, 31856, 0, 0, 0, 0, 0,                                    //  ;
        0, 192, 480, 1008, 1848, 3612, 7182, 14343, 12291, 0, 0,                        //  <
        0, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 1632, 0,                     //  =
        0, 12291, 14343, 7182, 3612, 1848, 1008, 480, 192, 0, 0,                        //  >
        28, 30, 7, 3, 14211, 14275, 227, 119, 62, 28, 0,                                //  ?
        4088, 8190, 6151, 13299, 14331, 13851, 14331, 14331, 13831, 1022, 504           //  @
};

const unsigned int16 TEXT_11x16_4[11][11]={
        14336, 16128, 2016, 1788, 1567, 1567, 1788, 2016, 16128, 14336, 0,              //  A
        16383, 16383, 12483, 12483, 12483, 12483, 12519, 14846, 8124, 3840, 0,          //  B
        1008, 4092, 7182, 14343, 12291, 12291, 12291, 14343, 7182, 3084, 0,             //  C
        16383, 16383, 12291, 12291, 12291, 12291, 14343, 7182, 4092, 1008, 0,           //  D
        16383, 16383, 12483, 12483, 12483, 12483, 12483, 12483, 12291, 12291, 0,        //  E
        16383, 16383, 195, 195, 195, 195, 195, 195, 3, 3, 0,                            //  F
        1008, 4092, 7182, 14343, 12291, 12483, 12483, 12483, 16327, 16326, 0,           //  G
        16383, 16383, 192, 192, 192, 192, 192, 192, 16383, 16383, 0,                    //  H
        0, 0, 12291, 12291, 16383, 16383, 12291, 12291, 0, 0, 0,                        //  I
        3584, 7680, 14336, 12288, 12288, 12288, 12288, 14336, 8191, 2047, 0,            //  J
        16383, 16383, 192, 480, 1008, 1848, 3612, 7182, 14343, 12291, 0                 //  K
};

const unsigned int16 TEXT_11x16_5[11][11]={
        16383, 16383, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 0,        //  L
        16383, 16383, 30, 120, 480, 480, 120, 30, 16383, 16383, 0,                      //  M
        16383, 16383, 14, 56, 240, 960, 1792, 7168, 16383, 16383, 0,                    //  N
        1008, 4092, 7182, 14343, 12291, 12291, 14343, 7182, 4092, 1008, 0,              //  O
        16383, 16383, 387, 387, 387, 387, 387, 455, 254, 124, 0,                        //  P
        1008, 4092, 7182, 14343, 12291, 13827, 15879, 7182, 16380, 13296, 0,            //  Q
        16383, 16383, 387, 387, 899, 1923, 3971, 7623, 14590, 12412, 0,                 //  R
        3132, 7294, 14567, 12483, 12483, 12483, 12483, 14791, 8078, 3852, 0,            //  S
        0, 3, 3, 3, 16383, 16383, 3, 3, 3, 0, 0,                                        //  T
        2047, 8191, 14336, 12288, 12288, 12288, 12288, 14336, 8191, 2047, 0,            //  U
        7, 63, 504, 4032, 15872, 15872, 4032, 504, 63, 7, 0                             //  V
};

const unsigned int16 TEXT_11x16_6[11][11]={
        16383, 16383, 7168, 1536, 896, 896, 1536, 7168, 16383, 16383, 0,                //  W
        12291, 15375, 3612, 816, 480, 480, 816, 3612, 15375, 12291, 0,                  //  X
        3, 15, 60, 240, 16320, 16320, 240, 60, 15, 3, 0,                                //  Y
        12291, 15363, 15875, 13059, 12739, 12515, 12339, 12319, 12303, 12291, 0,        //  Z
        0, 0, 16383, 16383, 12291, 12291, 12291, 12291, 0, 0, 0,                        //  [
        14, 28, 56, 112, 224, 448, 896, 1792, 3584, 7168, 6144,                         //  \
        0, 0, 12291, 12291, 12291, 12291, 16383, 16383, 0, 0, 0,                        //  ]
        96, 112, 56, 28, 14, 7, 14, 28, 56, 112, 96,                                    //  ^
        49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152, 49152,    // _
        0, 0, 0, 0, 62, 126, 78, 0, 0, 0, 0,                                            //  `
        7168, 15936, 13152, 13152, 13152, 13152, 13152, 13152, 16352, 16320, 0          //  a
};

const unsigned int16 TEXT_11x16_7[11][11]={
        16383, 16383, 12480, 12384, 12384, 12384, 12384, 14560, 8128, 3968, 0,          //  b
        3968, 8128, 14560, 12384, 12384, 12384, 12384, 12384, 6336, 2176, 0,            //  c
        3968, 8128, 14560, 12384, 12384, 12384, 12512, 12480, 16383, 16383, 0,          //  d
        3968, 8128, 15328, 13152, 13152, 13152, 13152, 13152, 5056, 384, 0,             //  e
        192, 192, 16380, 16382, 199, 195, 195, 3, 0, 0, 0,                              //  f
        896, 51136, 52960, 52320, 52320, 52320, 52320, 58976, 32736, 16352, 0,          //  g
        16383, 16383, 192, 96, 96, 96, 224, 16320, 16256, 0, 0,                         //  h
        0, 0, 12288, 12384, 16364, 16364, 12288, 12288, 0, 0, 0,                        //  i
        0, 0, 24576, 57344, 49152, 49248, 65516, 32748, 0, 0, 0,                        //  j
        0, 16383, 16383, 768, 1920, 4032, 7392, 14432, 12288, 0, 0,                     //  k
        0, 0, 12288, 12291, 16383, 16383, 12288, 12288, 0, 0, 0                         //  l
};

const unsigned int16 TEXT_11x16_8[11][11]={
        16352, 16320, 224, 224, 16320, 16320, 224, 224, 16320, 16256, 0,                //  m
        0, 16352, 16352, 96, 96, 96, 96, 224, 16320, 16256, 0,                          //  n
        3968, 8128, 14560, 12384, 12384, 12384, 12384, 14560, 8128, 3968, 0,            //  o
        65504, 65504, 3168, 6240, 6240, 6240, 6240, 7392, 4032, 1920, 0,                //  p
        1920, 4032, 7392, 6240, 6240, 6240, 6240, 3168, 65504, 65504, 0,                //  q
        0, 16352, 16352, 192, 96, 96, 96, 96, 224, 192, 0,                              //  r
        4544, 13280, 13152, 13152, 13152, 13152, 16224, 7744, 0, 0, 0,                  //  s
        96, 96, 8190, 16382, 12384, 12384, 12384, 12288, 0, 0, 0,                       //  t
        4064, 8160, 14336, 12288, 12288, 12288, 12288, 6144, 16352, 16352, 0,           //  u
        96, 480, 1920, 7680, 14336, 14336, 7680, 1920, 480, 96, 0,                      //  v
        2016, 8160, 14336, 7168, 4064, 4064, 7168, 14336, 8160, 2016, 0                 //  w
};

const int16 TEXT_11x16_9[7][11]={
        12384, 14560, 7616, 3968, 1792, 3968, 7616, 14560, 12384, 0, 0,                 //  x
        0, 96, 33248, 59264, 32256, 7680, 1920, 480, 96, 0, 0,                          //  y
        12384, 14432, 15456, 13920, 13152, 12768, 12512, 12384, 12320, 0, 0,            //  z
        0, 128, 448, 8188, 16254, 28679, 24579, 24579, 24579, 0, 0,                     //  {
        0, 0, 0, 0, 16383, 16383, 0, 0, 0, 0, 0,                                        //  |
        0, 24579, 24579, 24579, 28679, 16254, 8188, 448, 128, 0, 0,                     //  }
        16, 24, 12, 4, 12, 24, 16, 24, 12, 4, 0                                         //  ~
};

//////////////////////////////////////////////////////////////////////////
//// Defines a 5x7 font ARray
/////////////////////////////////////////////////////////////////////////
const unsigned int8 FONT[51][5] ={0x00, 0x00, 0x00, 0x00, 0x00, //
.
.
.
}



//****************************************************************************//
// Purpose:       Draw a segment of a circle on a graphic LCD                 //
// Inputs:        (x,y) - The center of the circle                            //
//                radius - The radius of the circle                           //
//                angle_start - Start point angle of segment of circle        //
//                angle_end - End point angle of segment of circle            //
//                                                                            //
// Example:       (angle_start = 0 & angle_end = 360 draws a normal circle)   //
//                (angle_start = 0 & angle_end = 180 draws half circle (arc) )//
//                                                                            //
//                color - ON or OFF                                           //
// Dependencies:  glcd_pixel(), <math.h>                                      //
//****************************************************************************//
void glcd_circle_seg(int x, int y, int radius, int16 angle_start, int16 angle_end, int1 color)
{
   int   x_round, y_round;
   float angle;
   #define DEGREE 2*3.14159265/360
   
   for (angle = (float)angle_start; angle <= angle_end; angle += .9)
   {
      x_round = (sin (angle * DEGREE) * radius);
      y_round = (cos (angle * DEGREE) * radius);
      glcd_pixel(x + x_round, y + y_round, color);
   }
}



// Purpose:       Write a text in 11x16 font on a graphic LCD
#ifdef LARGE_LCD
void glcd_putc1116(unsigned int16 x, unsigned int16 y, char* textptr, unsigned int8 size, int1 color)
#else
void glcd_putc1116(unsigned int8 x, unsigned int8 y, char* textptr, unsigned int8 size, int1 color)
{
    byte j, k, l, m;                     // Loop counters
    unsigned int16 pixelData[11];                 // Stores character data
   
   
   for(; *textptr != '\0'; ++textptr, ++x)// Loop through the passed string
   {
   
    if(*textptr < ' ' || *textptr> '~')
       memcpy(pixelData, TEXT_11x16_1[0], 22);      // Non printable defaults to a space
    else if(*textptr < ' ' + 11)                           // Checks if the letter is in the first text array
       memcpy(pixelData, TEXT_11x16_1[*textptr-' '], 22);
    else if(*textptr < '+' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_2[*textptr-'+'], 22);
  else if(*textptr < '6' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_3[*textptr-'6'], 22);
    else if(*textptr < 'A' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_4[*textptr-'A'], 22);
    else if(*textptr< 'L' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_5[*textptr-'L'], 22);
    else if(*textptr < 'W' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_6[*textptr-'W'], 22);
    else if(*textptr < 'b' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_7[*textptr-'b'], 22);
    else if(*textptr < 'm' + 11)                           // Checks if the letter is in the next text array
       memcpy(pixelData, TEXT_11x16_8[*textptr-'m'], 22);
    else                                            // Must be in the last array
       memcpy(pixelData, TEXT_11x16_9[*textptr-'x'], 22);
       
        // Handles newline and carriage returns
       switch(*textptr)
      {
         case '\n':
            y +=16*size+1;
            return;
         case '\r':
            x = 0;
            return;
      }

      if(x+11*size >= GLCD_WIDTH)          // Performs character wrapping
      {
         x = 0;                           // Set x at far left position
         y += 16*size + 1;                 // Set y at next position down
      }
     
     
    for(j=0; j<11; ++j, x+=size) {        // Loop through character byte data
       for(k=0; k<16*size; ++k) {              // Loop through the vertical pixels
          if(bit_test(pixelData[j], k)) {           // Check if the pixel should be set
             for(l=0; l<size; ++l) {           // The next two loops change the character's size
                for(m=0; m<size; ++m) {
                   glcd_pixel(x+m, y+k*size+l, color); // Draw the pixel
                }
             }
          }
       }
    }
   }
}
#endif


bitmap.h for the array of images.
Code:


const int image_xy[]=
{
 0x40 , 0x20 // This 2 bytes defines the size of BMP for glcd_image_xy() function
             // You should define it by yourself if your image converter does not
             // add it by itself.(this image is 64x32 pixels -> 64=0x40, 32=0x20)

 
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x3F, 0x3F, 0x3F, 0x3F,
0x1F, 0x3F, 0x3F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0xF0, 0xF8, 0x38, 0x12, 0x07, 0x1F, 0x3E,
0x7C, 0x78, 0x36, 0x0F, 0x1F, 0x3E, 0xFC, 0xF3, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9F, 0x83, 0xF3, 0xC7, 0x8F, 0xC7, 0xF3,
0x83, 0xFF, 0x87, 0xC7, 0xC7, 0x87, 0xB7, 0xB7, 0xB7, 0xFF, 0x87, 0xD7, 0xD7, 0xD6, 0x86, 0xFE,
0x86, 0xB6, 0xB6, 0x96, 0x86, 0xFF, 0x87, 0xB7, 0xB7, 0xB7, 0xFF, 0xC7, 0x87, 0xEF, 0xEF, 0x87,
0xFF, 0x87, 0xF7, 0x87, 0xC7, 0xD7, 0xD7, 0xC7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};

muratmert4



Joined: 19 May 2011
Posts: 3

View user's profile Send private message

PostPosted: Wed Apr 29, 2015 4:06 am     Reply with quote

Very nice program. thanks
They worked with little improvement. Microchip logo beautiful. Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group