Matrix Orbital LCD-VFD User Manual

Page 1
LCD4041
Technical Manual
Revision: 1.0
Page 2
Contents
Contents ii
1 Introduction 1
1.1 What to Expect From the LCD4041 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 What Not to Expect From the LCD4041 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.4 Trying Out the LCD4041 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Manual Over-ride . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Connections 4
2.1 Connector Pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.1 Power and I2C Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2 Five Volt Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.3 Wide Voltage Range Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.4 Power through the DB-9 Connector . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.5 RS-232 Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.6 I2C Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.7 ACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 General Purpose Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Displaying Text 10
3.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 The built in Character Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Writing Text to the Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.1 Auto scroll on (254 81) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.2 Auto scroll off (254 82) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.3 Set cursor position (254 71 [column] [row]) . . . . . . . . . . . . . . . . . . . . . . 12
3.4.4 Send cursor home (254 72) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.5 Turn on underline cursor (254 74) . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.6 Turn off underline cursor (254 75) . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.7 Turn on block (blinking) cursor (254 83) . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.8 Turn off block (blinking) cursor (254 84) . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.9 Cursor left (254 76) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.4.10 Cursor right (254 77) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Bar Graphs and Special Characters 13
4.1 Command List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1.1 Initialize wide vertical bar graph (254 118) . . . . . . . . . . . . . . . . . . . . . . 13
4.1.2 Initialize narrow vertical bar graph (154 115) . . . . . . . . . . . . . . . . . . . . . 14
4.1.3 Draw vertical bar graph (254 61 [column] [height]) . . . . . . . . . . . . . . . . . . 14
4.1.4 Initialize horizontal bar graph (254 104) . . . . . . . . . . . . . . . . . . . . . . . . 14
4.1.5 Draw horizontal bar graph (254 124 [column] [row] [dir] [length]) . . . . . . . . . . 14
4.1.6 Define custom character (254 78 [c] [8 bytes]) . . . . . . . . . . . . . . . . . . . . 14
Matrix Orbital LCD4041 ii
Page 3
4.1.7 Initialize large digits (254 110) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.1.8 Place large digit (254 35 [col] [digit]) . . . . . . . . . . . . . . . . . . . . . . . . . 16
5 Miscellaneous Commands 16
5.1 Command List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1.1 Clear display (254 88) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1.2 Set contrast (254 80 [contrast]) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1.3 Backlight on (254 66 [minutes]) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1.4 Backlight off (254 70) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.5 Load startup screen (254 64 [32 characters]) . . . . . . . . . . . . . . . . . . . . . . 17
5.1.6 General purpose output off (254 86) . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.7 General purpose output on (254 87) . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.8 Set I2C address (254 51 [address]) . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1.9 Read module type (254 55) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.1.10 Set RS-232 port speed (254 57 [speed]) . . . . . . . . . . . . . . . . . . . . . . . . 18
5.1.11 Set Serial Number (254 52 [byte1] [byte2] . . . . . . . . . . . . . . . . . . . . . . . 18
5.1.12 Read Serial Number (254 53) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.1.13 Read Version Number (254 54) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2 Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2.1 Enter Flow Control Mode (254 58 [full][empty]) . . . . . . . . . . . . . . . . . . . 19
5.2.2 Exit Flow Control Mode (254 59) . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Appendix: Command Summary 20
6.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2 Issuing Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.3 On Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.3.1 ASCII Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.4 Text Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.5 Bar Graphs and Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.6 Miscellaneous Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7 Appendix: Specifications and Options 26
7.1 Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
7.2 Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8 Appendix: Glossary 29
Matrix Orbital LCD4041 iii
Page 4
1 Introduction
The LCD4041 comes equipped with the following features;
40 column by 4 line text display
Built in font with provision for up to 8 user defined characters
Speeds from 1200 bps to a lighting fast 19.2 Kbps over RS-232
Communication over I2C or RS-232 (with software controlled speed)
Use of up to 127 modules on the same 2-wire I2C interface
Fully buffered so that no delays in transmission are ever necessary
Ability to add customized splash / start up screen
Software controlled contrast
Backlight with configurable time-out setting up to 180 minutes
One general purpose output for a variety of applications
Horizontal or vertical bar graphs
Variable power options, +5V or +7V to +35V
Extended temperature option
1.1 What to Expect From the LCD4041
The LCD4041 is designed as the display unit for an associated controller. The controller may be anything from a single board, special purpose micro-controller to a PC, depending on the application. This controller is responsible for what is displayed on the screen of the display. The display provides a simple command structure to allow text and bar graphs to be displayed on the screen. Text fonts are built in, and use standard ASCII mapping. Provision is made for up to 8 user defined characters. The screen is backlit for low-light situations. Backlighting may be turned on or off under programcontrol. Contrast is adjustable to compensate for differing lighting conditions and viewing angles. A general purpose output allows the controller to switch an electro-mechanical device by issuing commands to the display unit. These can be used for controlling LEDs, relays, etc.
1.2 What Not to Expect From the LCD4041
The display does not include bitmap graphics capability, except that permitted by defining special char­acters. The display does not have a keypad interface.
1.3 Setup for Testing
Before setting up the application the user may want to try out the display. This is easily done with a PC. If not equipped with a dual bay PC mounting kit, the following will be required;
A 4-pin power connector of the type used to connect 3.5" floppy drive. Take care not to connect the display to an unmodified spare power connector in a PC
A 5V power supply
A PC with a spare RS-232 port (COM1 or COM2)
Matrix Orbital LCD4041 1
Page 5
A 9 or 25 pin RS-232 serial cable. If using a 25 conductor cable, a 9 to 25 pin adapter will be required
Figure 1: Connections for Testing
1. Refer to the Figure above for the following steps.
2. Wire the connector to the power supply. On most connectors the RED lead will go to +5V and the BLACK lead to GND.
NOTE The Manufacturer’s Warranty becomes void if the unit is subjected to over-voltage or reversed polarity.
3. Connect the display to the PC using the serial cable and adapter if required. Make sure the RS-232 cable includes the required ground lead. There must be no voltage differential between the RS-232 ground and the power supply ground.
4. Connect the power connector, making sure that the +5V goes to V+. Turn on the power: the display backlight should come on.
1.4 Trying Out the LCD4041
The unit should be connected to power and the PC and backlight should be on.
To experiment with typing text, run a PC terminal program such as Hyperterm. Make sure it’s configured
to use the correct port. Set the baud rate to 19,200.
If characters are typed on the keyboard, they should now appear on the display screen. Text will wrap around to the next line when the end of a line has been reached. A few common ASCII control characters work as follows;
Matrix Orbital LCD4041 2
Page 6
Table 1: Common ASCII Control Characters
Character Hex Value Function
CR 0x0D Moves cursor to the beginning of the
current line
LF 0x0A Moves cursor to the beginning of the
next (or previous) line
FF 0x0C Clears the display and puts the cur-
sor at the top left
BS 0x08 Moves cursor one position to the left
and clears that position
NOTE These command characters are not guaranteed to work on other Matrix Orbital display modules.
To exercise some of the other features of the display, a program (in any convenient language such as Basic or C) will need to be written in order to issue the required command strings. Most terminal programs are unable to issue the 0xFE character needed as a command prefix.
1.5 Manual Over-ride
Manual over-ride should only be required in one instance. If for some reason the module is set at a baud rate which cannot be produced by the host system and all communication to the display is lost, then the user should follow this simple procedure;
1. Turn off the display
2. Put a jumper on pins 3 and 4 of the keypad connector (R3 and C1)
3. Power up the display. The baud rate is now set to 19,200
4. Remove the jumper and change the RS-232 port settings to the desired baud rate
5. Turn off the display
6. Power up the display
Refer to the "Set RS-232 port speed" command for acceptable baud rates.
Figure 2: Manual Over-ride
Matrix Orbital LCD4041 3
Page 7
2 Connections
2.1 Connector Pinout
Refer to the diagram below for this chapter.
Figure 3: Electrical Connections
The display has three connectors;
Table 2: Connectors & Functions
Connector Function
2 pin header General purpose output
4 Pin Power (Vdc) and I2C communications
DB-9F RS-232 / Power
2.1.1 Power and I2C Connections
Power is applied via pins 1 and 4 as shown in the Figure above. Power requirement is +5 VDC ±0.25V. Power may also be supplied via the RS-232 connector as described in the next section.
WARNINGS
Do not apply any power with reversed polarization.
Do not apply any voltage other than the specified voltage.
Do not use any cables other than the cables supplied by Matrix
Orbital, unless aware of the modifications required.
Do not apply power to the DB-9 connector AND the 4 pin power connector.
Do not apply more than +5Vdc to pin #9 of the DB-9 connector.
Matrix Orbital LCD4041 4
Page 8
Connector pinout is as follows;
Pin 4 Ground Pin 3 SDA (I2C data) Pin 2 SCL (I2C clock) Pin 1 +5.0 VDC (+7 to +15 VDC with wide voltage option)
2.1.2 Five Volt Modules
Figure 4: Power Connector
Table 3: Connector Pinout
If the display is used in a PC it becomes tempting to plug a spare power connector into the unit. Don’t do this! Wiring for the PC power connector and that required for the display are different as shown in the Figure below.
Figure 5: Wiring for 5V Modules
Matrix Orbital can supply an adapter cable designed to use with the display when it’s installed in a PC. The cable is wired as shown in the Figure below.
NOTE This cable does not provide connections for I2C.
Matrix Orbital LCD4041 5
Page 9
Figure 6: Five Volt Power Cable
2.1.3 Wide Voltage Range Modules
NOTE This cable should not be used with a display module which has the "Wide voltage range" option (option V). Use of the 12 volt power cable with 5 volt modules will damage the module.
The 12 volt power cable is designed for use with wide voltage range display modules mounted in a PC. Wiring required for the 12 volt power connector is shown in the Figure below.
Figure 7: Wiring for 12 Volt Modules
Matrix Orbital can supply an adapter cable designed to use with the display module when it’s installed in a PC. The cable is wired as shown in the Figure below.
Figure 8: Twelve Volt Power Cable
Matrix Orbital LCD4041 6
Page 10
2.1.4 Power through the DB-9 Connector
The display can be powered by pin 9 on the DB-9 connector. If power is applied here, power cannot be applied to the other power connector. The input voltage for pin 9 can only be +5Vdc, even if the unit is wide voltage.
WARNING Failure to follow these instructions will destroy the unit.
Solder a jumper as shown in the below image to use the DB-9 connector for power .
Figure 9: DB-9 Connector
2.1.5 RS-232 Communications
A standard DB-9F is provided for RS-232 communications. Power may also be supplied via this con­nector if desired.
Figure 10: RS-232 and Power Connector
Matrix Orbital LCD4041 7
Page 11
The RS-232 connector on the PC cable is wired so that a standard ’straight through’ 9 pin D-sub cable may be used to connect the modules to a standard serial port such as COM ports on PCs. Note that this device complies with the EIA232 standard in that it uses signal levels from +/-12V to +/- 12V. To use standard RS-232 no modifications are required. The display does not allow the use of TTL.
Table 4: RS-232 Pinout
Pin Number Direction Description LCD Host
2 From LCD module Data out Tx Rx 3 To LCD module Data in Rx Tx 4 - Ground gnd gnd
2.1.6 I2C Communications
The display I2C communications runs at 100Kbps and supports up to 127 units on a single communica­tions line. The I2C data line operates on 5 volt CMOS levels
Figure 11: Power Connector
Table 5: Connector Pinout
Pin 4 Ground Pin 3 SDA (I2C data) Pin 2 SCL (I2C clock) Pin 1 Vdc
2.1.7 ACK
The idea of ACK is to indicate when the data has been received correctly. ACK does not indicate data incorrectly received. ACK simply fails to indicate when data is correctly received. Clearly, this is of limited usefulness and even less so with Matrix Orbital modules. Matrix orbital modules are not capable of failing to acknowledge an incorrectly received byte in response to that bytes transition. They are only capable of failing to acknowledge the bytes following the byte, which was not received. To fully understand the reasons
Matrix Orbital LCD4041 8
Page 12
for this one needs to understand something about how a Matrix Orbital module processes data. Basically the reason why a Matrix Orbital module might fail to receive a byte correctly is that it was unable to process the byte previous before the failed byte was transmitted. Because the module cannot possibly know that it would be unable to store the byte before the next byte was received it cannot know to not ACK. The reason for this situation in deference to situations one might be familiar with (i.e., memory chips, etc) is that the Matrix Orbital module employs a micro-processor to perform these data storage functions. A memory chip takes care of these things entirely with in hardware subsystems that operate at the same speed as the transmission themselves.
The display uses a standard Phillips 7bit address as defined by Phillips. However,Matrix Orbital specifies I2C address in 8bits. The 8th bit, least significant bit, LSB or Low Order Bit of the 8bit address is read / write bit. If we take a standard Phillips 7bit address of 45hex this would be in binary 1000101. This is 7bits. Matrix Orbital would describe the Phillips I2C address of 45hex as 8Ahex. The read address would be 8Bhex.
For more information on Phillips I2C please visit;
 !"#%$ !&%'()*
2.2 General Purpose Output
The display has one general purpose output. This is provided to control relays or other electronic devices, and allows external devices to be turned on or off using the PC or controller and software commands. The + terminal is connected to the module positive supply, the - terminal is connected through a 240ohm current limiting resistor and the electronic switch to ground.
Figure 12: General Purpose Output
Maximum allowable current is 20mA, which is enforced by the current limiting resistor. If the device being switched has a resistance of 240ohms or more the corresponding resistor may be shorted.
NOTE The GPOs do not have any over current or over / under voltage protection so care must be taken when using them. For instance if the external device is a relay it must be fully clamped (using a diode and capacitor) to absorb any generated back electro-motive force (EMF).
Matrix Orbital LCD4041 9
Page 13
Figure 13: Clamping a Relay
3 Displaying Text
This chapter describes the various text display commands in detail. Before issuing commands to the LCD4041 please read sections 6.2 and 6.3.
3.1 General
Text is displayed on the display using the built in 5x7 dot matrix font, in addition to up to 8 user defined characters.
3.2 The built in Character Font
The display includes a built in 5x7 dot matrix font with the full range of ASCII characters plus a variety of extended characters, as shown in the Figure below.
Matrix Orbital LCD4041 10
Page 14
Figure 14: Character Set
In addition to the built in characters, users may define up to 8 special characters which once defined, occupy positions 0x00 to 0x07 in the above chart. The display does not have provision to download other fonts.
3.3 Writing Text to the Display
When the display receives a character, it displays that character at the position currently defined. The next character sent to the module then advances to the following position on the display. Characters are drawn using the built in font, and only characters defined in the font are actually displayed. Characters that are not defined by the built in font print as a space (i.e., the cursor is advanced for the next character).
The position where text is to be inserted is a character location stored in the display’s volatile memory and maintained internally by the display’s firmware. This position is manipulated by the commands shown in the following section.
Matrix Orbital LCD4041 11
Page 15
3.4 Text Commands
In this section commands are identified by their names and decimal values. Hex and ASCII equivalents are given in the summary.
3.4.1 Auto scroll on (254 81)
When auto scrolling is on, it causes the display to shift the entire display’s contents up to make room for a new line of text when the text reaches the scroll position (the bottom right character position).
3.4.2 Auto scroll off (254 82)
When auto scrolling is disabled, text will wrap to the top left corner of the display area. Existing text in the display area is not erased before new text is placed. A series of ’spaces’ followed by a “Cursor home” command may be used to erase the top line of text.
3.4.3 Set cursor position (254 71 [column] [row])
This command sets the cursorposition (text insertion point) to the [column] and [row] specified. Columns have values from 1 to 20 (0x01 to 0x14) and rows have values of 1 and 2 (0x01 and 0x02).
3.4.4 Send cursor home (254 72)
This command moves the cursor position (text insertion point) to the top left of the display area.
3.4.5 Turn on underline cursor (254 74)
Turns on the underline cursor. The cursor shows the current text insertion point. Both underline and blinking cursors may be turned on or off independently. The cursor is off by default.
3.4.6 Turn off underline cursor (254 75)
Turns off the underline cursor. Does not affect the blinking block cursor.
3.4.7 Turn on block (blinking) cursor (254 83)
Turns on the blinking block cursor. The cursor shows the current text insertion point. Both blinking and underline cursors may be turned on or off independently. The cursor is off by default.
Matrix Orbital LCD4041 12
Page 16
3.4.8 Turn off block (blinking) cursor (254 84)
Turns off the blinking block cursor. Does not affect the underline cursor.
3.4.9 Cursor left (254 76)
Moves the cursor one position to the left but does not erase any character that may be in that position. Please note that this command moves the text insertion point even if the cursor is turned off.
NOTE A ’destructive backspace’ which erases the character to the left of the original position, may be done by issuing the following sequence: cursor left, space, cursor left.
3.4.10 Cursor right (254 77)
Moves the cursor one position to the right but does not erase any character that may be in that position. Note that this command moves the text insertion point even if the cursor is turned off.
4 Bar Graphs and Special Characters
The display includes the ability to draw bar graphs (either horizontal or vertical) and allows users to define up to eight special characters. Eight characters (ASCII values 0x00 to 0x07) are set aside for use with bar graphs, user defined characters, and big numbers. Since the same 8 characters are used for each function, the functions may not be used simultaneously. The characters may be defined or redefined at any time by issuing the commands shown in this section. Once defined, they may be used either by means of the bar graph commands, or by simply issuing one of the ASCII values 0x00 to 0x07 (which is not prefixed by the command byte, 254).
4.1 Command List
4.1.1 Initialize wide vertical bar graph (254 118)
This command defines the 8 special / user characters to be blocks suitable for use in drawing wide (5 pixel) vertical bar graphs. Any previously existing definitions will be lost. Once this command has been issued, any number of vertical bar graphs may be drawn unless the characters are redefined by another command.
Matrix Orbital LCD4041 13
Page 17
4.1.2 Initialize narrow vertical bar graph (154 115)
This command defines the 8 special / user characters to be blocks suitable for use in drawing narrow (2 pixel) vertical bar graphs. Any previously existing definitions will be lost. Once this command has been issued, any number of vertical bar graphs may be drawn unless the characters are redefined by another command.
4.1.3 Draw vertical bar graph (254 61 [column] [height])
Draws a vertical bar graph in [column] having a height of [height] pixels. The height may range from 0 to 20 (0x00 to 0x14) pixels. The necessary characters must first be initialized by either of the commands shown in section 5.1.1 or 5.1.2, which will determine the width of the graph drawn. Graph may be erased by drawing a bar graph of height = 0 in the same column.
4.1.4 Initialize horizontal bar graph (254 104)
This command defines the 8 special/user characters to be blocks suitable for use in drawing horizontal bar graphs. Any previously existing definitions will be lost. Once this command has been issued, any number of horizontal bar graphs may be drawn unless the characters are redefined by another command.
4.1.5 Draw horizontal bar graph (254 124 [column] [row] [dir] [length])
Draws a horizontal bar graph in [row] starting at [column] with a length of [length] pixels. [row] may have a value of 0x01 or 0x02, column may range from 0x01 to 0x14 and length may be from 0x00 to 0x64 (0 to 100) if the graph can extend the full width of the screen. Each column is 5 pixels wide (spaces between the columns don’t count). [dir] specifies the direction: 0x00 goes from left to right, 0x01 goes from right to left.
4.1.6 Define custom character (254 78 [c] [8 bytes])
The display allows up to 8 user defined (custom) characters. These characters occupy the first 8 (0x00 to 0x07) places in the character set.
Custom characters occupy a 5x8 pixel matrix. Built in characters are 5x7: the bottom row of pixels is normally reserved for the underline cursor. The underline cursor should be turned off if the bottom row of pixels forms part of a custom character.
The characters are defined by issuing the command 254 78 [c] followed by 8 bytes to define the character. [c] is the character number (0x00 to 0x07). The 8 bytes are mapped as shown below;
Matrix Orbital LCD4041 14
Page 18
Table 6: 8 Byte Map
MSB LSB
* * * 1 2 3 4 5 Data Byte 1 * * * 6 7 8 9 10 Data Byte 2 * * * 11 12 13 14 15 Data Byte 3 * * * 16 17 18 19 20 Data Byte 4 * * * 21 22 23 24 25 Data Byte 5 * * * 26 27 28 29 30 Data Byte 6 * * * 31 32 33 34 35 Data Byte 7 * * * 36 37 38 39 40 Data Byte 8
A "1" bit indicates an on (black) pixel, a "0" bit indicates an off (clear) pixel.
Once defined, a character is displayed simply by issuing a value (0x00 to 0x07) corresponding to the character number. The character will be laid out as follows;
Table 7: Character Values
1 2 3 4 5
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Cursor Line
NOTE Custom characters will be erased if any of the "Initialize bar graph" commands are issued.
4.1.7 Initialize large digits (254 110)
This command defines the 8 special / user characters to be blocks suitable for use in drawing large digits. Any previously existing definitions will be lost. Once this command has been issued, any number of large characters may be placed until the characters are redefined by another command.
Matrix Orbital LCD4041 15
Page 19
4.1.8 Place large digit (254 35 [col] [digit])
This command allows the large digits to be drawn on the display screen. Numbers of almost full display height may be placed along side regular text on four row displays. The column number has a maximum value which is less than the display width because the digits are all three columns wide. Before using this command the Initialize Large Digits command must be issued to define the blocks necessary to make up the digits. If regular text and large digits are mixed on one screen, the user should always set the display cursor position before placing regular text because the creation of a large digit will leave the cursor position to the bottom right of the large digit and not at the last regular text write position.
[col] can have values from 0x01 to 0x12 (1 to 18).
[digit] has values from 0x00 to 0x09 (0 to 9).
5 Miscellaneous Commands
The commands listed in this chapter don’t readily fit in any of the other categories, or are used in more than one category.
5.1 Command List
5.1.1 Clear display (254 88)
This command clears the display and resets the text insertion point to the top left of the screen.
5.1.2 Set contrast (254 80 [contrast])
This command sets the display’s contrast to [contrast], where [contrast] is a value between 0x00 and 0xFF (between 0 and 255). Lower values cause ’on’ elements in the display area to appear lighter, while higher values cause ’on’ elements to appear darker.
Lighting conditions will affect the actual value used for optimal viewing. Individual display modules will also differ slightly from each other in appearance. In addition, values for optimal viewing while the display backlight is on may differ from values used when backlight is off.
5.1.3 Backlight on (254 66 [minutes])
This command turns on the backlight for a time of [minutes] minutes. If [minutes] is zero (0), the backlight will remain on indefinitely.
NOTE The factory default for backlight is on.
Matrix Orbital LCD4041 16
Page 20
5.1.4 Backlight off (254 70)
This command turns the backlight of the display off.
5.1.5 Load startup screen (254 64 [32 characters])
This command sets and memorizes the startup screen that will appear each time the display is turned on. By default the screen shows;
Table 8: Default Screen
Matrix Orbital
LCD4041
The 160 characters define the four 40 character rows of the screen. They may be any characters from the Character Set.
Table 9: Default Screen
Character 1 Character 40 Character 41 Character 80 Character 81 Character 121 Character 121 Character 160
5.1.6 General purpose output off (254 86)
This command turns OFF the general purpose output.
5.1.7 General purpose output on (254 87)
This command turns ON the general purpose output.
5.1.8 Set I2C address (254 51 [address])
This command sets the I2C write address of the module. This value must be an even number and the read address is one higher. For example if the I2C write address is set to 0x50, then the read address is 0x51.
Matrix Orbital LCD4041 17
Page 21
The change in address is immediate. This address is 0x50 by default, and is reset temporarily back to that value when the ’manual over-ride’ jumper is used on power up.
5.1.9 Read module type (254 55)
This command will return, over the RS-232 interface, the model type value of the module. This command will return a 1-byte hex value. Values for various modules at the time of this publication are as follows;
Table 10: Module Values
LCD0821 - 0x01 LCD2021 - 0x03 LCD2041 - 0x05
LCD4021 - 0x06 LCD4041 - 0x07 LK202-25 - 0x08 LK204-25 - 0x09 LK404-55 - 0x0A VFD2021 - 0x0B VFD2041 - 0x0C VFD4021 - 0x0D VK202-25 - 0x0E
VK204-25 - 0x0F GLC12232 - 0x10 GLC24064 - 0x13
GLK24064-25 - 0x15 GLK12232-25 - 0x22 LK404-AT - 0x31
LK402-12 - 0x33 LK162-12- 0x34 LK204-25PC - 0x35
5.1.10 Set RS-232 port speed (254 57 [speed])
This command sets the RS-232 port to the specified [speed]. The change takes place immediately. [speed] is a single byte specifying the desired port speed. Valid speeds are shown in the table below. The speed can be manually reset to 19,200 baud in the event of an error during transmission (including transmit­ting a value not listed below) by setting the ’manual over-ride’ jumper on the module during power up. This command is ignored until this jumper is removed again.
Table 11: Speed Settings
Speed Value Speed
FF Hex 1200 Baud
81 Hex 2400 Baud 20 Hex 9600 Baud 0F Hex 19 200 Baud
5.1.11 Set Serial Number (254 52 [byte1] [byte2]
Modules may be delivered with the serial number blank. In this case the user may set the desired 2 byte serial number using this one time only command.
Upon the execution of this command, the module will echo these two bytes back over the RS-232 inter­face. The serial number may be set only once. Any future attempt to execute this command will result in no
Matrix Orbital LCD4041 18
Page 22
change and the module will return to the originally set serial number.
5.1.12 Read Serial Number (254 53)
This command will return, over the RS-232 interface, the two-byte serial number of the module as it was previously stored.
5.1.13 Read Version Number (254 54)
This command will return the firmware version number of the display. This command returns a 1-byte hex value.
5.2 Flow Control
The display has built in flow control which may be useful when long strings of text are downloaded to the display. Flow control is enabled or disabled by two commands. If flow control is enabled, the display will return an "almost full" message (0xFE) to the controller when its internal buffer fills to a defined level, and an "almost empty" message (0xFF) when the buffer contents drop to a defined level.
5.2.1 Enter Flow Control Mode (254 58 [full][empty])
NOTE Flow control applies only to the RS-232 interface. It is not available for I2C.
This command enables flow control. When the buffer fills so that only [full] bytes are available the display will return an "almost full" message (0xFE) to the controller. When the buffer empties so that only [empty] bytes remain the display will return an "almost empty" message (0xFF) to the controller.
The display will return the "almost full" message for every byte sent to the display until the used buffer space once more drops below the [full] level.
Whether the user is in ’flow control mode’ or not, the module will ignore display or command bytes which would over-run the buffer. While in ’flow control mode’ the unit will return 0xFE when buffer is almost full even though it may have already thrown rejected data away. The buffer size for the display is 80 bytes.
When using this command in an application, selection of the value for the buffer almost full should be considered very carefully. This is a critical aspect of using this command to it’s full potential. When using a host system or PC which contains a FIFO, the user should set the value of [full] equal to or greater than the size of the FIFO. The reason for this is that the FIFO may be full when the host system receives 0xFE. In the case of 16550 UART the size at its maximum is 16, therefore the value of should be set to 16 or greater.
Matrix Orbital LCD4041 19
Page 23
5.2.2 Exit Flow Control Mode (254 59)
This command turns off flow control. Bytes may overflow the buffer without warning.
6 Appendix: Command Summary
6.1 General
The operation of the display is controlled by a simple and consistent command set. Commands control;
Text display
Miscellaneous operating parameters
6.2 Issuing Commands
Commands are issued to the display by the controller. In a test setup, commands can be issued to the display by means of a BASIC program, using the chr$( ) function. In the tables below, we’ve shown commands in hex, ASCII and decimal form. All commands begin with the prefix character 0xFE (254 decimal). These commands are issued on the serial communications link (I2C or RS-232) at the currently defined baud rate.
For example (using BASIC in a test setup), the user could issue the command to clear the screen on the display by including the line;
+,.-0/12.34!056879 :.;=<4!5>6?79@@;
in the BASIC program.
Or, with C the user could (using Zcomm serial library)
ABC0**D%E%FG5.BC**HID7'">;=<
ABC0**D%E%FG5.BC**HID7JLKMJN;=<
6.3 On Numbers
Like all computerized devices, the display operates with commands and values in the form of binary numbers. These binary numbers are arranged in 8 digit (i.e. 8 bit) groups called bytes. The decimal value of a byte may have any value from 0 to 255.
Bytes are usually specified in either decimal or hexadecimal (base 16) form for convenience, since binary numbers are confusing to deal with directly. Hexadecimal (hex) numbers are particularly convenient because exactly two hexadecimal digits make up one byte, each hex digit representing 4 binary digits (4 bits) as shown here;
Matrix Orbital LCD4041 20
Page 24
Table 12: Hex Value Table
Binary Hex Decimal Binary Hex Decimal
0000 0 0 1000 8 8 0001 1 1 1001 9 9 0010 2 2 1010 A 10 0011 3 3 1011 B 11 0100 4 4 1100 C 12 0101 5 5 1101 D 13 0110 6 6 1110 E 14 0111 7 7 1111 F 15
Based on the table, the byte 01001011 can be represented in hex as 4B, which is usually written as any of 4Bh, 4BH, 4B hex or 0x4B.
The numbers can also be expressed in decimal form if preferred.
6.3.1 ASCII Characters
Since computers deal internally with numbers only, but externally with both letters and numbers, several schemes were developed to ’map’ written characters to numeric values. One such scheme has become universal, the American Standard Code for Information Interchange, or ASCII. ASCII tables are readily available from a number of sources. A few examples will do here;
Table 13: Example of an ASCII Table
The letter A has a value of 65 decimal or 41 hex
The letter a has a value of 97 decimal or 61 hex The number 0 has a value of 48 decimal or 30 hex The number 9 has a value of 57 decimal or 39 hex
This gives rise to the possibility of confusion when parameters are being set on the display. For example, the GPO ON and OFF commands use a number to indicate which GPO is being controlled. We’re told that acceptable values are 0 to 6. All such parameters must use numeric values (i.e., the actual byte values). If we send the ASCII number 0 by mistake it will actually give the value 48 decimal (30 hex) to the parameter, which is wrong.
In the tables given in the following sections ASCII characters are shown as ’A’, with single quotes.
6.4 Text Commands
Syntax in the tables below is given in hex, decimal and decimal with ASCII, in that order, one per line.
Matrix Orbital LCD4041 21
Page 25
Table 14: Text Commands
Command Syntax Default Notes
Auto scroll on FE 51
254 81 254 ’Q’
Off Enables scroll at
bottom of screen. Text will push display up one line to make room for new line.
Auto scroll off FE 52
254 82 254 ’R’
Off Disables auto
scroll. Text will wrap to top left and overwrite existing text.
Set cursor position FE 47 [col] [row] 254 71
[col] [row] 254 ’G’ [col] [row]
N/A Moves cursor
to the specified column and row. The cursor
marks the text insertion point in this and all commands.
Send cursor home FE 48
254 72 254 ’H’
This command moves the cursor to the top left of the display area.
Underline cursor on FE 4A
254 74
Off Turns on the un-
derline cursor.
254 ’J’
Underline cursor off FE 4B
254 75
Turns off the un­derline cursor.
254 ’K’
Block cursor on FE 53
254 83 254 ’S’
Block cursor off FE 54
254 84 254 ’T’
On Turns on the
blinking block cursor. Turns off the blinking block cursor.
Matrix Orbital LCD4041 22
Page 26
Command Syntax Default Notes
Cursor left FE 4C
254 76 254 ’L’
Cursor right FE 4D
254 77 254 ’M’
Moves the cur­sor one position to the left. If the cursor is already at the beginning of a line it will move to the end of the other line. Moves the cur­sor one position to the right. If the cursor is already at the end of a line it will move to the beginning of the other line.
6.5 Bar Graphs and Special Characters
The commands in this section are used to define and display bar graphs and special characters.
Table 16: Bar Graphs and Special Characters
Command Syntax Notes
Initialize thick vertical bar graph
Initialize thin vertical bar graph
Initialize horizontal bar graph
Define custom character FE 4E [c][8 bytes]
Matrix Orbital LCD4041 23
FE 76 254 118 254 ’v’ FE 73 254 115 254 ’s’ FE 68 254 104 254 ’h’
254 78 [c][8 bytes] 254 ’N’ [c][8 bytes]
Initializes the user character set to make wide vertical bar graphs.
Initializes the user character set to make narrow vertical bar graphs.
Initializes the user character set to make horizontal bar graphs.
Defines one of 8 custom "user" char­acters. Character number is [c] be­tween 0x00 and 0x07. The 8 bytes are described in section 5.1.6.
Page 27
Command Syntax Notes
Draw vertical bar graph FE 3D [col][length]
254 61 [col][length] 254 ’=’ [col][length]
Draw horizontal bar graph FE 7C [c][r][d][length]
254 124 [c][r][d][length] 254 ’|’ [c][r][d][length]
Initialize large digits FE 6E
254 110 254 ’n’
Place large digits FE 23 [col] [digit]
254 35 [col] [digit] 254 ’#’ [col] [digit]
Draws a vertical bar graph at column [col] of length [length]. Length is measured in pixels (0x00 to 0x14). User must first use the ’v’ or ’s’ command to initialize characters. Draws a horizontal bar graph start­ing at column [c] on row [r] with di­rection [d] (0 is right, 1 is left) of length [length]. Length is measured in pixels (0x00 to 0x64 if starting in column 1). User must first use the ’h’ command to initialize characters. Initializes the user character set to make large digits.
Place large digit number [digit] in column [col] of the display. Cursor moves to bottom right of large digit. [digit] is 0x00 to 0x09, [col] is 0x01 to 0x12 (i.e. 1 to 18 decimal).
6.6 Miscellaneous Commands
Table 18: Miscellaneous Commands
Command Syntax Default Notes
Clear display FE 58
254 88 254 ’X’
Set contrast FE 50 [contrast] 254 80
[contrast] 254 ’P’ [con­trast]
Matrix Orbital LCD4041 24
n/a Clears screen of
text and graphics, places text cursor at top left.
0x80 128 Sets display con-
trast. Compen­sates for viewing angle. Contrast is a value between 0 and 255 (hex 0 to FF). Larger = darker.
Page 28
Command Syntax Default Notes
Backlight on FE 42 [minutes]
254 66 [minutes] 254 ’B’ [minutes]
on Backlight will
stay on for [min­utes]. If [minutes] = 0 backlight will stay on permanently.
Backlight off FE 46
254 70
on Turns off back-
light.
254 ’F’
Load startup screen FE 40 [32 char]
254 64 [32 char] 254 ’@’ [32 char]
Matrix Orbital LCD4041
Loads new startup screen (32 char­acters). Screen is remembered for subsequent power ups.
General purpose output off FE 56
254 86 254 ’V’
General purpose output on FE 57
254 87 254 ’W’
Set I2C address FE 33 [address]
254 51 [address] 254 ’3’ [address]
off Turns the general
purpose output OFF.
off Turns the general
purpose output ON.
0x50 Value is write ad-
dress and must be even, read address is 1 higher.
Read module type FE 37
254 55 254 ’7’
Set RS-232 port speed FE 39 [speed]
254 57 [speed]
see table Reads the module
type. Returns a 1­byte value.
19,200 baud Sets RS-232
speed.
254 ’9’ [speed]
Set Serial Number FE 34 [byte1][byte2]
254 52 [byte1][byte2] 254 ’4’ [byte1][byte2]
This is a one­time-use com­mand which works only on units without factory set serial numbers.
Read Serial Number FE 35
254 53 254 ’5’
Reads the two byte serial num­ber of the module.
Matrix Orbital LCD4041 25
Page 29
Command Syntax Default Notes
Read Version Number FE 36
254 54 254 ’6’
Enter flow control mode FE 3A [full] [empty]
254 58 [full] [empty] 254 ’:’ [full] [empty]
Exit flow control mode FE 3B
254 59 254 ’;’
off Sets "full" and
7 Appendix: Specifications and Options
Reads the firmware ver­sion number of the module. Returns a 1-byte value.
"empty" marks for the 80 byte display buffer. When buffer reaches [full] display will return 0xFE to host. When buffer reaches [empty] display will return 0xFF. Turns off flow control.
7.1 Specifications
Table 20: Environmental Specifications
Standard Temperature Extended Temperature
Operating Temperature 0◦C to +50◦C -20◦C to +70◦C
Storage Temperature -20◦C to +70◦C -40◦C to +85◦C
Operating Relative Humidity 90% max non-condensing 90% max non-condensing
Table 21: Electrical Specifications
Supply Voltage 4.75 - 5.25 Vdc (optional 7 - 35 Vdc)
Supply Current 10 mA typical
Supply Backlight Current 115 mA typical
Matrix Orbital LCD4041 26
Page 30
Table 22: Optical Specifications
Number of Characters 160 (40 characters by 4 lines)
Matrix Format 5 x 7 with underline
Display Area 155.1 x 16.5 mm XxY
Character Size 3.20 x 5.55 mm (XxY), not including underline
Character Pitch 3.7 mm
Line pitch 5.95 mm
Dot Size 0.60 x 0.65 mm (XxY)
Dot Pitch 0.65 x 0.70 mm (XxY)
LED Backlight Life 100,000 hours typical
Color of Illumination Yellow Green
Matrix Orbital LCD4041 27
Page 31
Figure 15: Physical Layout
7.2 Options
Table 23: Options Available on LCD4041
Extended Temperature E
Wide Voltage V
Wide Voltage with Efficient Switching Power Supply VPT
Matrix Orbital LCD4041 28
Page 32
8 Appendix: Glossary
Table 24: Appendix: Glossary
ASCII American Standard Code for Information Interchange.
A 7 bit binary code representing the English alpha­bet, decimal numbers and common punctuation marks. Also includes control characters such as carriage re­turn or end of text. An 8 bit superset of the standard ASCII codes is often used today to include foreign characters and other symbols. These supersets are of­ten called extended ASCII character sets.
Backlight A backlit display is illuminatedfrom behind to provide
nighttime and improved daytime readability.
Binary Number The (data and signaling) bit transmission rate of an RS-
232 device.
Bit A number written using binary notation which only
uses zeros and ones.
Bitmap A representation, consisting of rows and columns of
dots, of a graphics image in computer memory. The value of each dot (whether it is filled in or not) is stored in one or more bits of data.
Byte A grouping of eight binary bits. CCFL Cold Cathode Fluorescent Lamp. A high brightness
backlighting source consists of a fluorescent tube pow­ered by a high voltage A.C. source.
Configuration The way a system is set up, or the assortment of com-
ponents that make up the system. Configuration can refer to either hardware or software, or the combina­tion of both.
Contrast The ratio of luminance between the light state of the
display to the dark state of the display.
Controller The micro-controller or PC used to control the Matrix
Orbital display unit.
DB-9 The designation of a connector used in the RS-232 in-
terface: 9 pin connector.
Firmware Software (programs or data) that has been written onto
read-only memory (ROM). Firmware is a combina­tion of software and hardware. ROMs, PROMs and EPROMs and flash EEPROMs that have data or pro­grams recorded on them are firmware.
Matrix Orbital LCD4041 29
Page 33
Font A design for a set of characters. A font is the combina-
tion of typeface and other qualities, such as size, pitch, and spacing.
Font Metric A definition of where font is to be placed, such as mar-
gins and spacing between characters and lines.
Hexadecimal Refers to the base-16 number system, which consists
of 16 unique symbols: the numbers 0 to 9 and the let­ters A to F. For example, the decimal number 15 is represented as F in the hexadecimal numbering sys­tem. The hexadecimal system is useful because it can represent every byte (8 bits) as two consecutive hex­adecimal digits. It is easier for humans to read hex­adecimal numbers than binary numbers.
I2C Short for Inter-IC, a type of bus designed by Phillips
Semiconductors in the early 1980s, which is used to connect integrated circuits (I2Cs). I2C is a multi­master bus, which means that multiple chips can be connected to the same bus and each one can act as a master by initiating a data transfer.
Interface A means by which two systems interact. LCD Liquid Crystal Display. Module Type Value This refers to the model number of the module. Pixel The smallest individually controllable element of a
display.
Pre-Generated Fonts Pre-determined fonts which can be downloaded into
graphic liquid crystal displays.
Primitive A low-level object or operation from which higher-
level, more complex objects and operations can be constructed. In graphics, primitives are basic elements, such as lines, curves, and polygons, which you can combine to create more complex graphical images.
RS-232 Short for recommended standard-232C, a standard in-
terface approved by the Electronic Industries Associa­tion (EIA) for connecting serial devices.
Scroll To view consecutive lines of data on the display screen.
The term scroll means that once the screen is full, each new line appears at the bottom edge of the screen and all other lines move up one position.
Serial Number A number that is one of a series and is used for identi-
fication of the module.
Serial Port A port, or interface, that can be used for serial commu-
nication, in which only 1 bit is transmitted at a time.
Version Number This refers to the firmware revision number of the
module.
Matrix Orbital LCD4041 30
Page 34
Volatile Memory Temporary memory. Once the power supply is turned
off volatile memory is then erased.
Matrix Orbital LCD4041 31
Loading...