OnlineCourse/LCDLowLevel (2005-06-09 03:38:53)
  1. initialization happens when lcd.init != 0. In this case lcd_init_seq() is called about every 10 msec from mainloop (we hate busywait!!), and lcd.init is a state of the state-machine. lcd.init is also used for printing an address test sequence, which is not via the usual lcd.cache
  1. lcd.cache is used for storing a copy of what's on the lcd. lcd.dirty[] is a bitfield that marks dirty places (dirty ~ yet to be written). The ...dirty...() functions are used to set, clear, test positions in the bitfield, find_dirty() finds the first dirty position.
  1. low level routines send data and commands to lcd: toggle_E(), lcd_data(), lcd_cmd() and lcd_cmd8() and lcd_go2index(). You need to hd44780 datasheet to understand the commands. Not hard, but it's impossible to find out from the air :-)
  1. lcd_refresh() does the job of writing dirty positions from lcd.cache to the LCD using the low-level routines: querying lcd_busy(), finding a dirty position with find_dirty() and calling lcd_goto() or and lcd_cmd() as needed. Note that without busypoll configured, the worstcase LCD timings are not strictly enforced, especially in cold ( the LCD is slower in cold due to an internal RC oscillator, but the firmware is same speed since the microcontroller has a precise crystal ).
  1. formatting output like bin2BCDn() if you want to write decimal values into the lcd.cache. Very efficient routines.

lcd_display.c intensively uses the services of lcd.c


Serial connection of LCD - currently not supported in firmware

The linux kernel (I saw in 2.6.10) has USBLCD support.

More info in linux kernel sources and http://www.usblcd.de/


See also