|
|
|
|
The keypad Interface for Matrix-Orbital Serial LCD's Keypad Interface via I²C The keypad is read by I²C master read. In short, this means that a read of the module will always return the first unread key press. A read is initiated by writing to the module with its base address plus 1, then clocking the module’s return byte after the module releases the SDA line. Much more detail on this basic I²C function can be found in the I²C specification by Philips. The module contains a ten key press buffer so that it can be polled for key presses at an infrequent rate (every 500 to 1000 mS is typical). All returned key presses indicate the presence or absence of additional logged key presses by the most significant bit (MSB - bit 7). If the user has pressed two keys since the last poll of the keypad interface, the first read will return the key code with bit 7 set and the second read will return the key code with bit 7 clear. The application must take into account this bit to keep up with user key presses. If there are no keypresses detected, the module will return zero (0x00). Keypad Interface via RS - 232 By default on any press of a key, the module will immediately send out the key code at the selected baud rate. Auto Transmit:
Keypad Interface (Both I²C and RS - 232)
Auto Repeat:
LK204-25 Command Set
Write Text This section of the manual allows the user to send commands to the LK to alter the appearance or behavior of the display. To utilize a command, the user must send a command prefix followed by the command in the format described in this portion of the manual. Any characters sent without a command prefix will be interpreted as text and will be displayed on the module at the current cursor position. The current cursor position will be incremented for each character received. Please note that unless line wrap is turned on, the text will follow the memory map of the module. The command set discusses in detail what the LK's capabilities
of and how to execute each command. The basic format of all the commands For commands that do require parameters however the format
is as follows: Basic Commands All commands are prefixed by the command 0xFE, Hex FE, Decimal 254 Auto Repeat Mode On
To turn auto repeat on and select mode, send a command prefix followed by the character '~', followed by either 0x00 or 0x01:
To turn auto repeat
off, send a command prefix followed by the character '`'. Auto Line Wrap On
This command enables the automatic line wrap function. Transmitted characters which overrun the width of the display will automatically wrap to the next line. The bottom line wraps to line 1 of the display. To carry out this command the user must send a command prefix followed the character 'C'. Auto Line Wrap Off
This command disables the automatic line wrapping function. To turn off the the auto line wrapping, send a command prefix followed by the character 'D'. Auto Scroll On To enable auto scroll, send a command prefix followed by the character ‘Q’. When auto scrolling is on, it causes the LK to shift the entire display’s contents up to make room for a new line of text when the text reaches the scroll position defined by the “Set Font Metrics” command in the LK memory. Auto Scroll Off
When auto scrolling is disabled, text will wrap to the top left corner of the display area. Existing graphics or text in the display area are not erased before text is placed; when using proportional fonts without auto scrolling, care should be taken to clear areas where text is being written , particularly when wrapping occurs. Auto Transmit Keypresses On
To activate the automatic transmission of keypresses, send a command prefix followed by the character 'A'. In this mode, all keypresses are sent immediately to the host system without the use of poll keypad command. This is the default mode on power up. Auto Transmit Keypresses Off
To disable the automatic transmission of keypresses, send a command prefix followed by the character 'O'. In this mode, up to 10 keypresses are buffered until the unit is polled by the host system via the poll keypad command. Poll Keypad To return any unbuffered keypresses via the RS - 232 interface, send a command prefix followed by the character '&' and then set up the host system to receive the key codes. When a keypad module receives this command it will immediately return any unbuffered keypresses which may have not been read already. If there is more than one keypress buffered, then the high order bit of this returned keycode will be set. If this is the only buffered keypress, then the high order bit will be cleared. If there are no buffered keypresses, then the returned code will be 0x00. Enter Buffer Return Status Mode To enter buffer return status
mode, send a command prefix followed by the character ‘:’. The module
will now wait for the two bytes which define the parameters: Where
<almost full> Exit Buffer Return Status Mode
The command allows the user exit buffer return status mode. Backlight On To turn the backlight on, send a command prefix followed by the character 'B' and the number of minutes for the backlight to remain on. If <minutes> is sent as zero then the backlight will remain on indefinitely. The maximum value for <minutes> is 100. Example: <command prefix> 0xFE Backlight Off To turn the backlight off, send a command prefix followed by the character 'F'. Clear Display This command clears any text and graphics off the display. To clear the display, send a command prefix followed the character 'X'. Clear Key Buffer
This command clears any unread keypresses. In a menuing application, if the user presses a key which changes the menu context, any following key presses may be inaccurate and can be cleared out of the buffer between menu changes to prevent jumping around the menu tree. It may also be used to, in effect, reset the keypad in case the application resets for whatever reason. To execute this command, send a command prefix followed by the character 'E'. Contrast This command allows you to set the display contrast to a level between 0(light) and 256(dark). To execute this command, send a command prefix followed by the character 'P' and a hex value between 0x00 and 0xFF. Different displays and lighting conditions will affect the actual value used. Different modules have different power up contrast settings. Example: <command prefix> 0xFE Cursor
On To turn the cursor on at the current position, send a command prefix followed by the character 'J'. Note cursor is on by default at power up. Cursor Off To turn the cursor off at the current position , send a command prefix followed by the character 'K'. Cursor Left To move the cursor one space to the left of current position, send a command prefix followed by the character 'L'. Cursor Right To move the cursor one
space to the right of the current position, send a command prefix followed
by the character 'M'. Cursor Blink On
Cursor Blink Off To turn off the blinking cursor at the current position send a command prefix followed by the character 'T'. Set Debounce Time
To set the time between key press and key read, send a command prefix followed by the character 'U' and a number to define the debounce time. All key types with the exception of latched piezo switches will "bounce" for a varying time, depending on their physical characteristics. The default debounce time for the module is about 65mS, which is adequate for most membrane keypads. This time equates to a setting of 8 using this command as there is a debounce time resolution of 8192 microseconds. Create Custom Character This command creates a custom character. For the LK204-25 the user can have up to eight custom characters. To execute this command, send a command prefix followed by the character 'N'. The display will now await the number which identifies the custom character. This number must be between 0x00 and 0x07. When the module determines what character it's working on, then the user must send 8 bytes which define the display character. See the diagram below for and explanation of the display character structure. Diagram A
Pixel Layout of Display Character
General Purpose Output On To turn a general output purpose on, send a command prefix followed by the character 'V' and hex number which corresponds to the output which will be turned on. To turn on output five, the sequence would be: <command prefix> 0xFE General
Purpose Output Off To turn a general output purpose off, send a command prefix followed by the character 'W' and a hex number which corresponds to the output which will be turned off. To turn off output 1, the sequence would be: <command prefix> 0xFE Go
To Position To set the current cursor position, send a command prefix followed by the character 'G' and two values defining the column and row of the desired cursor position. Example: <command prefix> 0xFE Go
To Top Left This command resets the current cursor position to the top left of the LK screen. To execute this command send a command prefix followed by character 'H'. Initialize Large Digits Before any large digits may be created, this command must be executed. It only needs to be sent once to initialize the custom characters for large digits. Due to the fact large digits use pre-determined custom characters, no user custom characters may be displayed or created while digits are in use. Place Large Digit This command allows the creation of large digits on the LCD screen. To execute this command the user must send a command prefix followed by the character '#' and the column number where the digit is to be placed. Then the user must enter the number of the large digit which is required in hexadecimal. 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. The module must be initialized for large digit creation before large digits may be placed. 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. The format for this command is as follows: <command prefix> 0xFE Initialize
Horizontal Bar Graph Before any horizontal bar graphs may be created, this command must be executed. It only needs to be sent once to initialize the custom characters for bar graph creation. Due to the fact bar graphs use custom characters, no user custom characters may be displayed or created while bar graphs are in use. Make Horizontal Bar Graph This command places a horizontal bar graph at the specified column and row with the specified width. The format of the command is as follows: <command prefix > 0xFE Bar length is in pixel widths. On a twenty column display the maximum bar graph width is one hundred (if the bar graph starts at the edge). This is due to the fact that each of the twenty columns on the display are five pixels wide. The width of the space between columns is not taken into account. Initialize Thick Vertical Bar Graph Before any thick vertical bar graphs may be created, this command must be executed. It only needs to be sent once to initialize the custom characters required for bar graph creation. Bar graphs use custom characters, therefore no user custom characters may be displayed or created while bar graphs are in use. Initialize Thin Bar Vertical Graph This command is executed in exactly the same manner as the 'Initialize Thick Bar Graph' command. Make Vertical Bar Graph This command places a bar graph at the specified column with the specified height. The style of the vertical bar graph whether it be thick or thin is selected by the initialize vertical bar graph command. If thick bar graphs are preferred, the 'v' command should be send to initialize the bar graph. If a thin vertical bar graph is desired, the 's' command should be sent to initialize the bar graph. The format for the command is as follows: <command prefix> 0xFE Bar height is in pixel widths. On a four line display the maximum bar graph height is thirty-two, this is because each of the lines in the display are eight pixels high. The width of the space between the lines is not taken into account. Note: Large Digits may not be used with bar graphs. Vertical bar graphs may not be used with horizontal bar graphs, and thick bar graphs may not be used with thin bar graphs. This is because all these functions make use of the same "custom character" spaces. As a result, custom characters are also unavailable while any of these functions are in use. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|