JAL library : hd447804, hd447808

previous up next

These libraries provide 4-bit (6 wire) and 8-bit (10 wire) interfaces to the Hitachi HD44780 LCD controller.

Both libraries first include hd44780p which contains the IO pin assignment. A local copy of this file can be adapted to accomodate a different IO pin assignment.

The provided routines are:

   procedure hd44780_clear   
   procedure hd44780_position( byte in x )
   procedure hd44780_line1
   procedure hd44780_line2
   procedure hd44780_write( byte in x )
   var byte volatile hd44780
   procedure hd44780_define( 
      byte in x, 
      byte in d0,
      byte in d1,
      byte in d2,
      byte in d3,
      byte in d4,
      byte in d5,
      byte in d6,
      byte in d7 
   )

hd44780_clear clears the display and puts the cursor at the first position.

hd44780_position puts the cursor at the indicated position without clearing the display.

hd44780_line1 and hd44780_line2 put the cursor at the begin of the first and second line, without clearing the display.

hd44780_write writes the indicated character to the current cursor position and advances the cursor.

Assigning to hd44780 has the same effect as a hd44780_put call.

A call to hd44780_define defines the pattern for the character x. X must be in the range 0 .. 7. The bytes b0 .. b7 each define one row of the pattern. B0 defines the top row, b7 the bottom row. The least significant bit (b0) defines the rightmost pixel, a logical one (bit true) makes the pixel dark (for a reflexive display). The character is defined by a 5 * 8 matrix, so b4 defines the leftmost pixel.

example:

   include 16f84_10
   include jlib
   include hd447804

   hd44780_clear
 
   hd44780 = "H"
   hd44780 = "e"
   hd44780 = "l"
   hd44780 = "l"
   hd44780 = "o"
   hd44780 = " "
   hd44780 = "W"
   hd44780 = "o"
   hd44780 = "r"
   hd44780 = "l"
   hd44780 = "d"

previous up next