FANDOM


LCD Commands Intro Edit

Important: The LCD commands in this section are specifically designed for use with the Hitachi 44780 controller (or equivalent). If you use an LCD module with a different controller, these commands probably will not work. In such cases, you can write your own subroutines to initialize your LCD and send output to it.

A detailed explanation of the Hitachi LCD controller is beyond the scope of this manual. The 44780 controller is use for text-mode displays, these commands don't apply to graphical LCD displays.


Conventions Used in this Chapter Edit

{ ... } represent optional components in a command. The { } are not to be included.
[ ... ] used for lists - the [ ] are required.
( ... ) used for some arguments. The ( ) are required.

Important: Several of the commands described in this chapter specifically address hardware features of the microcontroller chip. Descriptions of these hardware features are beyond the scope of this manual.

Please refer to the H8/3664F or H8/3687F hardware manual, available at http://www.renesas.com for further details.


LCDINIT Edit

Initializes an LCD display. This command must be used before using the LCDREAD or LCDWRITE commands.

Syntax

lcdinit regsel\clk\D7\D6\D5\D4\RdWrPin
regsel is a constant or variable specifying the Atom Pro I/O pin connected to the LCD's R/S line.
clk is a constant or variable specifying the Atom Pro I/O pin connected to the LCD's E (Enable) line.
D7 - D4 are constants or variables that specify the Atom Pro pins to use for the LCD data lines.
RdWrPin is an optional constant or variable specifying the Atom Pro I/O pin connected to the R/W (read/write) line of the LCD.

Examples

If your LCD display uses the following connections:

LCD Atom Pro
R/S P4
E P5
R/W P6
I/O port (4-7) P0, P1, P2, P3

The command:

lcdinit p4\p5\p3\p2\p1\p0\p6

will initialize the display for future LCDREAD and LCDWRITE commands.


LCDREAD Edit

Reads the RAM on an LCD module using the Hitachi 44780 controller or equivalent.

Important: You must initialize the display with LCDINIT before using this command.

Syntax

ldcread regsel\clk\D7\D6\D5\D4,RdWrPin, address, [(modifiers} var]
regsel is a constant or variable specifying the Atom Pro I/O pin connected to the LCD's R/S line.
clk is a constant or variable specifying the Atom Pro I/O pin connected to the LCD's E (Enable) line.
D7 - D4 are constants or variables specifying the Atom Pro I/O pins connected to the LCD’s data lines (see lcdinit).
RdWrPin is a constant or variable specifying the Atom Pro I/O pin connected to the R/W (read/write) line of the LCD.
address is a constant or variable that specifies the RAM location to be read, according to this list:
address contents
1 - 127 current character in display RAM
128 and above character RAM values
modifiers are command modifiers (see Chapter 8 - Command Modifiers) used to modify var.
var is a byte variable (or a comma - separated list of variables) where the returned value will be stored.

Examples

If your LCD display uses the same connections as shown under LCDINIT, the program segment:

character var byte
lcdread p4\p5\p3\p2\p1\p0\p6,15,[character]

will read the character stored at RAM address 15 and save it in character.


LCDWRITE Edit

Sends text output to an LCD display module that uses the Hitachi 44780 controller or equivalent.

Important: You must initialize the display with LCDINIT before using this command.

Syntax

lcdwrite regsel\clk\D7\D6\D5\D4,{RdWrPin,} [(modifiers} expr]
regsel is a constant or variable specifying the Atom Pro I/O pin connected to the LCD's R/S line.
clk is a constant or variable specifying the Atom Pro I/O pin connected to the LCD's E (Enable) line.
D7 - D4 are constants or variables specifying the Atom Pro I/O pins connected to the LCD’s data lines (see lcdinit).
RdWrPin is an optional constant or variable specifying the Atom Pro I/O pin connected to the R/W (read/write) line of the LCD.
modifiers are command modifiers (see Chapter 8 - Command Modifiers) used to modify expr.
expr is a variable, constant or expression that generates the data to be written. Data may be text characters or commands. A list of commands is given under Notes, below.

Notes

Here is a list of commands that can be used with the LCDWRITE command. Multiple commands may be included inside [ ... ] if they are comma separated.

Command Value Function
initlcd1 $133 initialize LCD display
initlcd2 $132 initialize LCD display
Clear $101 clear display
Home $102 return to home position
Inccur $104 auto increment cursor (default)
Incscr $105 auto increment display
Deccur $106 auto decrement cursor
Decscr $107 auto decrement display
Off $108 display, cursor and blink OFF
Scr $10C display ON, cursor and blink OFF
Scrblk $10D display and blink ON, cursor OFF
Scrcur $10E display and cursor ON, blink OFF
Scrcurblk $10F display, cursor and blink ON
Curleft $110 move cursor left
Currright $114 move cursor right
Oneline $120 set display for 1 line LCDs
Twoline $128 set display for 2 line LCDs
cgram | address $140 set CGRAM address for R/W
scrram | address $180 set display RAM address for R/W

Examples

If your LCD display uses the same connections as shown under LCDINIT, the program segment:

printch var byte
printch = $41 ; ASCII value for "A"
lcdwrite p4\p5\p3\p2\p1\p0,p6, [clear,home,printch]

will clear the screen, move to the home position, and print an A on the display.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.