|
发表于 2005-8-16 23:17:02
|
显示全部楼层
< >//12232B
#include<ZIKU_new.c>
#define i_m XBYTE[0x370e]
#define i_s XBYTE[0x570e]
#define d_m XBYTE[0xb70e]
#define d_s XBYTE[0xd70e]</P>
< >/*void delay(uint nn);
void write_char(x,y,array);
void write_chinese(x,y,array);
void lcd_init(void);
void clrscr(void);
void lw(uchar x,uchar y,uchar dd);
void send_command(uchar cmd);
*/
sbit di=P2^7;
sbit e2=P2^6;
sbit e1=P2^5;</P>
< >void delay(uint nn){
unsigned int mm;
while(nn-->0)
for(mm=0;mm<5000;mm++){ };
}</P>
<P>
void send_command(uchar cmd)
{
i_m=cmd;
i_s=cmd;
}</P>
<P>void lw(uchar x,uchar y,uchar dd)
{
if (x<61)
{
i_m=0xb8|y;
i_m=0x00|x;
d_m=dd;
}
else
{
x=x-61;
i_s=0x00|x;
i_s=0xb8|y;
d_s=dd;
}
}</P>
<P>void clrscr(void)
{
uchar x,y;
for (y=0;y<4;y++)
{
for (x=0;x<122;x++) lw(x,y,0);
}
}</P>
<P>void lcd_init(void)
{</P>
<P> send_command(0xe2);//reset
send_command(0xae);//off display
send_command(0xc0);//set display start line
send_command(0xa4);//off static drive
send_command(0x00);//set colume address
send_command(0xa9);//1/32 duty
send_command(0xa0);//adc select rightward output
send_command(0xee);//read modify write off
send_command(0xaf);//on display</P>
<P>}</P>
<P>void write_chinese(x,y,array)
unsigned char x,y;
unsigned char array[];
{
unsigned char j,dd;
for(j=0;j<32;j++)
{
dd=array[j];
if(j<16) lw(x+j,y,dd);
else lw(x+j-16,y+1,dd);
}
}
void write_char(x,y,array)
unsigned char x,y;
unsigned char array[];
{
unsigned char j,dd;
for(j=0;j<16;j++)
{
dd=array[j];
if(j<8) lw(x+j,y,dd);
else lw(x+j-8,y+1,dd);
}
}
</P>
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|