?? lcd.txt
字號(hào):
#define LCDDELAY 1
#define LCDCMDTURNON 0x3f
#define LCDCMDTURNOFF 0x3e
#define LCDCMDSTARTLINE 0xc0
#define LCDCMDPAGE 0xb8
#define LCDCMDVERADDRESS 0x40
#define REGISTERCLKMD (*(unsigned int *)0x58)
#define WAITSTATUS (*(unsigned int *)0x28)
ioport unsigned int port8000;
ioport unsigned int port8001;
ioport unsigned int port8002;
ioport unsigned int port8003;
ioport unsigned int port8004;
ioport unsigned int port8007;
void Delay1(unsigned int nTime); // 延時(shí)子程序
void TurnOnLCD(); // 打開顯示
void LCDCLS(); // 清除屏幕顯示內(nèi)容
void display16();
unsigned char ledkey[1][32]=
{
0x00, 0x01, 0x00, 0x01, 0x3f, 0x01, 0xa0, 0x7f, 0xa1, 0x20, 0x52, 0x12, 0x14, 0x02, 0x08, 0x02,
0x18, 0x02, 0x18, 0x06, 0x24, 0x05, 0x24, 0x09, 0x82, 0x18, 0x61, 0x70, 0x1c, 0x20, 0x00, 0x00
};
main()
{
TurnOnLCD();
LCDCLS();
display16( 0,0,1,ledkey);
}
void Delay1(unsigned int nDelay)
{
int ii,jj,kk=0;
for ( ii=0;ii<nDelay;ii++ )
{
for ( jj=0;jj<1024;jj++ )
{
kk++;
}
}
}
void TurnOnLCD()
{
port8001=LCDCMDTURNON;
Delay1(LCDDELAY);
port8002=0;
Delay1(1024);
port8001=LCDCMDSTARTLINE;
Delay1(LCDDELAY);
port8002=0;
Delay1(LCDDELAY);
}
void display16( int page,int line,int number,unsigned char (*pos)[32])
{
int i,n,p,m;
for(n=0;n<number;n++) /*8個(gè)字的依次顯示*/
{
p=0;
for(m=0;m<2;m++)/*每個(gè)字需要顯示2個(gè)頁(yè)*/
{
port8001=LCDCMDPAGE+m+page; /*設(shè)置操作頁(yè)=m+1*/
port8002=0;
Delay1(LCDDELAY);
port8001=LCDCMDVERADDRESS+n*16+line; /* 起始列=n*16+8 */
port8002=0;
Delay1(LCDDELAY);
for ( i=0;i<16;i++,p++ )
{
if((n*16+line+i)<64)
{
port8003=pos[n][p]; /* 屏幕左側(cè)第1至32行第i列賦值*/ port8002=0; /* (賦值后當(dāng)前操作列自動(dòng)加1,所以不需設(shè)置)*/
port8002=0;
Delay1(LCDDELAY);
}
else
{
port8001=LCDCMDVERADDRESS+n*16+line+i-64;
port8002=0;
port8004=pos[n][p]; /*屏幕左側(cè)第1至32行第i列賦值*/ port8002=0; /*賦值后當(dāng)前操作列自動(dòng)加1,所以不需設(shè)置*/
port8002=0;
Delay1(LCDDELAY);
}
}
}
}
}
void LCDCLS() /*清除LCD顯示器緩存*/
{
int i,j;
port8001=LCDCMDSTARTLINE;
port8002=0;
Delay1(LCDDELAY);
for ( i=0;i<8;i++ )
{
port8001=LCDCMDPAGE+i;
port8002=0;
Delay1(LCDDELAY);
port8001=LCDCMDVERADDRESS;
port8002=0;
Delay1(LCDDELAY);
for ( j=0;j<64;j++ )
{
port8003=0;
Delay1(LCDDELAY);
port8002=0;
Delay1(LCDDELAY);
}
port8001=LCDCMDPAGE+i;
Delay1(LCDDELAY);
port8002=0;
Delay1(LCDDELAY);
port8001=LCDCMDVERADDRESS;
port8002=0;
Delay1(LCDDELAY);
for ( j=0;j<64;j++ )
{
port8004=0;
Delay1(LCDDELAY);
port8002=0;
Delay1(LCDDELAY);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -