PreviousNext
Help > RITTLE FOR THE PIC32MZ MICROCONTROLLER > Specific Peripheral Modules > LCD4
LCD4

Format:                                                                        

LCD4 (text_cmd [, any_param, …] );

Enable support of popular LCD modules with 4-bit HD44780-compatible interface. Since this interface is a de-facto standard among this type of display, the function should be able to cover the vast majority of such modules, currently on the market.

This type of displays are text-only and don’t support colours. They also have fixed character table in ROM and no possibility for different screen orientations. However, their simple interface, good readability, and durable design make them a very popular choice in industrial applications where only limited user interface is required.

 

--------------\                /----------------------\
          P56 |--- RS ---------| RS (D/C in some)     |
          P57 |--- EN ---------| E                    |
PIC32MZ   P58 |--- D4 ---------| DB4                  |
          P61 |--- D5 ---------| DB5                  |
          P62 |--- D6 ---------| DB6                  |
          P63 |--- D7 ---------| DB7                  |
--------------/                |           LCD Module |
                         GND|--| DB0                  |
                         GND|--| DB1                  |
                         GND|--| DB2                  |
                         GND|--| DB3                  |
                         GND|--| R/W                  |
                               \----------------------/

 

All display sizes from 8x1 (8 characters per line, 1 line) to 40x4 (40 characters per line, 4 lines) are supported.

Rittle uses six data lines for the interface as shown in the connection diagram. LCD’s data lines DB0-DB3 and signal R/W are not used and should be permanently connected to ground.

COMMANDS:

1.     Initialisation

 

Before any work with the LCD4 module, the interface needs to be initialised.

LCD4   “initL”,   int_columns,   int_rows

Initialise the LCD4 interface with specified number of columns (8 – 40) and rows (1 – 4) for the display.

The “initL” command initialises the display as “locked” – all characters printed at cursor position outside of the screen boundaries, will be ignored.

 

LCD4   “initS”,   int_columns,   int_rows

Initialise the LCD4 interface with specified number of columns (8 – 40) and rows (1 – 4) for the display.

The “initS” command initialises the display as “scrolling” – upon reaching the bottom of the screen, any character printed beyond the screen boundaries will cause a “scroll up” for all information on the screen.

 

Screen initialisation can be performed as many times as needed, and if necessary the screen can be dynamically re-initialised from “locked” to “scrolling” and vice versa.

 

2.     LCD4   “clear”

Clear the screen and set cursor position at the top left corner at coordinates 0, 0;

3.     LCD4   “scroll:U”

LCD4   “scroll:D”

LCD4   “scroll:L”

LCD4   “scroll:R”

Perform screen scroll – up, down, left, or right, respectively.

 

4.     LCD4   “goto”,   int_x,   int_y

Set screen coordinate (x, y) as the next location for output. All screen coordinates start from 0.

5.     LCD4   “print”,  any_data, …

Print information on the screen. One or more parameters of all ordinal types, can follow.

Depending on the type of initialisation, printing will perform scroll up of the display, or ignore characters printed outside of the screen boundaries.

6.     LCD4   “char”,   int_code,   big_bitmask

Define specific character. HD44780-compatible controllers allow up to eight custom-defined characters with codes from 0 through 7.

The bitmask parameter consists of five bytes (all characters occupy 5x8 matrix) that define the character’s five columns from left to right.