LK204-25-USB Technical Manual Revision: 1.
Contents Contents 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 5.14 5.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.9 Assign Keypad Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 10 Display Functions 10.1 Introduction . . . . . . . 10.2 Display On . . . . . . . 10.3 Display Off . . . . . . . 10.4 Set Brightness . . . . . . 10.5 Set and Save Brightness . 10.6 Set Contrast . . . . . . . 10.7 Set and Save Contrast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 Getting Started The LK204-25-USB is an intelligent LCD display designed to decrease development time by providing an instant solution to any project. With the ability to communicate via USB protocol, the versatile LK204-25-USB can be used with virtually any controller. The ease of use is further enhanced by an intuitive command structure to allow display settings such as backlight brightness, contrast and baud rate to be software controlled.
Figure 1: 3ft mini-B USB Figure 2: Keypad Mountings Figure 3: Mounting Kits Matrix Orbital LK204-25-USB 2
Figure 4: 4X4 Keypad 1.3 • • • • • • • • • • • • • Features 20 column by 4 line alphanumeric liquid crystal display USB communication protocol Six, 5V -20mA, general purpose outputs for a variety of applications Lightning fast communication speeds, up to 115.
1.4 Connecting to a PC The LK204-25-USB connects seamlessly to a PC and it is an excellent means of testing the functionality. To connect your display to a PC, you will require a USB cable such as the one pictured in figure 1 on page 2. 1. In order to connect your USB display to a personal computer simply plug the mini-B USB cable from the PC to the USB connector on the display. NOTE The LK204-25-USB unit can also be powered via a standard PC power cable, shown in figure 5.
1. 2. 3. 4. 5. 6. 7. Go to the website location: http://www.matrixorbital.ca/drivers/ Download or copy the appropriate USB drivers into a directory. Uncompress the files. They will be a self extracting ZIP file. Connect the USB cable to the display and the computer. Windows will give a prompt for drivers for a USB , Serial Device. Select ’Specify location’, and navigate to the directory the file was uncompressed to. Test the display using a software tool such as uProject. 1.5.
2 Hardware Information Refer to the following diagram for this chapter: 1 Power Connector 2 Keypad Header 3 Manual Override 4 USB Header 5 Optional Serial Header 6 GPOs 7 Dallas 1-Wire Bridge 8 Protocol Select Jumpers Figure 7: LK204-25-USB 2.1 Power Connector The LK204-25-USB provides a Power Connector to allow the device to be powered externally. In order to power the device externally, you must remove one of the USB protocol select jumpers.
Pin 1 Pin 2 Pin 3 Pin 4 NC GND GND +5V Figure 8: Alternate Power Connector 2.2 Keypad Interface Connector The LK204-25-USB provides a Keypad Interface Connector which allows for up to a five by five matrix style keypad to be directly connected to the display module. Key presses are generated when a short is detected between a row and a column. When a key press is generated a character, which is associated with the particular key press, is automatically sent on the Tx communication line.
Figure 9: Keypad Interface Connector 2.3 Manual Override The Manual Override is provided to allow the LK204-25-USB to be reset to factory defaults. This can be particularly helpful if the display module has been set to an unknown baud rate and you are no longer able to communicate with it. If you wish to return the module to its default settings you must: 1. Power off the display module. 2. Place a Jumper on the Manual Override pins. 3. Power up the display module. 4.
Figure 10: Manual Override Jumper Table 1: Default Values Brightness 255 Contrast 128 Baud Rate 19.2 kbps NOTE The display module will revert back to the old settings once turned off, unless the settings are saved. 2.4 USB Header The USB Header provides USB connector for communication and power of the display.
Figure 11: USB Header Table 2: Power Requirements Standard Supply Voltage +5Vdc ±0.25V Supply Current 50 mA (Backlight Off) Backlight Current 185 mA (Backlight On) WARNINGS • Do not apply any power with reversed polarization. • Do not apply any voltage other than the specified voltage. 2.5 Serial Header The LK202-25-USB also offers an alternative, Serial Header option to permit serial communication with the device.
Figure 12: Serial Header NOTE This component is optional and must be custom ordered 2.6 General Purpose Outputs A unique feature of the LK204-25-USB is the ability to control relays and other external devices using a General Purpose Output, which can provide up to 20 mA of current and +5Vdc from the positive side of the GPO. This is limited by a 240 ohm resistor which is located to the above right of the GPOs as pictured below in figure 13.
GND Ground (0VDC) GPO +5VDC at 20 mA Figure 13: General Purpose Output WARNING If connecting a relay, be sure that it is fully clamped using a diode and capacitor in order to absorb any electro-motive force (EMF) which will be generated. 2.7 Dallas 1-Wire Bridge In addition to the six general purpose outputs the LK204-25-USB offers a standard Dallas One-Wire bridge, to allow for an aditional thirty two 1-wire devices to be connected to the display.
Figure 14: Dallas 1-Wire Bridge 2.8 Protocol Select Jumpers The Protocol Select Jumpers, pictured below in figure 15, provide the means necessary to toggle the display module between USB power and external power. As a default, the jumpers are set to USB mode with solder jumps on the USB jumpers. In order to place the display module in external power mode you must first remove the leftmost solder jump from the USB jumpers, as shown in figure 15. The display cannot be used in RS232, TTL, or I2C mode.
Figure 15: Protocol Select Jumpers 3 Troubleshooting 3.1 The display does not turn on when power is applied. • First, check the USB cable which you are using for continuity. If you don’t have an ohm meter, try using a different USB cable, if this does not help try using a different power supply. • Second, ensure that the correct drivers are properly installed. For the latest drivers, visit the Matrix Orbital website at http://www.matrixorbital.ca/drivers/.
3.3 The display module is communicating, however text cannot be displayed. • A common cause may be that the contrast settings have been set to low. The solution to this problem is to adjust the contrast settings. The default setting that will work in most environments is 128. NOTE Optimal contrast settings may vary according to factors such as temperature, viewing angle and lighting conditions. If you are unable to resolve any issue please contact Matrix Orbital. See 14.
NAK to indicate that the transmission is over. The LK204-25-USB has some speed limitations, especially when run in I2 C mode. Here are some considerations when writing I2 C code: * to be able to read the replies of query commands (eg. cmds 54, 55) the following command must be sent (only needs to be sent once, so this can be done somewhere in init): 254 / 160 / 0 this command puts the reply data in the I2 C output buffer instead of the RS232 output buffer.
4.1.4 USB Communication The LK204-25-USB is a USB device that offers identical communication protocol as the serial comport. capable of communicating via a USB interface. The USB communications are identical to the serial communications. Communication is via a virtual com port, which is created in the operating system by the drivers necessary to install the USB display. The LK204-25-USB communicating via USB is capable of baud rates of 19,200 bps to 115,200 bps.
Description Remembered Default 4.4 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 display module can be manually reset to 19,200 baud in the event of an error during transmission, including transmitting a value not listed below, by setting the manual override jumper during power up.
Examples Crystal Speed 16 Mhz Desired BAUD 13,500 speed = crystalspeed −1 8 ∗ DesiredBaud speed = 148.15 − 1 speed = 16, 000, 000 −1 8 ∗ 13, 500 speed = 147.15 • LSB = 0x93 (rounded) • MSB = 0x00 • Intended Baud Rate: 13,500 baud Actual Baud Rate: 16,000,000 =13,514 Percent Difference: 0.1% 8(147+1) NOTES • Results from the formula are rounded down to the nearest whole number (i.e 73.07 = 73). • This formula becomes less acurate as baud rates increase, due to rounding.
5.1.1 Character Set Figure 16: Character Set 5.1.2 Control Characters In addition to a full text set, the LK204-25-USB display supports the following ASCII Control characters: 0x08 Backspace 0x0C Clear screen / New page 0x0D Carriage return 0x0A Line feed / New line 5.
Syntax Description Remembered Default 5.3 Description Remembered Hexadecimal 0xFE 0x52 Decimal 254 82 ASCII 254 “R” When auto scrolling is disabled the text will wrap to the top left corner of the display area when the text reaches the end of last row. Yes Clear Screen Description Hexadecimal 0xFE 0x58 Decimal 254 88 ASCII 254 “X” This command will immediately clear all of the contents of the display. Remembered No Syntax 5.5 Yes On Auto Scroll Off Syntax 5.
5.6 Set Auto Line Wrap On Syntax Description Hexadecimal 0xFE 0x43 Decimal 254 67 ASCII 254 “C” Enabling Auto Line Wrap will allow the cursor to automatically wrap over to the next line when the current line is full. NOTE Line wraps may occur in the middle of a word. Remembered 5.7 Set Auto Line Wrap Off Syntax Description Remembered 5.8 Yes Hexadecimal 0xFE 0x44 Decimal 254 68 ASCII 254 “D” Disabling Auto Line Wrap will allow you to change the line configuration.
Description This command will allow you to manually set the cursor position, which controls the text insertion point, by specifying the [col] and [row] of the new proposed cursor position. NOTE If the cursor position is set past the end of a line it will wrap to the beginning of the next line. Remembered 5.
Description This command will move the cursor forward one space. If this command is sent when the cursor is at the bottom right position the cursor will wrap back to the home position if line wrap is on. Sending this command will not effect the text displayed on the module, however any characters that are sent will over write the current characters that are being displayed. Remembered No 5.
Description Hexadecimal 0xFE 0x54 Decimal 254 84 ASCII 254 “T” This command will turn the block cursor off. Remembered Yes Syntax 6 6.1 Special Characters Introduction The LK204-25-USB has the ability to create four different sets of eight custom characters and save them to internal banks of memory. Each set of eight can be recalled from memory at any time, and selected characters can be written to the display screen.
Description The LK204-25-USB allows for upta to eight custom defined characters to be added onto the the character set. A custom character is a five by eight pixel matrix with each row represented by a byte value. For example: 1 1 1 1 1 1 1 1 Remembered 6.
Description New to the LK204-25-USB has added five non-volatile memory banks for custom character storage. This is intended to allow you to create your own custom bar graphs, medium/large numbers and startup screen. However, each memory bank may be used to store a set of any eight custom characters; with the only provision being that memory bank zero contains the characters that will be used in the startup screen. By default the memory banks will be loaded as follows: [Bank] 0 1 2 3 4 Remembered 6.
Description Using this command you may create the custom characters. that will be stored in memory bank zero, which will be used in the startup screen. For more information about creating custom characters see Section 6.2 on page 25. NOTES • Changes only take place once the power has been cycled. • This command is the same as sending CMD 254 / 193 / 0 / [ID] / [DATA] Remembered 6.6 Initialize Medium Number Syntax Description Remembered 6.
6.8 Initialize Large Numbers Syntax Description Remembered 6.9 Hexadecimal 0xFE 0x6E Decimal 254 110 ASCII 254 “n” This command will load the default large number characters into the volatile memory. If you have stored your own custom large numbers, use the ’Load Custom Characters’ command instead to load your custom character data into the volatile memory. This command will allow you to use the ’Place Large Numbers’ command.
6.11 Place Horizontal Bar Graph Syntax Parameters Description Hexadecimal Decimal ASCII Parameter Col Row Dir 0xFE 0x7C [Col] [Row] [Dir] [Length] 254 124 [Col] [Row] [Dir] [Length] 254 “|” [Col] [Row] [Dir] [Length] Length Description 1 The column number. 1 The row number. 1 The direction of the bar data (0 or 1). Length 1 The length of the bar data. This command will place a bar graph at [row], [column]. A [Dir] value of zero will cause the bar to go right, and one will cause the bar to go left.
Syntax Description Hexadecimal 0xFE 0x76 Decimal 254 118 ASCII 254 “v” This command will load the wide vertical bar characters into the volatile memory. If you have stored your own custom vertical bar data, use the ’Load Custom Characters’ command instead to load your custom bar data into the volatile memory. This command will allow you to use the ’Place Vertical Bar’ command. NOTE Wide bars have a width of five pixels. Remembered No 6.
7.2 General Purpose Output Off Syntax Parameters Description Hexadecimal 0xFE 0x56 [Num] Decimal 254 86 [Num] ASCII 254 “V” [Num] Parameter Length Description Num 1 GPO number. This command turns OFF general purpose output [num]. NOTE OFF means that the output is pulled LOW. Remembered 7.3 Yes General Purpose Output On Syntax Parameters Description Hexadecimal 0xFE 0x57 [Num] Decimal 254 87 [Num] ASCII 254 “W” [Num] Parameter Length Description Num 1 GPO number.
Description This command will set the startup state for the GPO on the next power up. A value of one will cause the GPO to be off on the next startup while a value of one will cause the GPO to be on. NOTE This command does not affect the current state of the GPO. Remembered 8 8.1 Always Dallas 1-Wire Introduction Another convenient feature of the LK204-25-USB is that it provides a Dallas 1-wire interface in order to readily communicate with up to thirty two 1-wire devices on a single bus.
Description This command will allow you to begin communicating with the devices on the 1-wire bus by returning a packet containing device information for each 1-wire device on the bus in the form of: Search Return Packet Offset (Bytes) 0 Offset (Bytes) 2 Description 0x232A Preamble 2 1 0x8A Packet is 10 bytes long, another address will follow 0x0A Packet is 10 bytes long, this is the last address 3 4 5 13 1 1 8 1 0x31 - 1-Wire Packet Type Error Code (0x00 for success) 1-Wire Address CRC8 0x00 means
Description This command will perform a single transaction on the 1-wire bus in this order: 1. Bus Reset. 2. Transmit data onto the bus. 3. Receive data from the bus. The number of bits to be transmitted and read must be specified for this command to be successful. NOTE To determine what functions the device will respond to, consult the devices’ data sheet.
connector. The keypad is scanned whenever a key is pressed;there is no continuous key scan. This means that key presses are dealt with immediately without any appreciable latency. This also prevents electrical noise which is often caused by continuous key scans. 9.2 Auto Transmit Key Presses On Syntax Description Remembered Default 9.3 Yes On Auto Transmit Key Presses Off Syntax Description Remembered 9.
9.5 Description This command returns any buffered key presses via the serial interface. The host system must be set up to receive key codes. When the display receives this command, it will immediately return any buffered key presses which may have not been read already. If there is more than one key press buffered, then the high order bit (MSB) of the returned key code will be set (1). If this is the only buffered key press, then the MSB will be cleared (0).
9.7 Set Auto Repeat Mode Syntax Parameters Description Hexadecimal Decimal ASCII Parameter mode 0xFE 0x7E [mode] 254 126 [mode] 254 “~” [mode] Length Description 1 Auto Repeat Mode (0: Resend Key , 1: Key Up/Down) Two auto repeat modes are available and are set via the same command: • Resend Key Mode: 0x00 • Key Up/Down Mode: 0x01 Resend Key Mode This mode is similar to the action of a keyboard on a PC.
9.9 Description This command turns auto repeat mode off. See Set Auto Repeat Mode. Remembered No Assign Keypad Codes Syntax Parameters Description Remembered 10 Hexadecimal 0xFE 0xD5 [KDown] [KUp] Decimal 254 213 [KDown] [KUp] Parameter Length Description KDown 25 Key down codes KUp 25 Key up codes This command will allow you to reassign the key codes that correspond to the key presses on the matrix style key pad.
Description This command turns the backlight on after the [minutes] timer has expired, with a ninety minute maximum timer. A time of 0 specifies that the backlight should turn on immediately and stay on. When this command is sent while the remember function is on, the timer will reset and begin after power up. Remembered Default Yes 0 10.3 Display Off Syntax Description Remembered Hexadecimal 0xFE 0x46 Decimal 254 70 ASCII 254 “F” This command turns the backlight off immediately.
10.6 Set Contrast Syntax Parameters Description Hexadecimal 0xFE 0x50 [contrast] Decimal 254 80 [contrast] ASCII 254 “P” [contrast] Parameter Length Description contrast 1 Contrast value (0 to 255). This command sets the display’s contrast to [contrast], where [contrast] is a value between 0x00 and 0xFF (between 0 to 255). Lower values cause ‘on’ elements in the display area to appear lighter, while higher values cause ‘on’ elements to appear darker.
Description This command sets the display’s contrast to [contrast], where [contrast] is a value between 0x00 and 0xFF (between 0 to 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.
Description This command allows you to switch the remember function on and off. To use the remember function, set remember to on, then set all of the settings that you wish to save, settings that are listed as ’Remember: Yes’ support being saved into the non-volatile memory. After you have set all of the commands that you wish to save, you may then cycle the power and check the display settings to ensure that all the settings have been saved.
Description Paranoia allows you to lock the module from displaying information, as well as enables the protection of the filesystem and module settings.
Parameters Description Remembered Default Parameter Length Description level 1 Sets the data lock level This command will set and save the data lock level. See the Data Lock section for more information. Always 0 11.5 Write Customer Data Syntax Parameters Description Remembered Hexadecimal 0xFE 0x34 [data] Decimal 254 52 [data] ASCII 254 “4” [data] Parameter Length Description data 16 Writes the customer data Writes the customer Data. 16 Bytes of data can be saved in non-volatile memory. No 11.
Syntax Description Hexadecimal 0xFE 0x36 Decimal 254 54 ASCII 254 “6” This command will return a byte representing the version of the module, see the following table as an example: Hex Value 0x19 0x57 Remembered Version Number Version 1.9 Version 5.7 No 12.
Description Remembered Matrix Orbital This command will return a hex value corresponding to the the model number of the module see the following table: Hex 1 5 7 9 B D F 13 15 21 23 25 27 29 2B 31 33 35 37 39 3B 3D 3F 41 43 45 47 49 4B 4D 4F 51 53 55 57 5B 71 73 77 79 No Product ID LCD0821 LCD2041 LCD4041 LK204-25 VFD2021 VFD4021 VK204-25 GLC24064 GLK24064-25 Unused Unused GLK24064-16-1U-USB GLK19264-7T-1U-USB GLK12232-16-SM LK204-7T-1U LK404-AT LK402-12 LK204-25PC VK202-24-USB VK204-24-USB VK162-12 PK2
13 Command Summary 13.
Description Move Cursor Back Move Cursor Forward Underline Cursor On Underline Cursor Off Blinking Block Cursor On Blinking Block Cursor Off Syntax Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII 0xFE 0x4C 254 76 254 “L” 0xFE 0x4D 254 77 254 “M” 0xFE 0x4A 254 74 254 “J” 0xFE 0x4B 254 75 254 “K” 0xFE 0x53 254 83 254 “S” 0xFE 0x54 254 84 254 “T” Page 23 23 24 24 24 24 13.
Description Initialize Horizontal Bar Place Horizontal Bar Graph Initialize Narrow Vertical Bar Initialize Wide Vertical Bar Place Vertical Bar Syntax Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII 0xFE 0x68 254 104 254 “h” 0xFE 0x7C [Col] [Row] [Dir] [Length] 254 124 [Col] [Row] [Dir] [Length] 254 “|” [Col] [Row] [Dir] [Length] 0xFE 0x73 254 115 254 “s” 0xFE 0x76 254 118 254 “v” 0xFE 0x3D [Column] [Length] 254 61 [Column]
Description Auto Transmit Key Presses On Auto Transmit Key Presses Off Poll Key Press Clear Key Buffer Set Debounce Time Set Auto Repeat Mode Auto Repeat Mode Off Assign Keypad Codes Syntax Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal ASCII Hexadecimal Decimal 0xFE 0x41 254 65 254 “A” 0xFE 0x4F 254 79 254 “O” 0xFE 0x26 254 38 254 “&” 0xFE 0x45 254 69 254 “E” 0xFE 0x55 [ti
13.
Command Hex 0x43 0x44 0x45 0x46 0x47 0x48 0x4A 0x4B 0x4C 0x4D 0x4E 0x4F 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x60 0x68 0x6D 0x6E 0x6F 0x73 0x76 0x7C 0x7E 0x91 0x93 0x98 0x99 0xA4 0xC0 0xC1 0xC2 Description Page Dec ASCII 67 “C” 68 “D” 69 “E” 70 “F” 71 “G” 72 “H” 74 “J” 75 “K” 76 “L” 77 “M” 78 “N” 79 “O” 80 “P” 81 “Q” 82 “R” 83 “S” 84 “T” 85 “U” 86 “V” 87 “W” 88 “X” 96 “‘” 104 “h” 109 “m” 110 “n” 111 “o” 115 “s” 118 “v” 124 “|” 126 “~” 145 147 152 153 164 192 193 194 0xC3 0xC8 0xCA 195 200 202 Ma
14 Appendix 14.1 Specifications 14.1.1 Environmental Table 70: 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 -30◦ C to +80◦ C Operating Relative Humidity 90% max non-condensing Vibration (Operating) 4.9 m/s2 XYZ directions Vibration (Non-Operating) 19.6 m/s2 XYZ directions Shock (Operating) 29.4 m/s2 XYZ directions Shock (Non-Operating) 490 m/s2 XYZ directions 14.1.
NOTE To prolong life, it is recommended that the backlight be turned off when the display is not in use.
14.
14.
14.6 Contacting Matrix Orbital Telephone Sales: 1(403)229-2737 Support: 1(403)204-3750 On The Web Sales: http://www.MatrixOrbital.com Support: http://www.MatrixOrbital.ca Forums: http://www.lcdforums.com 14.7 Revision History Revision 1.0 1.