CYW-B320240D图形点阵液晶模块C语言驱动程序范例【驰宇微】
#include
#include
#include
void delay1ms(unsigned int count)
{
int i,j;
for(i=0;i<=count;i++)
for(j=0;j<=583;j++);
}
void lcd_reset(void)
{
lcd_RES = 1;
delay1ms(2);
lcd_SEL1 = 0;
lcd_A0 = 0;
lcd_WR = 1;
lcd_RD = 1;
lcd_CS = 1;
lcd_RES = 0;
delay1ms(100);
lcd_RES = 1;
delay1ms(500);
}
void lcd_initial(void)
{
lcd_cmdwrite(0x40); //SYSTEM SET
lcd_datawrite(0x30); //p1
lcd_datawrite(0x87); //p2
lcd_datawrite(0x07); //p3
lcd_datawrite(0x27); //p4
lcd_datawrite(0x37); //p5
lcd_datawrite(0xef); //p6
lcd_datawrite(0x28); //p7
lcd_datawrite(0x00); //p8
lcd_cmdwrite(0x44); //SCROLL
lcd_datawrite(0x00); //sa1-L
lcd_datawrite(0x00); //sa1-H
lcd_datawrite(0xf0); //sL1
lcd_datawrite(0x80); //sa2-L
lcd_datawrite(0x25); //sa2-H
lcd_datawrite(0xf0); //sL2
lcd_datawrite(0x00); //sa3-L
lcd_datawrite(0x3a); //sa3-H
lcd_datawrite(0x00); //sa4-L
lcd_datawrite(0x3a); //sa4-H
lcd_cmdwrite(0x5a); //HDOT SCR
lcd_datawrite(0x00);
lcd_cmdwrite(0x58); //DISP OFF
lcd_datawrite(0x54);
lcd_cmdwrite(0x5d); //CSR FORM
lcd_datawrite(0x00); //CRX
lcd_datawrite(0x00); //CRY
lcd_cmdwrite(0x59); //DISP ON
lcd_datawrite(0x54);
lcd_cmdwrite(0x5b);
lcd_datawrite(0x00);
}
void lcd_cmdwrite(unsigned char cmdx)
{
lcd_SEL1 = 0;
lcd_CMD = cmdx;
lcd_A0 = 1;
lcd_CS = 0;
lcd_WR = 0;
lcd_WR = 1;
lcd_CS = 1;
//lcd_A0 = 0;
}
void lcd_datawrite(unsigned char datax)
{
lcd_chkbusy();
lcd_SEL1 = 0;
lcd_A0 = 0;
lcd_DATA = datax;
lcd_CS = 0;
lcd_WR = 0;
lcd_WR = 1;
lcd_CS = 1;
lcd_A0 = 1;
}
unsigned char lcd_cmdread(void)
{
unsigned char address_cmd;
lcd_DATA=0xff;
lcd_SEL1 = 0;
lcd_A0 = 0;
lcd_CS = 0;
lcd_RD = 0;
address_cmd = lcd_DATA;
lcd_RD = 1;
lcd_CS = 1;
lcd_A0 = 0;
return(address_cmd);
}
unsigned char lcd_dataread(void)
{
char address_data;
lcd_DATA=0xff;
lcd_SEL1 = 0;
lcd_A0 = 1;
lcd_CS = 0;
lcd_RD = 0;
address_data = lcd_DATA;
lcd_RD = 1;
lcd_CS = 1;
lcd_A0 = 1;
return(address_data);
}
void lcd_cursorxy(unsigned char x,unsigned char y)
{
//lcd_chkbusy();
lcd_cmdwrite(0x46);
lcd_datawrite(x);
lcd_datawrite(y);
}
void lcd_chkbusy(void)
{
unsigned char busy;
do
{
busy =(lcd_cmdread() & 0x40);
}while(busy);
}
void lcd_showbig(unsigned char *text,unsigned int x)
{
while(*text != '\0')
{
lcd_datawrite(*text);
++text;
delay1ms(x);
}
}
void lcd_clear(void)
{
unsigned int i;
lcd_cursorxy(0x00,0x00);
lcd_cmdwrite(0x42);
for(i=0;i<0x7fff;i++)
lcd_datawrite(0x00);
}
-------------------------------------------------------------------------------
深圳驰宇微科技有限公司
Tel:+86-755-29446830
Mobile:18926046819(微信号)
http://www.cywlcd.com
Add:深圳市龙华新区大浪街道华宁路伟华达工业园C1栋七楼
-------------------------------------------------------------------------------
驰宇微---11年专业研发、生产与销售【点阵液晶显示模块】和【段码液晶屏】,售前、售后技术支持,性能稳定可靠!
深圳驰宇微液晶模块厂家主要研发生产:
1. 单色液晶屏点阵式lcd,包括:12864液晶模块、12864液晶屏、320240液晶模块、320240液晶屏、240128液晶模块、240128液晶屏、160128液晶模块、160128液晶屏、24064液晶模块、24064液晶屏、19264液晶模块、19264液晶屏、16032液晶模块、16032液晶屏、12232液晶模块、12232液晶屏等点阵液晶显示模块和带中文字库液晶屏。
2. 单色液晶屏字符液晶模块,包括:0802液晶模块、1602液晶模块、1604lcd液晶模块、2002液晶模块、2004液晶模块等。
3. 段码液晶屏包括:VA LCD、 TN LCD、HTN LCD、STN LCD、FSTN LCD等笔段式LCD。
广泛应用于:医疗设备、仪器仪表、汽车电子、工控设备、电表、水表、温控器、智能家居等众多产品。不管是点阵液晶还是段式液晶,都可按要求定制液晶屏。
驰宇微首页 | 图形点阵液晶模块 | 中文字库液晶模块 | 字符型液晶模块 | 段码液晶模块 | 产品列表 | 站点地图 | 关于驰宇微
公司名称: 深圳驰宇微科技有限公司
备案号:粤ICP备14047421号
公司地址:深圳市龙华区大浪街道华昌路241号鸿源工业区E栋5层
公司电话:0755-29446830 13640934827
邮 箱:18926046819@163.com Q Q:577895076
版权归深圳驰宇微科技所有