LCD[0] - LCD[3]


Allows the use of an LCD display(s) equipped with an HD44780 or compatible chip. Can be used directly or with I2C interface. Select the Parallel / I2C mode in the Setup/Peripheral menu, set the SCL and SDA pins for I2C, and specify the interface address, which can be modified by crossing the A0, A1, A2 sources on the panel, default: 27. Device addresses on the bus are visible in the serial terminal during boot.
Parallel connection:
LCDWeMos
GNDGND
Vcc5V
VeeContrast
RSD3
R/WGND
ESetup E
D4D0
D5D5
D6D6
D7D7

Contrast can be adjusted with the Vee pin. Usually good when connected to GND. If not, it can be adjusted with a potentiometer or using the Contrast GPIO set in the Setup menu. For backlight, a serial resistor of ~56Ω is recommended. For multiple displays, apart from the E pin, the others should be connected in parallel. Most displays do not operate with Vcc at 3.3V.

LCD[0](CLR)
Clears the display.

LCD[0](L,0)Left
Writes to the first row aligned to the left.
LCD[0](L3,0)Left3
Writes to the first row aligned to the left with a 3-character margin.
LCD[0](&L9,0)rewrite
Writes onto the first row aligned to the left.
LCD[0](R,0)Right
Writes to the first row aligned to the right.
LCD[0](C,0)Center
Writes to the first row centered.
LCD[0](C,1)Line 2
Writes to the second row centered.
LCD[0](CLR,C,0)Clean screen
Clears the display and writes to the first row centered.

LCD[0](CLR,L,0)Á É Í Ó Ö Ő Ú Ü
LCD[0](CLR,L,0)Ű á é í ú ü ó ö
LCD[0](CLR,L,0)ő ű Æ à â å Ç ç
LCD[0](CLR,L,0)Ë è ê ë î Ø Ò Õ
LCD[0](CLR,L,0)ò õ ø û ù æ ß Â
LCD[0](CLR,L,0)Ä Å Î č Č Ğ ğ Đ
LCD[0](CLR,L,0)đ İ ı Š š Ş ş Ž
LCD[0](CLR,L,0)ž Ș ș Ț ț °
Accented characters.
Up to 8 different accented/custom characters can be used at once! To use different special characters than the previous eight, you need to clear the display before displaying.

LCD[0](CLR,L,0)%0 %1 %2 %3 %4 %5 %6 %7
LCD[0](CLR,L,0)%8 %9 %A %B %C %D %E %F
LCD[0](CLR,L,0)%G %H %I %J %K %L %M %N
LCD[0](CLR,L,0)%O %P %Q %R %S %T %U %V
LCD[0](CLR,L,0)%W%X|
LCD[0](L,1)%Y%Z

Custom characters.
Custom characters can be stored in the LCD.txt file. You can create the desired character on the https://maxpromer.github.io/LCD-Character-Creator website or on graph paper with a square grid.
5 columns, 7 or 8 rows, depending on the type of display.

Example LCD.txt:
0: B00000 B00100 B01110 B11111 B01110 B00100 B00000 B00000 # 1: B00100, B00010, B00100, B01000, B00100, B00010, B00100, B00000 # LCD[0](ON)
Turns on the backlight. Works only with I2C panels.
LCD[0](OFF)
Turns off the backlight. Works only with I2C panels.

LCD[0](RST)
Resets the display.

LCD[0]@
Sends the display parameters to STDOUT.


Examples

Digital clock.
CMD[10]:STR[0]=%MS %D. %WL;STR[1]=%0h:%0m:%0s|
CMD[11]:LCD[0](C,0)STR[1];LCD[0](C,1)STR[0]|
TIMES:CMD[10];CMD[11]


Changes a value without clearing the entire row.
LCD[0](&L,0)VALUE:|
LCD[0](&R,0)Text|
NUM[0]CC:STR[0](A,3, );LCD[0](&L7,0)STR[0]

NUM[0]=1
NUM[0]=23
NUM[0]=456

Online LCD.
<html> <body> <H1>LCD</H1> <textarea id="line0" style="resize:none;display:none;" placeholder="Line0" rows="1"></textarea><br> <textarea id="line1" style="resize:none;display:none;" placeholder="Line1" rows="1"></textarea><br> <textarea id="line2" style="resize:none;display:none;" placeholder="Line2" rows="1"></textarea><br> <textarea id="line3" style="resize:none;display:none;" placeholder="Line3" rows="1"></textarea><br> <select id="lcd" onchange="onOpen();"> <option value="LCD[0]">LCD[0]</option> <option value="LCD[1]">LCD[1]</option> <option value="LCD[2]">LCD[2]</option> <option value="LCD[3]">LCD[3]</option> </select> <button type="button" onclick="sendWS(lcd.value + '(CLR)');">CLR</button> <button type="button" onclick="send();">PRINT</button> <script type="text/javascript" src="tools.js"></script> <script> startWS(3); var cols; var rows; var lcd = document.getElementById('lcd'); function onOpen() { for (var i = 0; i < 4; i++) {document.getElementById("line" + i).style.display = "none";} sendWS(lcd.value + "@"); } function onMessage(msg) { msg = msg.split(","); if (msg[3] != "LCD") {return;} cols = msg[0]; rows = msg[1]; for (var i = 0; i < rows; i++) { document.getElementById("line" + i).cols = cols; document.getElementById("line" + i).maxLength = cols; document.getElementById("line" + i).style.display = "inline"; } } function send() { for (var i = 0; i < rows; i++) { sendWS(lcd.value + "(L," + i + ")" + document.getElementById("line" + i).value); } } </script> </body> </html>