Hello,
I want to connect a LCD to a ZX-24p to show for example two temperatures.
Because I am new to all that stuff, can someone tell me the general things I have to do to show the temperatures to a LCD?
Thanx
LCD General Connection
-
- Posts: 3
- Joined: 09 November 2011, 11:29 AM
Re: LCD General Connection
There are two general classes of LCDs: character and graphics. For the purpose you mentioned, the character type is probably the best, especially if you are a beginning or intermediate user.panagpanag wrote:I want to connect a LCD to a ZX-24p to show for example two temperatures.
Most character LCDs operate in the same basic manner. Generally, most bytes sent to the LCD are displayed as the corresponding ASCII character in a "cell" of the display. Usually, a certain byte or sequence of bytes is reserved to use as a prefix for "commands" to the display such as "turn on the backlight", "enable the cursor in blinking mode", "move the cursor to row 2 column 6". The details of what commands are available and how the commands are formatted do vary from one display to another but the command set is generally very simple.
So, the answer to your question is that you need to convert the temperature to a sequence of characters. Say for example, that the temperature is held in a Single-type variable. In this case, the Fmt() function can be used to produce a string containing the characters, e.g. "47.3". You can then use the Asc() function to retrieve each character from the string, in order, and send it to the LCD after positioning the LCD cursor where you want it.
How you send the characters and commands to the LCD depends on the type of interface the LCD supports. Some have an asynchronous serial interface that is likely compatible with the serial channels of ZBasic (e.g. Com2, Com3, etc.). Other displays might have an I2C, SPI or 4/8-bit parallel interface. There is some example code implementing an API for a few different interfaces:
http://www.zbasic.net/forum/about54.html
http://www.zbasic.net/forum/about820.html
http://www.zbasic.net/forum/about1238.html
There is also a ZBasic Application Note (AN-220), with example code, showing one way to interface a parallel LCD:
http://www.zbasic.net/appnotes.php
- Don Kinzer
-
- Posts: 3
- Joined: 09 November 2011, 11:29 AM