首先说下19264屏
1926屏是由3个64*64 组成 64行 192列 其中192列 是64+64+64 =192
它们分别有CS1 CS2 CS3 控制 让那个屏显示 所以 每个屏最多只能显示64行64列 切结8行 等于1页。
每页只能最多写8行 64列,8*64 =512位 512/8 =64字节最多写64字节 。。以上就是19264液晶屏的基本原理,虽然各个厂商硬件有所差异但原理基本相同。
以下给之前项目中使用的AT-C19264的驱动部分代码仅供参考!
C++ Code
#include "main.h"
#define __LCD_C__
const uchar code jie[]={
0x08,0x08,0x08,0xFF,0x88,0x68,0x24,0x2C,0xB4,0x25,0x26,0x34,0x2C,0x24,0x20,0x00,
0x02,0x42,0x81,0x7F,0x02,0x82,0x8A,0x4E,0x53,0x32,0x12,0x2E,0x42,0xC2,0x02,0x00 //"接",0
};
const uchar code di[]={
0x10,0x10,0x10,0xFE,0x10,0x50,0x40,0xFE,0x20,0x20,0xFF,0x10,0x10,0xF8,0x10,0x00,
0x20,0x20,0x10,0x1F,0x08,0x08,0x00,0x3F,0x40,0x40,0x4F,0x42,0x44,0x43,0x70,0x00//"地",1
};
const uchar code zu[]={
0x00,0xFF,0x11,0x29,0xC7,0x01,0xFE,0x22,0x22,0x22,0x22,0x22,0xFE,0x00,0x00,0x00,
0x00,0xFF,0x02,0x04,0x43,0x40,0x7F,0x42,0x42,0x42,0x42,0x42,0x7F,0x40,0x40,0x00//"阻",3
};
const uchar code ce[]={
0x08,0x31,0x86,0x60,0x00,0xFE,0x02,0xF2,0x02,0xFE,0x00,0xF8,0x00,0x00,0xFF,0x00,
0x04,0xFC,0x03,0x00,0x80,0x47,0x30,0x0F,0x10,0x67,0x00,0x07,0x40,0x80,0x7F,0x00//"测",0
};
const uchar code shi[]={
0x40,0x42,0xDC,0x08,0x00,0x90,0x90,0x90,0x90,0x90,0xFF,0x10,0x12,0x1C,0x10,0x00,
0x00,0x00,0x7F,0x20,0x10,0x20,0x20,0x1F,0x10,0x10,0x01,0x06,0x18,0x20,0x78,0x00//"试",1
};
const uchar code dian[]={
0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFF,0x48,0x48,0x48,0x48,0xF8,0x00,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0x3F,0x44,0x44,0x44,0x44,0x4F,0x40,0x70,0x00,//"电",2
};
const uchar code liu[]={
0x10,0x60,0x01,0x86,0x60,0x04,0x44,0x64,0x55,0x4E,0x44,0x64,0xC4,0x04,0x04,0x00,
0x04,0x04,0xFC,0x03,0x40,0x30,0x0F,0x00,0x00,0x7F,0x00,0x3F,0x40,0x40,0x70,0x00//"流",3
};
const uchar code si[]={
0x00, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0x10, 0x90, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x10, 0x00,
0x00, 0x07, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x03, 0x40, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00//"时",0
};
const uchar code jian[]={
0x00, 0xF8, 0x01, 0x06, 0x00, 0xF0, 0x92, 0x92, 0x92, 0x92, 0xF2, 0x02, 0x02, 0xFE, 0x00, 0x00,
0x00, 0xFF, 0x00, 0x00, 0x00, 0x07, 0x04, 0x04, 0x04, 0x04, 0x07, 0x40, 0x80, 0x7F, 0x00, 0x00//"间",1
};
const uchar code bao[]={
0x08,0x08,0x88,0xFF,0x48,0x28,0x00,0xFF,0xC1,0x41,0x41,0x49,0x51,0xCF,0x00,0x00,
0x01,0x41,0x80,0x7F,0x00,0x00,0x00,0xFF,0x40,0x23,0x14,0x1C,0x33,0x60,0x20,0x00
};
const uchar code jing[]={
0x20,0x1A,0xFA,0xAF,0xAA,0xEF,0x0A,0xFA,0x10,0x8F,0x54,0x24,0x5C,0x84,0x04,0x00,
0x02,0x02,0x02,0xEA,0xAA,0xAA,0xAB,0xAA,0xAB,0xAA,0xAA,0xEA,0x02,0x02,0x03,0x00
};
const uchar code bu[]={
0x08,0x08,0x89,0xCE,0x2A,0x98,0x48,0x00,0x00,0x00,0xFF,0x20,0x40,0x80,0x00,0x00,
0x02,0x01,0x00,0xFF,0x01,0x02,0x04,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x03,0x00
};
const uchar code cang[]={
0x40,0x20,0xF8,0x27,0x02,0x30,0x92,0x9C,0x90,0x9F,0x90,0x98,0x96,0x34,0x10,0x00,
0x00,0x00,0x7F,0x00,0x00,0x22,0x72,0x2A,0x2E,0x22,0x22,0x2A,0x72,0x22,0x02,0x00
};
const uchar code zero[]={
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00, //"0",
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00, //"1",
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00, //"2",
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00, //"3",
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00, //"4",
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00, //"5",
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00, //"6",
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00, //"7",
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00, //"8",
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00, //"9",
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00 //"."
};
const uchar code m[]={
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
const uchar code R[]={
0x00,0x00,0xC0,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0xC0,0x00,0x00,0x00,
0x00,0x38,0x23,0x24,0x28,0x30,0x00,0x00,0x00,0x30,0x28,0x24,0x23,0x38,0x00,0x00
};
const uchar code A[]={
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
const uchar code S[]={
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
void delay_ms(uint dly) //@6MHz
{
unsigned char i, j;
while(dly!=0){
//_nop_();
//_nop_();
dly--;
i = 6;
j = 210;
do
{
while (--j);
} while (--i);
}
}
void send_bt(uint bty){
uchar i;
for (i=0;i<8;i++){
clk164 =0;
if (bty & 0x80)
dat164 = 1;
else
dat164 = 0;
clk164 = 1;
bty = bty << 1;
}
}
void lcd_write_command(uchar cmd){
//while(busy()); //返回1 死循环 测试忙
lcd_di =0;
lcd_rw =0;
send_bt(cmd);
lcd_e =1;
//delay(1);
_nop_();
lcd_e =0;
}
void lcd_write_data(uchar dat){
//while(busy()); //返回1 死循环 测试忙
lcd_di =1;
lcd_rw =0;
send_bt(dat);
lcd_e =1;
//delay(1);//防止 写数据 与写指令频率太快
_nop_();
lcd_e =0;
}
void set_line(uchar line){
lcd_di =0;
lcd_rw =0;
line = 0xc0 | line;
lcd_write_command(line);
}
void set_page(uchar page){
lcd_di = 0;
lcd_rw = 0;
page = 0xb8 | page;
lcd_write_command(page);
}
void set_column(uchar col){
lcd_di = 0;
lcd_rw = 0;
col = col & 0x3f;
col = 0x40 | col;
lcd_write_command(col);
}
void select_screen(uchar swich){
//swich = 0x07 & swich;
switch(swich)
{
case 0:
{lcd_cs1=lcd_cs2=lcd_cs3 =0;
break;}
case 1:
{lcd_cs1=lcd_cs2 =0;
lcd_cs3 = 1;
break;}
case 2:
{lcd_cs1=lcd_cs3 = 0;
lcd_cs2 =1;
break;}
case 3:
{lcd_cs1=0;
lcd_cs2=lcd_cs3 = 1;
break;}
case 4:
{lcd_cs1=1;
lcd_cs2=lcd_cs3=1;
break;}
case 5:
{lcd_cs1=lcd_cs3=1;
lcd_cs2 =0;
break;}
case 6:
{lcd_cs1=lcd_cs2=1;
lcd_cs3=0;
break;}
case 7:
{lcd_cs1=lcd_cs2=lcd_cs3=1;
break;}
default:
break;
}
}
void set_on_off(uchar swich){
lcd_di = 0;
lcd_rw = 0;
swich = 0x3e | swich;
lcd_write_command(swich);
}
void lcd_scr_clr(void){
uchar i,j;
lcd_cs1 =lcd_cs2 = lcd_cs3 =0;
set_line(0);
set_on_off(1);
set_column(0);
for (i=0;i<8;i++){
set_page(i);
for (j=0;j<64;j++){
lcd_write_data(0x00);
}
}
}
void lcd_init(void){
//while(busy()); //返回1 死循环 防止更改PO口继电器
clr164=1;
lcd_rst=1;
lcd_scr_clr();
set_line(0);//这里是设置起始行
}
void display(uchar screen ,uchar page,uchar col,uchar *p){
uchar i;
select_screen(screen);
set_page(page);
set_column(col);
for (i=0;i<16;i++){
lcd_write_data(p[i]);
}
set_page(page +1);
set_column(col);
for (i=0;i<16;i++){
lcd_write_data(p[i+16]);
}
}
void display_word(void){
display(3,0,0,jie);
display(3,0,16,di);
display(3,0,32,dian);
display(3,0,48,zu);
display(3,3,0,ce);
display(3,3,16,shi);
display(3,3,32,dian);
display(3,3,48,liu);
display(3,6,0,ce);
display(3,6,16,shi);
display(3,6,32,si);
display(3,6,48,jian);
display(6,0,32,m);
display(6,0,41,R);
display(6,3,32,A);
display(6,6,32,S);
}
void display_word_current(void)
{
display(3,3,0,ce);
display(3,3,16,shi);
display(3,3,32,dian);
display(3,3,48,liu);
display(6,3,32,A);
}
void display_word_time(void)
{
display(3,6,0,ce);
display(3,6,16,shi);
display(3,6,32,si);
display(3,6,48,jian);
display(6,6,32,S);
}
void display_word_offset(void)
{
display(3,6,0,bu);
display(3,6,16,cang);
display(3,6,32,dian);
display(3,6,48,zu);
display(6,6,32,m);
display(6,6,41,R);
}
void display_word_alarm(void)
{
display(3,3,0,bao);
display(3,3,16,jing);
display(3,3,32,dian);
display(3,3,48,zu);
display(6,3,32,m);
display(6,3,41,R);
}
void show_sit(uchar screen,uchar row,uchar x_sit,uchar y_sit)reentrant{
select_screen(screen);
set_line(row);
set_page(x_sit);
set_column(y_sit);
}
void display_current(uint test_current ){
uint timh1,timh2,timh3;
uint i;
//10 25 100
timh1 = test_current/100%10; //百位
timh2 = test_current/10%10; //取出10位
timh3 = test_current% 10;//个位
show_sit(5,63,3,40);
for (i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i]);
show_sit(5,63,4,40);
for(i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i+8]);
show_sit(5,63,3,48);
for (i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i]);
show_sit(5,63,4,48);
for(i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i+8]);
show_sit(5,63,3,56);
for (i=0;i<8;i++)
lcd_write_data(zero[timh3*16+i]);
show_sit(5,63,4,56);
for(i=0;i<8;i++)
lcd_write_data(zero[timh3*16+i+8]);
}
void display_time(uint test_time) reentrant {
uint timh1,timh2;
uint i;
timh1 = test_time/10%10;//取出 十位
timh2 = test_time%10;//取出 个位
show_sit(5,63,6,40);
for (i=0;i<8;i++)
lcd_write_data(zero[ timh1*16+i]);
show_sit(5,63,7,40);
for(i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i+8]);
show_sit(5,63,6,48);
for (i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i]);
show_sit(5,63,7,48);
for(i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i+8]);
}
void display_offset(uchar offset_R)
{
uint timh1,timh2;
uint i;
timh1 = offset_R/10%10;//取出 十位
timh2 = offset_R%10;//取出 个位
show_sit(5,63,6,40);
for (i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i]);
show_sit(5,63,7,40);
for(i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i+8]);
show_sit(5,63,6,48);
for (i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i]);
show_sit(5,63,7,48);
for(i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i+8]);
}
void display_alarm(uchar alarm_R)
{
uint timh1,timh2,timh3;
uint i;
timh1 = alarm_R/100%10;//取出 百位位
timh2 = alarm_R/10%10;//取出 十位位
timh3 = alarm_R%10;//取出个位
show_sit(5,63,3,32);
for (i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i]);
show_sit(5,63,4,32);
for(i=0;i<8;i++)
lcd_write_data(zero[timh1*16+i+8]);
show_sit(5,63,3,40);
for (i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i]);
show_sit(5,63,4,40);
for(i=0;i<8;i++)
lcd_write_data(zero[timh2*16+i+8]);
show_sit(5,63,3,48);
for (i=0;i<8;i++)
lcd_write_data(zero[timh3*16+i]);
show_sit(5,63,4,48);
for(i=0;i<8;i++)
lcd_write_data(zero[timh3*16+i+8]);
}
void display_result(uint jd_dz){
uchar timh1,timh2,timh3,timh4;
uchar row;
timh1 = jd_dz/1000;
timh2 = jd_dz%1000/100;
timh3 = jd_dz %1000%100/10;
timh4 = jd_dz%1000%100%10;
show_sit(5,63,0,40);
for(row=0;row<8;row++)
lcd_write_data(zero[timh1*16+row]);
show_sit(5,63,1,40);
for(row=0;row<8;row++)
lcd_write_data(zero[timh1*16+row+8]); //zero这个数组拆开的
show_sit(5,63,0,48);
for(row=0;row<8;row++)
lcd_write_data(zero[timh2*16+row]);
show_sit(5,63,1,48);
for(row=0;row<10;row++)
lcd_write_data(zero[timh2*16+row+8]); //高2位
show_sit(5,63,0,56);
for(row=0;row<8;row++)
lcd_write_data(zero[timh3*16+row]);
show_sit(5,63,1,56);
for(row=0;row<8;row++)
lcd_write_data(zero[timh3*16+row+8]);
show_sit(6,63,0,0);
for(row=0;row<8;row++)
lcd_write_data(zero[timh4*16+row]);
show_sit(6,63,1,0);
for(row=0;row<8;row++)
lcd_write_data(zero[timh4*16+row+8]);//后2位
//难道是共阴共阳极点阵 发 10列数据? 2页 10*16 发得都是列数据
}
『本文转载自网络,版权归原作者所有,如有侵权请联系删除』