The LCD command will display text on a standard text/character LCD module with the minimum of programming effort.
This command will work with LCD modules that use the KS0066, HD44780 or SPLC780 controller chip and have 1, 2 or 4 lines.
To setup the display you use the LCD INIT command:
LCD INIT d4, d5, d6, d7, rs, en
D4, d5, d6 and d7 are the I/O pins that connect to inputs D4, D5, D6 and D7 on the LCD module (inputs D0 to D3 and R/W on the module should be connected to ground). ‘rs’ is the pin connected to the register select input on the module (sometimes called CMD or DAT). ‘en’ is the pin connected to the enable or chip select input on the module.
Any I/O pins can be used and you do not have to set them up beforehand (the LCD command automatically does that for you). The following diagram shows a typical set up.
To display characters on the module you use the LCD command:
LCD line, pos, data$
Where line is the line on the display (1 to 4) and pos is the position on the line where the data is to be written (the first position on the line is 1). data$ is a string containing the data to write to the LCD display. The characters in data$ will overwrite whatever was on that part of the LCD.
The following shows a typical usage.
LCD INIT 2, 3, 4, 5, 23, 24
LCD 1, 2, "Temperature"
LCD 2, 6, STR$(DS18B20(15)) ' DS18B20 connected to pin 15
Note that this example also uses the DS18B20 function to get the temperature.