欢迎访问ic37.com |
会员登录 免费注册
发布采购

STC12C5A60S2

日期:2011-10-11类别:会员资讯 阅读:250 (来源:互联网)
公司:
深圳市顺鑫诚电子科技有限公司
联系人:
黄小姐
手机:
黄经理 13725528746
电话:
086-0755-29486608 29486609
传真:
086-0755-29486609
QQ:
1533095505 449551876
地址:
深圳市公司地址:福田区華強北金茂禮都
//1602 四线制驱动程序,根据需要自己改端口定义和延时 #define LINE1 0 #define LINE2 1 #define LINE1_HEAD 0x80 #define LINE2_HEAD 0xC0 #define CLEARSCREEN LCD_en_com(0x01);LCD_delay(30) /*************************************/ //change this part at different board sbit DB7=P2^7; sbit DB6=P2^6; sbit DB5=P2^5; sbit DB4=P2^4; sbit LCD1602_RS=P2^1; //data command select 1 data 0 command pin 4 sbit LCD1602_RW=P2^2; //read write select 1 read 0 write pin 5 sbit LCD1602_EN=P2^3; //LCD enable signal pin 6 /********************************************************************/ void LCD_delay(unsigned int n) { unsigned int i=0,j=0; for (i=n;i>0;i--) for (j=0;j<12;j++); } void LCD_en_com(unsigned char command) { DB7=(command>>7)%2; DB6=(command>>6)%2; DB5=(command>>5)%2; DB4=(command>>4)%2; LCD1602_RS = 0; //RS 0 LCD1602_RW = 0; //RW 0 LCD1602_EN = 1; //EN --\|/__ Write command LCD_delay(2); LCD1602_EN = 0; DB7=(command>>3)%2; DB6=(command>>2)%2; DB5=(command>>1)%2; DB4=(command>>0)%2; LCD1602_RS = 0; //RS 0