No.60179 作者:guest 邮件:guest@guest.com ID:6 登陆:16560次 文章数:7648篇 最后登陆IP:219.68.9.43 最后登陆:2005/5/20 1:37:44 注册:2003/3/10 16:21:00 财富:35062 发帖时间:2004/8/11 13:08:11 发贴者IP:221.0.187.22 标题:guest:pic16f877控制hs12864液晶问题,请高手来回答 摘要:No.60179pic16f877控制hs12864液晶问题,请高手来回答 #include <pic.h> #define uchar unsigned char #define uint unsigned int #define ulint unsigned long #define PORTIT(adr,bit) ((unsigned)(&adr)*8+(bit)) //hs12864 static bit D_I @ PORTIT(PORTB,5); //RB5 static bit R_W @ PORTIT(PORTB,6); static bit E @ PORTIT(PORTB,7); static bit CS1 @ PORTIT(PORTB,3); static bit CS2 @ PORTIT(PORTB,4); static bit RET @ PORTIT(PORTB,2); //疑问 void sleep(unsigned int i) { unsigned int j,k; for(j=0;j <i;j++) { for(k=0;k <4000;k++) { ; } } } /************************************************************/ // HS12864函数 /************************************************************/ void LCD_C_D(uchar flag,uchar data) { D_I=!flag; E=0 ; R_W=0; PORTD=data; sleep(1); E=1; sleep(1); E=0; D_I=1; R_W=1; sleep(1); } void CLRLCD(uchar number) { uchar i,j; CS1=CS2=1; for(i=0xb8;i <0xc0;i++) ......
>>返回讨论的主题
|