| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| arduino:ks0073_driver_library [2022/08/18 04:48] – tony | arduino:ks0073_driver_library [2022/08/22 23:31] (current) – [KS0073 LCD Library] tony |
|---|
| \\ | \\ |
| |
| I have a pile of display panels from Siemens optiPoint 500 series phones, that I wish to use in Arduino projects. These are 2 line by 24 character LCD status displays, controlled by Samsung KS0073 - a Hitachi HD44780 compatible LCD controller/driver chip that includes an SPI style serial interface. | I have a [[:electronic:lcd:vlgem1021|pile of display panels]] from Siemens optiPoint 500 series phones, that I wish to use in Arduino projects. These are 2 line by 24 character LCD status displays, controlled by Samsung KS0073 - a Hitachi HD44780 compatible LCD controller/driver chip that includes an SPI style serial interface. |
| <HTML> | <HTML> |
| <div class="shadows" style="text-align:center"> | <div class="shadows" style="text-align:center"> |
| <a href="/dokuwiki/_detail//electronic/lcd/p8123449a.jpg" class="media"><img width="90%" src="/dokuwiki/_media//electronic/lcd/p8123449a.jpg" class="media" title="Varitronix VLG1021" alt="Varitronix VLG1021" /></a> | <a href="/dokuwiki/_detail//electronic/lcd/p8123449a.jpg" class="media"><img width="90%" src="/dokuwiki/_media//electronic/lcd/p8123449a.jpg" class="media" title="Varitronix VLG1021" alt="Varitronix VLG1021" /></a> |
| <div class="container"> | <div class="container"> |
| <a href="/dokuwiki/electronic/lcd/vlgem1021">SPI LCD panel that use a Samsung KS0073 (a Hitachi HD44780 compatible controller with serial interface)</a> | <a href="/dokuwiki/electronic/lcd/vlgem1021">VLG1021 LCD panel that use a Samsung KS0073 (a Hitachi HD44780 compatible controller with serial interface)</a> |
| </div> | </div> |
| </div> | </div> |
| ===== Hardware description ===== | ===== Hardware description ===== |
| |
| The controller is mounted on a PCB joined to the LCD glass via a PCB flex cable, and the LCD module has a 10 pin, 1mm pitch, PCB flex cable to connect to a suitable socket. The displays are a two lines of twentyfour, 5 by 8 pixel, characters. | {{ :electronic:lcd:p8183558a.jpg?300|A VLG1021 LCD module with a faulty flex cable}} |
| | The KS0073 controller chip is capable of 4 or 8 bit parallel and SPI style serial interfacing, but in these modules it is hardwired for serial only. The controller is mounted on a PCB and joined to the LCD glass via a PCB flex cable. I think the flex cable is a weak point in the design as some modules display missing columns of pixels (best observed when the contrast is turned right up where upon some characters only show as narrow strips rather than solid blocks - pressure on the cable changes which columns of pixels are displayed). |
| |
| {{:electronic:lcd:p8153507a.jpg?50 |SPI LCD pixel layout}}. | The LCD module has a 10 pin, 1mm pitch, PCB flex cable to connect to a suitable socket. |
| | |
| | The displays are a two lines of twentyfour, 5 by 8 pixel, characters. |
| | {{:electronic:lcd:p8153507a.jpg?50 |VLG1021 LCD pixel layout}}. |
| \\ | \\ |
| \\ | \\ |
| \\ | \\ |
| \\ | \\ |
| ===== Arduino to SPI LCD wiring ===== | |
| |
| The great advantage of these serial SPI LCD modules is the simplicity of the Arduino interface. There are four signal lines SID (data to the display), SOD (responses from the display), SCLK (clock), and CS (select). Plus power (+5V) and ground (the module should also work from a 3.3V supply). | The ks0073 controller chip has two sets of, very similar, instructions available. They are selectable via the Extended Instruction control pin (IE). In the VLGEM1021 modules this appears to be tied "low". I assume that this pin is to allow the chip to emulate either of two previous LCD control chip implementations. |
| | |
| | ===== Arduino to VLG1021 LCD wiring ===== |
| |
| The controller chip is capable of parallel and serial interfacing, but on this module it is hardwired for serial connection. | The great advantage of these serial SPI LCD modules is the simplicity of the Arduino interface. There are four signal lines SID (data to the display), SOD (responses from the display), SCLK (clock), and CS (select). Plus power (+5V) and ground (the module should also work from a 3.3V supply). CS is really only needed if there is more than one display connected to SCLK, SID and SOD, so it could be tied to ground to permanently enable the interface. SOD is mainly used for checking the ready state of the LCD module after each command, if speed isn't crucial then just implementing a wait after each command (about 40uS usually), means you can get away with just using SCLK and SID - so requiring only two Arduino pins for full control of the device. |
| |
| There is a separate power line, VCI, to supply the voltage converter that sets the LCD contrast voltage, around 1.3V was typical. | There is a separate power line, VCI, to supply the voltage converter that sets the LCD contrast voltage, around 1.3V was typical. |
| |
| The data pins can be any available Arduino pins. | The interface pins can be any available Arduino pins. |
| |
| ===== SPI LCD Library ===== | ===== KS0073 LCD Library ===== |
| |
| The KS0073 uses its own variation of a SPI protocol where data and commands are prefixed by a control byte that specifies what the following bytes are going to be - ie read/write data, or a command. | The KS0073 uses its own variation of a SPI protocol where data and commands are prefixed by a control byte that specifies what the following bytes are going to be - ie read/write data, or a command. |
| |
| All bytes are sent least significant bit (LSB) first, on the rising edge of SCLK. The control byte consists of 5 successive "1"s followed by command/data register select (RS) and read/write (R/W) bits. So typically you assert CS and send a control byte indicating a command follows, the the command. If there is data to be sent, send a control byte followed by a stream of data bytes terminated by releasing SS. Both commands and data are split into two nibbles and a prefix of four "0"s is added to each - so there will never be a stream of commands or data containing five successive "1"s. ie to send 00011111, you send 0000 0001 0000 1111. So the KS0073 can always unambiguously re-synchronise to the command stream. | All bytes are sent least significant bit (LSB) first, on the rising edge of SCLK. The control byte consists of 5 successive "1"s followed by read/write (R/W) and command/data register select (RS) bits. The final bit of the control byte is a "0", making a total start sequence of 8 bits. So typically you assert CS and send a control byte indicating a command follows, then the command. If there is data to be sent, send a control byte followed by a stream of data bytes terminated by releasing SS. Both commands and data are split into two nibbles and a prefix of four "0"s is added to each - so there will never be a stream of commands or data containing five successive "1"s. ie to send 00011111, you send 0000 0001 0000 1111. So the KS0073 can always unambiguously re-synchronise to the command stream. |
| | |
| | {{:arduino:ks0073:fig19.png?600|KS0073 data format}} {{:arduino:ks0073:fig20.png?600|KS0073 data stream format}} |
| |
| I used a minimum of 2uS for the clock cycle for SCLK and, as I was not checking the ready status of the chip, a delay of about 40uS between sending bytes to give sufficient time for the chip's internal processing. | I used a minimum of 2uS for the clock cycle for SCLK and, as I was not checking the ready status of the chip, a delay of about 40uS between sending bytes to give sufficient time for the chip's internal processing. |
| |
| |
| As mentioned earlier the library is based on a standard Arduino HD44780 LCD library. Most hardware commands, including programmable characters, seem to be compatible with the HD44780, but I would need to do a lot of experimentation to find any extended commands. | As mentioned earlier the library is based on a standard Arduino HD44780 LCD library. Most hardware commands, including programmable characters, seem to be compatible with the HD44780. There are a number of chip features that are not supported by this driver, such as "Low power mode", "Dot scrolling" (shifting the display window by 1 dot increments), "Bidirectional segment addressing" (horizontal mirroring of display), "4-line mode" (for 4 line displays), "Inverting cursor" and "6-dot font width". This is mainly because I couldn't test them with the VLGEM1021 LCM. |
| |
| The functions implemented are: | The functions implemented are: |
| * noBlink(); | * noBlink(); |
| * Turns the blinking cursor on or off. | * Turns the blinking cursor on or off. |
| | * reverse() |
| | * noReverse() |
| | * Turns on or off reverse video mode (white on black, rather than black on white characters) |
| | * (only works when the ks0073 chip has Extended Instruction (IE) pin tied "high") |
| * setCursor(col, row) | * setCursor(col, row) |
| * Set location for next character to be displayed. | * Set location for next character to be displayed. |
| <a href="/dokuwiki/_detail/electronic/lcd/p8183557a.jpg" class="media"><img width="80%" src="/dokuwiki/_media/electronic/lcd/p8183557a.jpg" class="media" title="KS0073 SPI LCD panel test" alt="KS0073 SPI LCD panel test" /></a> | <a href="/dokuwiki/_detail/electronic/lcd/p8183557a.jpg" class="media"><img width="80%" src="/dokuwiki/_media/electronic/lcd/p8183557a.jpg" class="media" title="KS0073 SPI LCD panel test" alt="KS0073 SPI LCD panel test" /></a> |
| <div class="container"> | <div class="container"> |
| LCD module displaying text output of helloworld.ino program | VLGEM1021-09 LCD module displaying text output of helloworld.ino program |
| </div> | </div> |
| </div> | </div> |
| |
| \\ | \\ |
| The programs (v1.00):\\ | The programs (v1.01):\\ |
| * {{:arduino:ks0073:v1.00:helloworld.ino}}, sketch to test the LCD library | * {{:arduino:ks0073:v1.01:helloworld.ino}}, sketch to test the LCD library |
| * {{:arduino:ks0073:v1.00:liquidcrystal_ks0073.h}}, KS0073 SPI LCD library | * {{:arduino:ks0073:v1.01:liquidcrystal_ks0073.h}}, KS0073 SPI LCD library |
| * {{:arduino:ks0073:v1.00:liquidcrystal_ks0073.cpp}}, KS0073 SPI LCD library | * {{:arduino:ks0073:v1.01:liquidcrystal_ks0073.cpp}}, KS0073 SPI LCD library |
| |
| ====== References and Additional Resources ====== | ====== References and Additional Resources ====== |
| | * {{:electronic:datasheet:samsung:ks0073.pdf|KS0073}} dot matrix LCD driver & controller. |
| |
| ===== Other Arduino LCD drivers ===== | ===== Other Arduino LCD drivers ===== |