These routines implement the interface to text LCD modules controled by the HD44780 controller and compatibles. The display mimics a TTY screen, with automatic scroll and recognizes the standard control codes '\a', '\b', '\f', '\n', '\r', '\t' and '\v'.
I'm using this code for some years now, in various slightly different versions. Now I decided to make the 'definitive' version, to be the most flexible yet as simple to use as possible.
This incarnation is not tested yet. I'm not sure the code without the R/!W pin is OK, because I always use the R/!W pin.
I included a lot of #if... to allow for maximum flexibility and I must test every combination to make sure I didn't screwed anything.
They can be used together with the 'stdio' functions ('printf', etc.) to program for embedded systems the same way someone would do for desktop systems.
The files below are a lighter version of the ones above. In this version, the scroll was replaced by wrap-around, to simplify the code and save some RAM and hardware-stack levels.
This version was tested and works very well. It was adapted to a different board than the version above, please check the ASCII-art at line 43 of file LCDcfg-lite.h.
Questions:
Couple of quick notes/questions/comments:James Newton of MassMind replies: Ah... I just found the "4Mhz" in the header. My bad.+1. LCD_DI or Data/!Instruction is another name for R/S which is more commonly found in the documentation for the panels.
2. It's curious that you say you always use the R/!W pin, but the LCD-lite code defaults to having that option unused.
3. The delay functions are hard coded for a specific clock rate, but you don't seem to document that rate. Since most C compilers for PIC's have a built in delay macro (e.g. __delay_us(byte) shouldn't that be used? A good compiler shouldn't require that to be a function when stack levels are critical. Perhaps I'm wrong on that?
Isaac Marino Bavaresco replies: 1. Good point! 2. The project that originated this particular version was one of the few I didn't use R/!W because it was too resource constrained and also it was only required to meet human-interface sppeds, so some extra delays would not be a problem. 3. Not every C compiler's library have good delay routines (or any at all), and often they have different definitions, etc. Besides, unfortunately not every compiler can be called "good". +
Comments:
file: /Techref/member/IMB-yahoo-J86/HD44780-tty.htm, 5KB, , updated: 2011/10/25 09:09, local time: 2024/8/14 21:54,
owner: IMB-yahoo-J86,
3.144.90.205:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/Techref/member/IMB-yahoo-J86/HD44780-tty.htm"> Routines to control an HD44780-based LCD module emulating a tty screen</A> |
Did you find what you needed? |