LCD General Connection

Discussion specific to the 24-pin ZX microcontrollers, e.g. ZX-24r, ZX-24s and ZX-24t.
Post Reply
panagpanag
Posts: 3
Joined: 09 November 2011, 11:29 AM

LCD General Connection

Post by panagpanag »

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
Don_Kirby
Posts: 341
Joined: 15 October 2006, 3:48 AM
Location: Long Island, New York

Post by Don_Kirby »

Have you decided which LCD display you will be using yet?
panagpanag
Posts: 3
Joined: 09 November 2011, 11:29 AM

Post by panagpanag »

I can only imagine how I want it to look, like
"Temperature 1 Temperature 2".
I know I do not give much information but I myself try to figure it all out!
That is why I post for a general connection rule,I f there is something like this!
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: LCD General Connection

Post by dkinzer »

panagpanag wrote:I want to connect a LCD to a ZX-24p to show for example two temperatures.
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.

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
panagpanag
Posts: 3
Joined: 09 November 2011, 11:29 AM

Post by panagpanag »

I will study your notes and see what I can do!
Thank you for your help!
Post Reply