Job description
LCD initialization for 4-bit mode operation:
initialization must start with a sequence of commands
0x33
0x32
(after restart, LCD reads in 8-bit mode, 33 sent in two steps to the 4 older bits means that 2 times
in this mode, 0x32 is read by the LCD as a sequence of 0x30 and 0x20; you can't send 0x20 /switch to 4 bits mode/, because it will be read
as a sequence of 0x20 and 0x00, and the latter code is an unknown command)
Display control codes:
0x80 | 0b00(A6)(A5)(A4)(A3)(A2)(A1)(A0) - set RAM addr (cursor position)
0x20 | 0b000(DL)NFXX - Function set
DL=1 - 8 bits interface
DL=0 - 4 bits interface
N=1 - 2 lines
N=0 - 1 line
F=1 - 5x10 dots
B=0 - 5x8 dots
X - don't care
0x10 | 0b0000(S/C)(R/L)XX
S/C=1 - display shift
S/C=0 - cursor shift
R/L=1 - shift right
R/L=0 - shift left
0x08 | 0b00000DCB - display on/off, cursor display on
D=1 - display is on
D=0 - display is off
C=1 - cursor displayed
C=0 - cursor not displayed
B=1 - blink at cursor position
B=0 - don't blink at cursor position
0x04 | 0b000000(I/D)S - Entry mode input to RAM and output to display
I=1 - increment RAM addr (move cursor to right)
I=0 - decrement RAM addr (move cursor to left)
S=1 - char write<->display shift
Method of converting the natural binary code (number) into another code using the transcoding array:
In the transcoding array, the index of the item corresponds to the number to be encoded (in the new code), and the value of the item with that index is the code of that number.
So, under the item 0 the code of the number 0 is placed, under the item 1 - the code of the number 1, etc. The code change is performed by reading from the transcoding table
the value of the position with the index that is the number to be encoded