Alphanumeric (Hitachi HD44780) LCD Print Declares.
Declare LCD_DTPin Port.Pin Assigns the Port and Pins that the LCD's DT lines will attach to.
The LCD may be connected to the microcontroller using either a 4-bit bus or an 8-bit bus. If an 8-bit bus is used, all 8 bits must be on one port. If a 4-bit bus is used, it must be connected to either the bottom 4 or top 4 bits of one port. For example: -
Declare LCD_DTPin PORTB.4 ' Use a 4-line interface on low byte of PORTB
Declare LCD_DTPin PORTB.0 ' Use an 8-line interface on low byte of PORTB
Declare LCD_DTPin PORTB.12' Use a 4-line interface on high byte of PORTB
Declare LCD_DTPin PORTB.8 ' Use an 8-line interface on high byte of PORTB
In the above examples, PORTB is only a personal preference. The LCD's DT lines can be attached to any valid port on the microcontroller.
There is no default setting for this Declare and it must be used within the BASIC program.
Declare LCD_DataX_Pin Port.Pin Assigns the individual Ports and Pins that the HD4470 LCD’s DT lines will attach to.
Unlike the above LCD_DTPin declares, the LCD’s data pins can also be attached to any separate port and pin. For example:-
Declare LCD_Data0_Pin PORTA.0 ' Connect PORTA.0 to the LCD’s D0 line
Declare LCD_Data1_Pin PORTA.2 ' Connect PORTA.2 to the LCD’s D1 line
Declare LCD_Data2_Pin PORTA.4 ' Connect PORTA.4 to the LCD’s D2 line
Declare LCD_Data3_Pin PORTB.0 ' Connect PORTB.0 to the LCD’s D3 line
Declare LCD_Data4_Pin PORTB.1 ' Connect PORTB.1 to the LCD’s D4 line
Declare LCD_Data5_Pin PORTB.5 ' Connect PORTB.5 to the LCD’s D5 line
Declare LCD_Data6_Pin PORTC.0 ' Connect PORTC.0 to the LCD’s D6 line
Declare LCD_Data7_Pin PORTC.1 ' Connect PORTC.1 to the LCD’s D7 line
There are no default settings for these Declares and they must be used within the BASIC program if required.
Declare LCD_ENPin Port.Pin Assigns the Port and Pin that the LCD's EN line will attach to. This also assigns the graphic LCD's EN pin, however, the default value remains the same as for the alphanumeric type, so this will require changing.
There is no default setting for this Declare and it must be used within the BASIC program.
Declare LCD_RSPin Port.Pin Assigns the Port and Pins that the LCD's RS line will attach to. This also assigns the graphic LCD's RS pin, however, the default value remains the same as for the alphanumeric type, so this will require changing.
There is no default setting for this Declare and it must be used within the BASIC program.
Declare LCD_Interface 4 or 8 Inform the compiler as to whether a 4-line or 8-line interface is required by the LCD.
There is no default setting for this Declare and it must be used within the BASIC program.
Declare LCD_Lines 1, 2, or 4 Inform the compiler as to how many lines the LCD has.
Alphanumeric HD4470 LCD's come in a range of sizes, the most popular being the 2 line by 16 character types. However, there are 4-line types as well. Simply place the number of lines that the particular LCD has into the declare.
There is no default setting for this Declare and it must be used within the BASIC program.
Declare LCD_CommandUS 1 to 65535 Time to wait (in microseconds) between commands sent to the LCD.
If the Declare is not used in the program, then the default delay is 2000us (2ms).
Declare LCD_DataUs 1 to 65535 Time to wait (in microseconds) between data sent to the LCD.
If the Declare is not used in the program, then the default delay is 50us.

