PDA

View Full Version : LCDOUT quesiton



schu4647
- 15th June 2006, 12:29
I have a question about LCD out. What does the $FE before a command actually due? Is this simply something that has to be there for the software, or is it actually sending something to the display. The reason I ask is because I have an LCD that I can control the brightness through software. If I set the RS=1 and send out a %00000010 which would set the display to 50%. I also notice that the cursor home command is RS=0 and %00000010 on the data line. This is done with LCDOUT $FE,2. My question is how do I make the RS line equal to 1. Can I do it by changing the FE? The manual doesn't really state where the FE comes from or give a definition for it. I thought maybe it was the state of the non data bits.

paul borgmeier
- 15th June 2006, 15:40
According to the Hitachi HD44780 Datasheet, RS should be set (high) before sending data commands and cleared (low) before sending instruction commands.

Since PBP has only a single instruction for parallel LCDs (LCDOUT), the compiler has to have a way to tell the difference between instruction commands and data commands.

My interpretation is that the $FE is a flag (i.e., instruction prefix) to tell the software that the next byte will be an instruction and therefore the software should clear the RS line before sending the next byte, otherswise the software should keep RS high when sending the next byte. ($FE is not sent to the LCD).

LCDOUT $FE,2 ; sends b0000010 to the LCD with RS low.
LCDOUT 2 ; sends b00000010 to the LCD with RS high.

If I had to guess as to why $FE, it probably comes from the serial "backpack" people that first made serial interfaces to parallel lcds. See any of the datasheets for serial LCDs at www.seetron.com for an example of this (they use $FE as an instruction prefix).
Further, $FE also is not defined by the HD44780 datasheet - a good choice for a flag.

(Lastly, make sure your LCD is based around HD44780 driver or compatible or else you might find other surprises.)

Paul Borgmeier
Salt Lake City, Utah
USA

schu4647
- 15th June 2006, 15:58
I actually tried to find what the state of RS was when characters were written. I couldn't find it in my datasheet so I assumed it was 0. If it is 1, then this should be a no brainer. Thanks, I will let you know if it worked.