12864液晶万年历制作

那位仁兄有啊

/*-----------------------------------------------------------*/ #define LCD_OFF 0x3E #define LCD_ON 0x3F #define Add_X 0xB8 //the start address of the page 0 ;(0~7) #define Add_Y 0x40 //the start address of the Y counter ; (0~64) #define Add_Z 0xC0 //the start address of the DDRAM ; (0~64) #define UPLINE 0x01 #define UNDERLINE 0x80 /*-----------------------------------------------------------*/ #define LCD12864_DATA_PORT P0 sbit LCD12864_EN =P1^4; sbit LCD12864_RW =P1^3; //0:write ; 1:read sbit LCD12864_RS =P1^2; //0:the command .1:the data sbit LCD12864_CS_L =P1^1; //select the left of the lcd when 1 sbit LCD12864_CS_R =P1^0; sbit LCD12864_RST =P1^5; /*------------------------------------------------------------*/ void delayus(unsigned int us) { while(us--); } void delayms(unsigned ms) { unsigned int i,j; for (i=0;i<ms;i++) { for (j=0;j<1000;j++) ; } } /*--------------------------select the LCD--------------------*/ void LCDSel(unsigned char sel) { switch(sel) { case 0: LCD12864_CS_L=0;LCD12864_CS_R=0;break; case 1: LCD12864_CS_L=1;LCD12864_CS_R=0;break; //left case 2: LCD12864_CS_L=0;LCD12864_CS_R=1;break; //right default:; }; } /*------------------------------------------------------------*/ void WaitLCD() { unsigned char flag; LCD12864_DATA_PORT=0xFF; LCD12864_RW=1; LCD12864_RS=0; LCD12864_EN=1; LCD12864_EN=1; LCD12864_EN=0; LCD12864_DATA_PORT=0xFF; //读有效数据 LCD12864_RW=1; LCD12864_RS=0; ; LCD12864_EN=1; do { flag=LCD12864_DATA_PORT; LCD12864_DATA_PORT=0xFF; }while(!((flag&0x80)==0x80)); LCD12864_EN=0; } //*/ /*-------------------------------------------------------------*/ void WriteDatToLCD12864(unsigned char dat) { WaitLCD(); LCD12864_RS=1; //the data LCD12864_RW=0; //write LCD12864_DATA_PORT=dat; LCD12864_EN=1; ; LCD12864_EN=0;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值