问题描述
我们有一个字符LCD(www.cloverlcd.com/pdf/S6A0069.pdf),我们必须在8位模式下工作.但是,现在我们试图使其在4位模式下工作,但似乎什么也没显示.我认为尚未编写功能集指令.有人可以检查我是否以正确的方式处理吗?我将发布我的8位代码(正在工作)和我的4位代码(我正在尝试开始工作)
We have a character LCD (www.cloverlcd.com/pdf/S6A0069.pdf) that we got to work in 8 bit mode. However, now we are trying to get it to work in 4 bit mode but it doesn't seem to be displaying anything. I think the function set instruction isn't been written. Can somebody please check if I am approaching this the right way? I'll post my 8 bit code (which is working) and my 4 bit code (which I'm trying to get to work)
//8 bit working
COMPortC(0x3C); //function set
Delay1KTCYx(10);
COMPortC(0x0F); //Turn on display and configure cursor settings
Delay1KTCYx(10);
COMPortC(0x01); //clear display
Delay1KTCYx(10);
COMPortC(0x06); //increment mode and increment direction (entry mode set)
Delay1KTCYx(10);
COMPortC(0x02); //Return Home
//4 bit
COMPortC(0x20); //function set
Delay1KTCYx(10);
COMPortC(0x20); //function set
Delay1KTCYx(10);
COMPortC(0x80); //function set
Delay1KTCYx(10);
COMPortC(0x00); //Turn on display and configure cursor settings
Delay1KTCYx(10);
COMPortC(0xF0); //Turn on display and configure cursor settings
Delay1KTCYx(10);
推荐答案
我不确定您的4位是如何连接的,但是我的猜测是....因为您是在高半字节(0x)上发送位* 0-星星所在的位置),您可能希望使用较低或最低有效半字节,即0x0 *.
I'm not sure how your 4 bits are hooked up, but my guess is.... Since you are sending the bits on the upper nibble (0x*0 - where the star is), that you likely want to use the lower or least significant nibble which would be 0x0*.
COMPortCWithoutBusy(0x02); //function set first nibble
Delay1KTCYx(10);
COMPortCWithoutBusy(0x02); //function set second nibble
Delay1KTCYx(10);
BusyEnable();
Delay1KTCYx(10);
...
这篇关于LCD 8位模式到4位模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!