#2
小焦叔叔2020-06-22 21:35
|
①数据接口对应没有错,
②软硬件方法的复位都试过(硬件复位是R接+5V,4.7k,C接地,100uF;软件复位是unsigned int型数据,大小为600或1000,单片机是IAP15W4K58S4,时钟11.059200MHz,不分频),
③CS1、2、3高低电平都试过
④20k电位器一头接+5V,一头接VOUT,中间接VO
下面是我写的简单的液晶测试程序:
#include"STC15.H"
sbit RST=P3^2;
sbit RS=P4^1;
sbit RW=P4^2;
sbit E=P4^3;
sbit CS1=P4^5;
sbit CS2=P3^4;
sbit CS3=P3^3;
void Init_IO();
void Init_LCD();
void Start_Line_Set(unsigned char line);
void Addr_Page_Set(unsigned char page);
void Addr_Col_Set(unsigned char col);
void Wcom(unsigned char com);
void WDat(unsigned char dat);
void Ready();
void Delay(unsigned int t);
void main()
{
Init_IO();
Init_LCD();
Start_Line_Set(0);
Addr_Page_Set(2);
Addr_Col_Set(10);
WDat(0xDB); //显示一点像素作为验证
while(1);
}
void Init_IO()
{
P2M1=0x00;
P2M0=0x00;
P3M1=0x00;
P3M0=0x00;
P4M1=0x00;
P4M0=0x00;
}
void Init_LCD()
{
RST=0;
Delay(1000);
RST=1;
CS1=1;
CS2=0;
CS3=0;
Wcom(0x3F);
}
void Start_Line_Set(unsigned char line)
{
Wcom(0xC0|line);
}
void Addr_Page_Set(unsigned char page)
{
Wcom(0x40|page);
}
void Addr_Col_Set(unsigned char col)
{
Wcom(0xB8|col);
}
void Wcom(unsigned char com)
{
E=0;
RS=0;
RW=0;
E=1;
Ready();
P2=com;
E=0;
}
void WDat(unsigned char dat)
{
E=0;
RS=1;
RW=0;
E=1;
Ready();
P2=dat;
E=0;
}
void Ready()
{
unsigned int t=1000;
while(t--);
}
void Delay(unsigned int t)
{
while(t--);
}
这个程序的运行结果如照片所示:
只有本站会员才能查看附件,请 登录
有会使用19264液晶的网友能帮帮忙吗?谢谢了!!!!!!