PicGIM 0.5 documentation    
Copyright (C) 2002, 2013 - [AsYntote-SkyMatrix] gKript.org    
Generated on Sun Apr 26 2015 11:03:34 with DoxyGen 1.8.8    
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
LCD Character [Hitachi HD44780]

This module manages the Characters LCD Display with HD44780 controller.
It is able to support up to a maximum of four controllers.
For each controller, four lines are available.
For example it is possible use two 4x40 (which have 2 controllers each), or four 4x20 (which have only a controller each).
The management of the data bus, at present, is implemented only in four bit mode.
The configuration also allows to choose whether to use the Busy-Flag, or a software delay.

Module configuration

In order to use the module, it must enabled and software configured in:

and must be assigned to it the related control pins in:

Display dimensions

#define PG_LCD_HD44780_COLUMN 16
#define PG_LCD_HD44780_LINE 2

These defines set the dimensions of the display in the number of columns and rows.


Busy Time mode


With this define you change the way you manage the busy time of the display.
It must be:

  • PG_ENABLE : busy flag enabled.
  • PG_DISABLE : busy flag disabled.

With PG_LCD_HD44780_BUSY_FLAG enabled PicGIM uses the busy flag of the LCD.
If disabled PicGIM calls a delay; this is an easier method but with a light loss of performance.


Line addresses

#define PG_LCD_HD44780_LINE_0_ADDRESS 0x00
#define PG_LCD_HD44780_LINE_1_ADDRESS 0x40
#define PG_LCD_HD44780_LINE_2_ADDRESS 0x00
#define PG_LCD_HD44780_LINE_3_ADDRESS 0x40

These defines set the addresses of the first character of each line.
Max four lines are available.
Missing lines MUST be set to PG_MISSING .


Splash screen


A print of a splash screen is possible enabling this define.
It must be:

  • PG_ENABLE : splash screen enabled.
  • PG_DISABLE : splash screen disabled.
#define PG_LCD_HD44780_SPLASH_TIME 1

This one is to choose how long view it.
Time is expressed in seconds [s].
It is a quick way to verify the correct initialization of the display.


Pin: RW

#define PG_LCD_HD44780_RW L_B3

This pin controls the reading or writing.


Pin: RS

#define PG_LCD_HD44780_RS L_B4

This pin controls whether the display must receive a command or a data.


Pin: EN

#define PG_LCD_HD44780_EN_0_PRESENT PG_YES
#define PG_LCD_HD44780_EN_1_PRESENT PG_NO
#define PG_LCD_HD44780_EN_2_PRESENT PG_NO
#define PG_LCD_HD44780_EN_3_PRESENT PG_NO

These defines declares the availability of enables.
It must be:

  • PG_YES : lcd enable pin present.
  • PG_NO : lcd enable pin not present.
#define PG_LCD_HD44780_EN_0 L_B2
#define PG_LCD_HD44780_EN_1 PG_MISSING
#define PG_LCD_HD44780_EN_2 PG_MISSING
#define PG_LCD_HD44780_EN_3 PG_MISSING

These defines assign the pin to enable that was declared present.
If an enable not exist, you must set this field to PG_MISSING.


Pin: DATA<0-3>

#define PG_LCD_HD44780_DATA_0 L_D7
#define PG_LCD_HD44780_DATA_1 L_D6
#define PG_LCD_HD44780_DATA_2 L_D5
#define PG_LCD_HD44780_DATA_3 L_D4

Here are defined the four pins for data.
Refer to the datasheet of the display to know what are the pin relative to which to connect in four-bit mode.


Pin: BL


This define declares the availability of the BACKLIGHT pin control.
It must be:

  • PG_YES : backlight pin is present.
  • PG_NO : backlight pin is not present.
    #define PG_LCD_HD44780_BL L_D3
    This define assign the pin to control the backlight that was declared present.
    If a backlight pin do not exist, you must set this field to PG_MISSING.



#define PG_LCD_HD44780_RW_TRIS T_B3
#define PG_LCD_HD44780_RS_TRIS T_B4
#define PG_LCD_HD44780_EN_0_TRIS T_B2
#define PG_LCD_HD44780_DATA_0_TRIS T_D7
#define PG_LCD_HD44780_DATA_1_TRIS T_D6
#define PG_LCD_HD44780_DATA_2_TRIS T_D5
#define PG_LCD_HD44780_DATA_3_TRIS T_D4
#define PG_LCD_HD44780_BL_TRIS T_D3

These define concern all tris pins that were configured previously.
The name matching ensures easy association.
If a Tris pin is not used, you must set this field to PG_MISSING.



#define PG_LCD_HD44780_DATA_0_PORT P_D7
#define PG_LCD_HD44780_DATA_1_PORT P_D6
#define PG_LCD_HD44780_DATA_2_PORT P_D5
#define PG_LCD_HD44780_DATA_3_PORT P_D4

When using the BUSY-FLAG, it is necessary to be able to read from the display.
So, it is important to specify its corresponding port pin previously declared.
The name matching ensures easy association.



After it has been enabled and configured the module you can refer to this set of functions to use it.

This module can use the Error Handling Module : Error manager
In the TEST section of each function is specified which values ​​are set and in which cases.
Please refer to the specific documentation of the file header: pgim_adc.h

Private functions

With "private" we mean a function that should not be used by the user in its code.
In this documentation the private functions are marked as Deprecate.
PicGIM internally uses these functions to properly manage the module.
Of course you are always free to use them if you think they are useful.

Public functions

Here a link to the file : pgim_lcd_hd44780.h
This is not a file defined as public and therefore would not be edited.
We suggest that you edit this file only if necessary and only if you know what you are doing.