《移动的爱心显示1602.doc》由会员分享,可在线阅读,更多相关《移动的爱心显示1602.doc(3页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、【精品文档】如有侵权,请联系网站删除,仅供学习与交流移动的爱心显示1602.精品文档.#include#include #define uchar unsigned char#define uint unsigned intsbit lcdrs=P35;sbit lcde=P34;sbit we=P27;void delay(uint z)/延时程序uint x,y;for(x=z;x0;x-)for(y=110;y0;y-);/*1602的程序*/void writecom(uchar com)/1602的写指令we=0;lcdrs=0;lcde=1;P0=com;delay(5);lcde
2、=0;delay(5);void writedate(uchar date)/1602的写数据lcdrs=1;lcde=1;P0=date;delay(5);lcde=0;delay(5);void start()/1602的初始化lcde=0;writecom(0x38);writecom(0x0f);writecom(0x06);writecom(0x01);void xianshi(uchar *s)/1602显示while(*s0)writedate(*s);s+;/*主程序*/void main()start();while(1)writecom(0x80+0x00);xianshi
3、( * * );writecom(0x80+0x40);xianshi( * * );writecom(0x80+0x00);xianshi( * * );writecom(0x80+0x40);xianshi(* );writecom(0x80+0x00);xianshi(* );writecom(0x80+0x40);xianshi(* );writecom(0x80+0x00);xianshi(* );writecom(0x80+0x40);xianshi(* );writecom(0x80+0x00);xianshi(* );writecom(0x80+0x40);xianshi( *
4、 );writecom(0x80+0x00);xianshi( * );writecom(0x80+0x40);xianshi( * );writecom(0x80+0x00);xianshi( * );writecom(0x80+0x40);xianshi( * );writecom(0x80+0x00);xianshi( * );writecom(0x80+0x40);xianshi( * );writecom(0x80+0x00);xianshi( * );writecom(0x80+0x40);xianshi( * );writecom(0x80+0x00);xianshi( * );writecom(0x80+0x40);xianshi( );delay(200);