lcd_hd44780_8

LCD library for HD44780 compatible LCDs, with 8 bits wide datatransfer

Author Rob Hamerling, Copyright © 2008..2009, all rights reserved.
Adapted-by Eur van Andel, Joep Suijs (refactoring),Richard Zengerink (lcd_init)
Compiler 2.4p

Description

   Port interface for HD44780 compatible alphanumeric LCD screens.
   Uses 8 bits wide datapath + 2 handshake lines (total 10 PIC pins).
   Expects: 2 pins for handshake: 'lcd_rs' and 'lcd_en'
            and:
                   1 complete port for data: 'lcd_dataport'
                or
                   2 nibbles for data: 'lcd_dataport_low' and 'lcd_dataport_high'
                or
                   8 individual pins for data: lcd_dataline_d0 .. _d7
.
   note:    a complete ports gives faster and more compact code then
            two port 'nibble'' (the lower or higher 4 bits of a port)
            which is on its turn faster than 8 individual pins.
.
   Directions for use of this library in application programs
   (in this sequence):
   1. Declare the following constants:
         const byte LCD_ROWS     = 2               -- 1, 2 or 4 lines
         const byte LCD_CHARS    = 16              -- 8, 16 or 20 chars per line
      and aliases for handshake lines:
         alias   lcd_rs          is  pin_D2        -- cmd/data select
         alias   lcd_en          is  pin_D3        -- trigger
      and aliases for 8 data lines:
            alias  lcd_dataport  is  portF         -- 8 databits
          or
            alias  lcd_dataport_low  is portD_high  -- 4 low order databits
            alias  lcd_dataport_high is portC_high  -- 4 high order databits
          or
            alias   lcd_d0       is  pin_D0        -- lcd databit d0
            alias   lcd_d1       is  pin_D1        -- lcd databit d1
            alias   lcd_d2       is  pin_C6        -- lcd databit d2
            alias   lcd_d3       is  pin_C7        -- lcd databit d3
            alias   lcd_d4       is  pin_B0        -- lcd databit d4
            alias   lcd_d5       is  pin_B1        -- lcd databit d5
            alias   lcd_d6       is  pin_C0        -- lcd databit d6
            alias   lcd_d7       is  pin_C2        -- lcd databit d7
.
   2. Set the chosen LCD handshake pins to output:
         pin_D2_direction     = output
         pin_D3_direction     = output
      and the data port to output:
             portF_direction      = ALL_OUTPUT
         or 2 data port nibbles to output:
             portD_high_direction = ALL_OUTPUT
             portC_high_direction = ALL_OUTPUT
         or 8 individual data pins to outout:
             pin_D0_direction     = output
             pin_D1_direction     = output
             pin_C6_direction     = output
             pin_C7_direction     = output
             pin_B0_direction     = output
             pin_B1_direction     = output
             pin_C0_direction     = output
             pin_C2_direction     = output
.
   3. Include this library.
.
   4. Call lcd_init() to initialize the lcd controller.
.
   Above is an example for a 2x16 LCD.
.
   See hd_44780_common for the LCD API.


Dependencies


Summary

Global variables/contants

Procedures

Private

Functions


API details

Global variables/contants

Procedures

  • lcd_init()

    Initialize LCD controller to 8-bits mode and default operational settings
    
    

Private

Functions


Related samples

Here are the list of samples which use this library:

16f72716f727_lcd_hd44780_8_1.jal
16f72716f727_lcd_hd44780_8_4.jal
16f877a16f877a_lcd_hd44780_8_4.jal
16f877a16f877a_lcd_hd44780_8_1.jal
16f88716f887_lcd_hd44780_8_1.jal
16f88716f887_lcd_hd44780_8_4.jal
18f468518f4685_lcd_hd44780_8_4.jal
18f468518f4685_lcd_hd44780_8_1.jal
18f631018f6310_lcd_hd44780_8_1.jal
18f631018f6310_lcd_hd44780_8_8.jal
18f631018f6310_lcd_hd44780_8_4.jal