LCD驱动IC驱动程序 CS701
时间:10-02
整理:3721RD
点击:
LCD驱动IC驱动程序 CS701
byte datareg,s;
byte s1,s2,s3,s4,s5;
void write_ppi(void)
{
byte t;
t=8;
while(t--)
{
l_ckb=1;
l_ckb=0;
src datareg;
if(flag.1)
l_cd0=1;
else
l_cd0=0;
l_ckb=1;
nop;
nop;
}
}
void lcd_init(void)
{
//device reset
l_csb = 1;
l_csb = 0;
datareg=0x01;
write_ppi();
.delay 20;
//0x31 DT[2:0] 011 4 duty
l_csb = 1;
l_csb = 0;
datareg=0x31;
write_ppi();
datareg=0x03;
write_ppi();
//0x32
//[7:5] 001 internal RC 35khz S0 S1
//[4] 1 LCD ON
//[3:1] 111
//[0] 0 Disable INTB
datareg=0x32;
write_ppi();
datareg=0x3E;//00111110
write_ppi();
//0x33 [7] 0 S2_INTB=S2
datareg=0x33;
write_ppi();
datareg=0x00;
write_ppi();
//0x34 frame rate 70hz
datareg=0x34;
write_ppi();
datareg=116;
write_ppi();
//0x35 Hi-Drive strong
datareg=0x35;
write_ppi();
datareg=0x03;
write_ppi();
//0x20 set write++
datareg=0x20;
write_ppi();
l_csb = 1;
clear_ram();
}
void display_bt(void)
{
//clear_ram();
l_csb = 1;
l_csb = 0;
datareg=0x80;
write_ppi();
s = s1;
datareg=s;
write_ppi();
s = s2;
datareg=s;
write_ppi();
s = s3;
datareg=s;
write_ppi();
s = s4;
datareg=s;
write_ppi();
s = s5;
datareg=s;
write_ppi();
l_csb = 1;
}
byte datareg,s;
byte s1,s2,s3,s4,s5;
void write_ppi(void)
{
byte t;
t=8;
while(t--)
{
l_ckb=1;
l_ckb=0;
src datareg;
if(flag.1)
l_cd0=1;
else
l_cd0=0;
l_ckb=1;
nop;
nop;
}
}
void lcd_init(void)
{
//device reset
l_csb = 1;
l_csb = 0;
datareg=0x01;
write_ppi();
.delay 20;
//0x31 DT[2:0] 011 4 duty
l_csb = 1;
l_csb = 0;
datareg=0x31;
write_ppi();
datareg=0x03;
write_ppi();
//0x32
//[7:5] 001 internal RC 35khz S0 S1
//[4] 1 LCD ON
//[3:1] 111
//[0] 0 Disable INTB
datareg=0x32;
write_ppi();
datareg=0x3E;//00111110
write_ppi();
//0x33 [7] 0 S2_INTB=S2
datareg=0x33;
write_ppi();
datareg=0x00;
write_ppi();
//0x34 frame rate 70hz
datareg=0x34;
write_ppi();
datareg=116;
write_ppi();
//0x35 Hi-Drive strong
datareg=0x35;
write_ppi();
datareg=0x03;
write_ppi();
//0x20 set write++
datareg=0x20;
write_ppi();
l_csb = 1;
clear_ram();
}
void display_bt(void)
{
//clear_ram();
l_csb = 1;
l_csb = 0;
datareg=0x80;
write_ppi();
s = s1;
datareg=s;
write_ppi();
s = s2;
datareg=s;
write_ppi();
s = s3;
datareg=s;
write_ppi();
s = s4;
datareg=s;
write_ppi();
s = s5;
datareg=s;
write_ppi();
l_csb = 1;
}