Hi everybody,
I am doing programming for 128x64 KS0107/08 Graphical LCD using Rabbi
2000 microprocessor. I am new to this LCD. I couldn't find how to make pixel on. I tried with the program as shown below.. But I am not gettin display.On the other hand, I didn't know what will be character size, actuall what will be the procedure to know the size of a character..
Kindly suggest me any idea or a sample program to display a character...
#class auto
/* commands for port settings */ #define SET_RS() BitWrPortI(PDDR,&PDDRShadow,1,0) //SET RS #define CLR_RS() BitWrPortI(PDDR,&PDDRShadow,0,0) //CLR RS #define SET_EN() BitWrPortI(PDDR,&PDDRShadow,1,1) //SET EN #define CLR_EN() BitWrPortI(PDDR,&PDDRShadow,0,1) //CLR EN #define SET_CS1() BitWrPortI(PDDR,&PDDRShadow,1,2) //SET CS1 #define CLR_CS1() BitWrPortI(PDDR,&PDDRShadow,0,2) //CLR CS1 #define SET_CS2() BitWrPortI(PDDR,&PDDRShadow,1,3) //SET CS2 #define CLR_CS2() BitWrPortI(PDDR,&PDDRShadow,0,3) //CLR CS2 #define LCD_CS1() CLR_CS2();SET_CS1(); #define LCD_CS2() SET_CS2();CLR_CS1();
/* commands for LCD */ #define DISPLAYON 0x3F /* display on */ #define SETPAGEADR 0xB8 /* x coordinate from 0-128 */ #define SETBYTEADR 0x40 /* y coordinate from 0-64 */ #define SETSTARTADR 0xC0 /* start line (z - address) */
/* function prototypes */ void LcdInit(void); void LcdWriteCmd(unsigned char ); void LcdWriteData(unsigned char ); void LcdDelay(void); void LcdClear(void); void LcdSetXY(int , int );
unsigned int i,j,x,y,row,col;
void main(void) /* Main Function */ { WrPortI ( PDFR,NULL,0x00 ); WrPortI ( PDDCR,NULL,0xFF ); WrPortI ( PDDDR,NULL,0xFF );
LcdInit();
LcdClear();
printf("\n MAIN LOOP");
for(row = 0; row < 8 ; row++ ) { for(col = 0; col < 128 ; col++){ LcdSetXY(row,col); LcdWriteData(0xFF); } } LcdClear();
while(1); }
void LcdInit(void) /* initialization of LCD */ { printf("\n Init function ");
LCD_CS1(); LcdWriteCmd(DISPLAYON);
LCD_CS2(); LcdWriteCmd(DISPLAYON); }
void LcdWriteCmd(unsigned char cmd) /* send command to LC
*/ { printf("\n IN CMD "); CLR_RS(); WrPortI(PADR,&PADRShadow,(PADRShadow | cmd)); SET_EN(); LcdDelay(); CLR_EN(); }void LcdWriteData(unsigned char data) /* send data to LC
*/ { printf("\n In DATA "); SET_RS(); WrPortI(PADR,&PADRShadow,(PADRShadow | data)); SET_EN(); LcdDelay(); CLR_EN(); }void LcdDelay(void) /* delay function */ { for(i=0;i