基于51单片机驱动LCD1602液晶显示thb6064ah细分64

嵌入式系统 时间:2016-11-30来源:网络
void LCD_write_command(uchar command){while(LCD_check_busy());LCD_RS = 0;LCD_RW = 0;LCD_E=0;_nop_();_nop_();LCD_DB = command;_nop_();_nop_();_nop_();_nop_();LCD_E = 1;_nop_();_nop_();_nop_();_nop_();LCD_E = 0;}void LCD_write_data(uchar dat){while(LCD_check_busy());LCD_RS = 1;LCD_RW = 0;LCD_E = 0;LCD_DB = dat;_nop_();_nop_();_nop_();_nop_();LCD_E = 1;_nop_();_nop_();_nop_();_nop_();LCD_E = 0;delay_n40us(1);}void LCD_disp_char(uchar x,uchar y,uchar dat){uchar address;if(y == 1){address = 0x80 + x;}else{address = 0xc0 + x;}LCD_write_command(address);LCD_write_data(dat);}void LCD_disp_str(uchar row,uchar * str){int i;if(row == 1){for(i=0;str[i]!=;i++){LCD_disp_char(i,1,str[i]);}}else{for(i=0;str[i]!=;i++){LCD_disp_char(i,2,str[i]);}}}bit LCD_check_busy(void){bit result;LCD_RS = 0;LCD_RW = 1;LCD_E = 1;_nop_();_nop_();_nop_();_nop_();delay_n40us(100);result = (bit)(LCD_DB & 0x80);LCD_E = 0;return result;}void delay_n40us(uint n){uint i;uchar j;for(i=n;i>0;i--){for(j=0;j<2;j++){_nop_();_nop_();}}}void StartTime0(void){ET0 = 1;TMOD = 0x01;TH0 = (65536-1000)/256;TL0 = (65536-1000)%256;TR0 = 1;EA = 1;}void CLKG(void) interrupt 1{CLK = ~CLK;TH0 = (65536-1000)/256;TL0 = (65536-1000)%256;}
1 2

关键词: 51单片机LCD1602液晶显示thb6064a

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关文章

查看电脑版