hello,pl help me.....i dont know how to send a single character to CFAG240128L-STI-TZ....
this is my c code......
this is my c code......
Code:
#include <AT89S8253.H>
/* P3 is connected to a LED Bar to visualise the current LCD status
P1 and P0 ist connected with the LCD
*/
void writedatum(void);
void writecommand(void);
void delay(unsigned int zeit);
void statuscheck(void);
void statuscheck_Automode(void);
sbit RST = P1^0; //Reset low aktiv
sbit CD = P1^4; //CD=0 Datenregister CD=1 StatusCommandregister
sbit CE = P1^3; //Display Enable low aktiv
sbit R_D = P1^2; //Display read low aktiv
sbit W_R = P1^1; //Display write low aktiv
sbit FS = P2^2;
sbit RV = P2^3;
#define LCD_WIDTH 240
#define LCD_HEIGHT 128
#define FONT_WIDTH 0x06
#define FONT_HEIGHT 0x08
int i,n;
unsigned char LCD_Status;
unsigned char Daten[14] = {0x19,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x00}; //{0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
// 0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,
//0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x00};
//**********Functionen*****************
void statuscheck(void)
{
do {
P0 = 0xff; //P0 must be set high because the LCD can only pull it to low
CD = 1;
R_D = 0;
CE = 0;
delay(5);
LCD_Status = P0;
CE = 1;
R_D = 1;
LCD_Status &= 0x03;
// P2 = LCD_Status;
} while (LCD_Status != 0x03);
}
void statuscheck_Automode(void)
{
do {
P0 = 0xff; //P0 must be set high because the LCD can only pull it to low
CD = 1;
R_D = 0;
CE = 0;
delay(5);
LCD_Status = P0;
CE = 1;
R_D = 1;
LCD_Status &= 0x08;
// P3 = LCD_Status;
} while (LCD_Status != 0x08);
}
void writedatum (void)
{
CD = 0;
W_R = 0;
CE = 0;
delay(5);
CE = 1;
W_R = 1;
CD = 1;
}
void writecommand (void)
{
CD = 1;
W_R = 0;
CE = 0;
delay(5);
CE = 1;
W_R = 1;
CD = 1;
}
void delay(unsigned int zeit)
{
for (; zeit >0; zeit--);
}
void main()
{
//Reset
P2 = 0x00;
RST = 0;
delay(5000);
RST = 1;
// statuscheck();
//Set graphics home adresse to 0x0000
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x42;
writecommand();
//Set text home address to 0x1400
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x14;
writedatum();
statuscheck();
P0 = 0x40;
writecommand();
//Set graphics area to 0x1E;
statuscheck();
P0 = 0x1e;
writedatum();
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x40;
writecommand();
//Set text area to 0x1E;
statuscheck();
P0 = 0x1e;
writedatum();
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x41;
writecommand();
//Set OR mode
statuscheck();
P0 = 0x80;
writecommand();
//Set cur mode
statuscheck();
P0 = 0xA0;
writecommand();
//Set address pointer
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x24;
writecommand();
//****Delet Display RAM***************************
//Auto inc on
statuscheck();
P0 = 0xb0;
writecommand();
for(i=0;i<819;i++)
{
statuscheck_Automode();
P0 = 0x00;
writedatum();
}
//*****Send data to display*******
//Set Text on, Graphics off, Cursor off
statuscheck();
P0 = 0x94;
writecommand();
//Set address pointer
statuscheck();
P0 = 0x00;
writedatum();
statuscheck();
P0 = 0x14;
writedatum();
statuscheck();
P0 = 0x24;
writecommand();
for(n=0;n<10;n++)
{
for(i=0;i<10;i++)
{
statuscheck_Automode();
P0 = 0x19; //Daten [i];
writedatum();
}
}
//Auto inc on
statuscheck();
P0 = 0xb2;
writecommand();
while(1);
}
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Last edited by a moderator: