[英]Only scrolling some Text in 16x2 LCD(HD44780 display programm
I have a program which display as follows . 我有一个程序,显示如下。
first Line : Volt : Over Voltage Second Line : Current : Over Current. 第一行:电压:过电压第二行:电流:过电流。
In LCD the cant fully display the letter OVer Voltage or Over Current . 在LCD中,不能完全显示字母OVer Voltage或Over Current。 I just want to scroll these . 我只想滚动这些。 But the Volt : and current : letter will be there that will not need to scroll ? 但是Volt和current的字母会在那里,不需要滚动吗?
So you will need to create a routine to cycle thru the messages you want to display. 因此,您将需要创建一个例程来循环浏览要显示的消息。
As an example, first time send "Volt: Over Volta" Then a second later send "Volt: ver Voltag" then "Volt: er Voltage" and so on. 例如,第一次发送“ Volt:Over Volta”,然后第二次发送“ Volt:ver Voltag”,然后发送“ Volt:er Voltage”,依此类推。
The other option would be to create a routine to display the value part with a starting index after determining the len. 另一种选择是在确定len之后创建例程以显示带有起始索引的值部分。
The following puesdo code is not compiled/tested. 以下puesdo代码未编译/测试。
char buf[17];
char label[]= "Current";
char value[]= "Over Current";
while(1)
{
if (++start_pos >= (strlen(value)+strlen(label)-16)
{
start_pos=0;
delay(500); //ms
}
snprintf(buf,16,"%s: %s",label,value[start_pos]);
puts(buf); // whatever the name of your routine to send string to LCD
if (start_pos==0)
{
delay(500); //ms
}
delay(1000); //ms NOTE: you probably want to go do some other code during this time.
}
You may want to see if you're LCD has a scroll command. 您可能需要查看LCD是否具有滚动命令。 Some LCDs have a character buffer where you can write data to then give a scroll command to shift which are displayed. 某些LCD上有字符缓冲区,您可以在其中写入数据,然后发出滚动命令以移动显示的内容。 For example I've used an LCD that can store 40 characters per line in DDRAM while displaying only 16. If I remember correctly, you have to scroll both lines at once this way, though. 例如,我使用的LCD可以在DDRAM中每行存储40个字符,而只显示16个字符。如果我没记错的话,则必须以这种方式一次滚动两行。
If this doesn't tickle your fancy, another way is to shift your buffer in code and re-write all of it to the LCD. 如果这还没有使您满意,那么另一种方法是转移代码中的缓冲区并将其全部重新写入LCD。 You can do this fast enough that it doesn't look terrible. 您可以足够快地执行此操作,使其看起来并不可怕。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.