当前位置:首页 > 嵌入式 > 嵌入式硬件
[导读]sbit p_csa=P2^6;sbit p_csb=P2^7;sbit p_gnda=P2^5;sbit p_gndb=P2^4;sbit p_di=P2^3;sbit p_rw=P2^2;sbit p_e=P2^1;忙判别void lcd_busy(void) {p_di=0;p_rw=1;P0=0xff;w

sbit p_csa=P2^6;

sbit p_csb=P2^7;

sbit p_gnda=P2^5;

sbit p_gndb=P2^4;

sbit p_di=P2^3;

sbit p_rw=P2^2;

sbit p_e=P2^1;

忙判别

void lcd_busy(void) {

p_di=0;p_rw=1;P0=0xff;

while (1) {

p_e=1;

if (P0<0x80) break;

p_e=0;

}

p_e=0;

}

/*设置xy*/

void set_xy(unsigned char x,unsigned char y) {

if (x>=64) {p_csa=0;p_csb=1;} else {p_csb=0;p_csa=1;}

lcd_busy();

p_di=p_rw=0;P0=0x40|x;p_e=1;p_e=0;

lcd_busy();

p_di=p_rw=0;P0=0xb8|y;p_e=1;p_e=0;

P0=0xff;

}

void lw(unsigned char x,unsigned char y,unsigned char dd) {

set_xy(x,y);

lcd_busy();p_di=1;p_rw=0;P0=dd;p_e=1;p_e=0;

P0=0xff;

}

/*显示初始化*/

#pragma disable

void lcd_init(void) {

unsigned char x,y;

p_gnda=p_gndb=0;

/*开显示*/

p_e=p_di=p_rw=0;

p_csa=p_csb=0;

p_csa=1;P0=0x3f;p_e=1;p_e=0;p_csa=0;

p_csb=1;P0=0x3f;p_e=1;p_e=0;p_csb=0;

/*0行开始显示*/

p_csa=1;lcd_busy();p_di=p_rw=0;P0=0xc0;p_e=1;p_e=0;p_csa=0;

p_csb=1;lcd_busy();p_di=p_rw=0;P0=0xc0;p_e=1;p_e=0;p_csb=0;

for (y=0;y<8;y++) {

for (x=0;x<128;x++) lw(x,y,0);

}

}

unsigned char code asc[]={

0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,

0x0,0x0,0x38,0xfc,0xfc,0x38,0x0,0x0,0x0,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0,0x0,0x7,0xf,0x8,0x8,0x0,

0x0,0x0,0x0,0xbc,0xbc,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0xf,0x0,0x0,0x0,

0x0,0x4,0x4,0xbc,0xf8,0x40,0x40,0x0,0x0,0x8,0x8,0xf,0x7,0x0,0x0,0x0,

0x8,0xc,0x4,0xc,0x8,0xc,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,

0x80,0xc0,0x60,0x30,0x60,0xc0,0x80,0x0,0x7,0x7,0x4,0x4,0x4,0x7,0x7,0x0

};

unsigned char code hz[]={

/*解: 0*/

0x20,0x10,0xec,0x27,0xf4,0x2c,0xe4,0x40,

0x22,0x9e,0x2,0xd2,0x22,0x1f,0x2,0x0,

0x80,0x40,0x3f,0x9,0x3f,0x89,0xff,0x8,

0xa,0x9,0x9,0xff,0x9,0x9,0x8,0x0

};

显示汉字,fb==1:反白显示

void dh(unsigned char x,unsigned char y,unsigned char n,unsigned char fb) {

unsigned char i,dd;

for (i=0;i<16;i++) {

dd=hz[i+n*32];

if (fb) if (n!=kongbai) dd=255-dd;

lw(x*8+i,y,dd);

dd=hz[i+n*32+16];

if (fb) if (n!=kongbai) dd=255-dd;

lw(x*8+i,y+1,dd);

}

}

显示字符,fb==1:反白显示

void da(unsigned char x,unsigned char y,unsigned char n,unsigned char fb) {

unsigned char i,dd;

n-=32;

if (n>128) n=0;

if (fb) dd=255; else dd=0;

lw(x*8,y,dd);

lw(x*8,y+1,dd);

for (i=0;i<7;i++) {

dd=asc[i+n*16];

if (fb) dd=255-dd;

lw(x*8+i+1,y,dd);

dd=asc[i+n*16+8];

if (fb) dd=255-dd;

lw(x*8+i+1,y+1,dd);

}

}

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。
换一批
延伸阅读

9月2日消息,不造车的华为或将催生出更大的独角兽公司,随着阿维塔和赛力斯的入局,华为引望愈发显得引人瞩目。

关键字: 阿维塔 塞力斯 华为

加利福尼亚州圣克拉拉县2024年8月30日 /美通社/ -- 数字化转型技术解决方案公司Trianz今天宣布,该公司与Amazon Web Services (AWS)签订了...

关键字: AWS AN BSP 数字化

伦敦2024年8月29日 /美通社/ -- 英国汽车技术公司SODA.Auto推出其旗舰产品SODA V,这是全球首款涵盖汽车工程师从创意到认证的所有需求的工具,可用于创建软件定义汽车。 SODA V工具的开发耗时1.5...

关键字: 汽车 人工智能 智能驱动 BSP

北京2024年8月28日 /美通社/ -- 越来越多用户希望企业业务能7×24不间断运行,同时企业却面临越来越多业务中断的风险,如企业系统复杂性的增加,频繁的功能更新和发布等。如何确保业务连续性,提升韧性,成...

关键字: 亚马逊 解密 控制平面 BSP

8月30日消息,据媒体报道,腾讯和网易近期正在缩减他们对日本游戏市场的投资。

关键字: 腾讯 编码器 CPU

8月28日消息,今天上午,2024中国国际大数据产业博览会开幕式在贵阳举行,华为董事、质量流程IT总裁陶景文发表了演讲。

关键字: 华为 12nm EDA 半导体

8月28日消息,在2024中国国际大数据产业博览会上,华为常务董事、华为云CEO张平安发表演讲称,数字世界的话语权最终是由生态的繁荣决定的。

关键字: 华为 12nm 手机 卫星通信

要点: 有效应对环境变化,经营业绩稳中有升 落实提质增效举措,毛利润率延续升势 战略布局成效显著,战新业务引领增长 以科技创新为引领,提升企业核心竞争力 坚持高质量发展策略,塑强核心竞争优势...

关键字: 通信 BSP 电信运营商 数字经济

北京2024年8月27日 /美通社/ -- 8月21日,由中央广播电视总台与中国电影电视技术学会联合牵头组建的NVI技术创新联盟在BIRTV2024超高清全产业链发展研讨会上宣布正式成立。 活动现场 NVI技术创新联...

关键字: VI 传输协议 音频 BSP

北京2024年8月27日 /美通社/ -- 在8月23日举办的2024年长三角生态绿色一体化发展示范区联合招商会上,软通动力信息技术(集团)股份有限公司(以下简称"软通动力")与长三角投资(上海)有限...

关键字: BSP 信息技术
关闭
关闭