You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
4.1 KiB
66 lines
4.1 KiB
6 years ago
|
Transcript from http://developer.pertelian.com/index.php?option=com_content&view=section&id=3&Itemid=9
|
||
|
Received via http://web.archive.org/web/20100903020330/http://developer.pertelian.com/index.php?option=com_content&view=section&id=3&Itemid=9 Apr 2019
|
||
|
|
||
|
|
||
|
## Pertelian X2040 Hardware Instruction Set
|
||
|
To issue an instruction, you must first issue a Set Instruction Mode command to set the LCD in instruction mode. The Set Instruction Mode command has byte code 0xFE hex (254 decimal).
|
||
|
|
||
|
| Instruction | Byte 7 | Byte 6 | Byte 5 | Byte 4 | Byte 3 | Byte 2 | Byte 1 | Byte 0 | Description | Exec. Time |
|
||
|
| ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- |
|
||
|
| Set Instruction Mode | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | Sets the LCD to Instruction Mode | 1.64ms |
|
||
|
|
||
|
|
||
|
The byte following the Set Instruction Mode command is treated as an instruction. For example, to clear the display write the byte codes 0xFE and 0x01 to the device.
|
||
|
|
||
|
| Instruction | Byte 7 | Byte 6 | Byte 5 | Byte 4 | Byte 3 | Byte 2 | Byte 1 | Byte 0 | Description | Exec. Time |
|
||
|
| ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- |
|
||
|
| Clear display | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | Clears display and returns cursor to the home position (address 0) | 1.64ms |
|
||
|
| Backlight Off | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | Turns the backlight off | 1.64ms |
|
||
|
| Backlight On | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | Turns the backlight on | 1.64ms |
|
||
|
| Entry mode set | 0 | 0 | 0 | 0 | 0 | 1 | I/D | S | Sets cursor move direction (I/D), specifies to shift the display (S). These operations are performed during data read/write | 40us |
|
||
|
| Display On/Off control | 0 | 0 | 0 | 0 | 1 | D | C | B | Sets On/Off of all display (D), cursor On/Off (C) and blink of cursor position character (B) | 40us |
|
||
|
| Cursor/display shift | 0 | 0 | 0 | 1 | S/C | R/L | * | * | Sets cursor-move or display-shift (S/C), shift direction (R/L). DDRAM contents remains unchanged | 40uS |
|
||
|
| Function set | 0 | 0 | 1 | DL | N | F | * | * | Sets interface data length (DL), number of display line (N) and character font(F) | 40uS |
|
||
|
| Set CGRAM address <td> 0 <td> 1 <td colspan=6> CGRAM address <td> Sets the CGRAM address. CGRAM data is sent and received after this setting <td> 40uS </td></tr>
|
||
|
| Set Display Data address <td> 1 <td colspan=7> The offset value: Row 1, Column 1 starts at offset 0x0 hex, Row 2, Column 1 starts at offset 0x40 hex, Row 3, Column 1 starts at offset 0x14 hex, Row 4, Column 1 starts at offset 0x54 hex <td> Set the address where to start displaying characters at using offset to specify row and column <td> 40uS </td></tr>
|
||
|
| Write to CGRAM or DDRAM <td colspan=8> Data <td> Writes data to CGRAM or DDRAM. For DDRAM see character set below <td> 40uS </td></tr>
|
||
|
|
||
|
|
||
|
#### Remarks
|
||
|
- DDRAM = Display Data RAM
|
||
|
- CGRAM = Character Generator RAM
|
||
|
- DDRAM address corresponds to cursor position
|
||
|
- * = Don't care
|
||
|
DL set 1 for 8 bit interface, 0 for 4 bit interface
|
||
|
N set 1 for 2 lines, 0 for 1 line
|
||
|
F set 0 for 5x8 dots
|
||
|
S/C set 1 for Display shift, 0 for Cursor move
|
||
|
R/L set 1 for Shift to the right, 0 for Shift to the left
|
||
|
D set 1 for Display ON, 0 for Display OFF
|
||
|
C set 1 for Cursor ON, 0 for Cursor OFF
|
||
|
B set 1 for Cursor blinking
|
||
|
I/D set 1 for Increment, 0 for Decrement
|
||
|
S set 1 for Automatic display shift
|
||
|
|
||
|
## LCD Character Set
|
||
|
Use the following character codes to display the following symbols from the table. For example, the character 'A' is 01000001 binary or 65 decimal.
|
||
|
|
||
|
![charcode0](lcd_character_set.gif?raw=true "LCD character set")
|
||
|
|
||
|
## Initialization Sequence
|
||
|
Based on the instruction set, the proper Pertelian initialization sequence is as follows:
|
||
|
|
||
|
0xFE; //Set instruction mode
|
||
|
0x38; //Function set with 8-bit data length, 2 lines, and 5x7 dot size
|
||
|
0xFE;
|
||
|
0x06; //Entry mode set; increment cursor direction; do not automatically shift
|
||
|
0xFE;
|
||
|
0x10; //Cursor/display shift; cursor move
|
||
|
0xFE;
|
||
|
0x0C; //Display On; cursor off; do not blink
|
||
|
0xFE;
|
||
|
0x01; //Clear display
|
||
|
|
||
|
//Begin normal operations
|
||
|
|