| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| arduino:spilcd_driver_library [2018/12/17 07:44] – tony | arduino:spilcd_driver_library [2023/03/12 08:58] (current) – tony |
|---|
| \\ | \\ |
| |
| I have a couple of display panels, one from a [[:electronic:lcd:b53K4631|Brother B53K463-1]] Fax, the other from a [[:electronic:lcd:c7g045|Panasonic KX-T7730]] Phone, that I wish to use in Arduino projects. These are 1 line by 16 character LCD status displays, controlled by a Hitachi HD44780 compatible LCD controller/driver chip that uses an SPI serial interface. | I have a couple of display panels, one from a [[:electronic:lcd:b53K4631|Brother Fax-645]], the other from a [[:electronic:lcd:c7g045|Panasonic KX-T7730]] Phone, that I wish to use in Arduino projects. These are 1 line by 16 character LCD status displays, controlled by a Hitachi HD44780 compatible LCD controller/driver chip that uses an SPI serial interface. |
| <HTML> | <HTML> |
| <div class="shadows" style="text-align:center"> | <div class="shadows" style="text-align:center"> |
| <a href="/dokuwiki/_detail//electronic/lcd/p8250907a.jpg" class="media"><img width="45%" src="/dokuwiki/_media//electronic/lcd/p8250907a.jpg" class="media" title="SPI LCD" alt="SPI LCD" /></a> <a href="/dokuwiki/_detail/arduino/spilcd/pc143172a.jpg" class="media"><img width="45%" src="/dokuwiki/_media/arduino/spilcd/pc143172a.jpg" class="media" title=SPI LCD" alt="SPI LCD" /></a> | <a href="/dokuwiki/_detail//electronic/lcd/p8250907a.jpg" class="media"><img width="45%" src="/dokuwiki/_media//electronic/lcd/p8250907a.jpg" class="media" title="Panasonic KX-T7730" alt="Panasonic KX-T7730" /></a> <a href="/dokuwiki/_detail/arduino/spilcd/pc143172a.jpg" class="media"><img width="33%" src="/dokuwiki/_media/arduino/spilcd/pc143172a.jpg" class="media" title="Brother Fax-645" alt="Brother Fax-645" /></a> |
| <div class="container"> | <div class="container"> |
| <a href="/dokuwiki/electronic/lcd/dzyc0543">SPI LCD panels that use a Hitachi HD44780 compatible controller</a> | <a href="/dokuwiki/electronic/lcd/c7g045">SPI LCD panels that use a Hitachi HD44780 compatible controller</a><br> |
| | <a href="/dokuwiki/electronic/lcd/b53K4631">SPI LCD panels that use a Hitachi HD44780 compatible controller</a> |
| </div> | </div> |
| </div> | </div> |
| I based my library module for this on a standard Arduino library for the Hitachi HD44780 chip, LiquidCrystal.cpp. The programs included here are HelloWorld_SPI.ino, LiquidCrystal_SPI.cpp and LiquidCrystal_SPI.h. | I based my library module for this on a standard Arduino library for the Hitachi HD44780 chip, LiquidCrystal.cpp. The programs included here are HelloWorld_SPI.ino, LiquidCrystal_SPI.cpp and LiquidCrystal_SPI.h. |
| |
| The command set is compatible with the Hitachi HD44780, but I don't know the model of the chip, or even the manufacturer. | The command set is compatible with the Hitachi HD44780, but I don't know the model of the chip, or even the manufacturer. |
| |
| ===== Hardware description ===== | ===== Hardware description ===== |
| |
| The controller is mounted directly on the LCD glass, and the LCD module has a 6 pin, 1mm pitch, pcb flex cable. The displays are a single line of sixteen, 5 by 8 pixel, characters. | The controller is mounted directly on the LCD glass, and the LCD module has a 6 pin, 1mm pitch, PCB flex cable. The displays are a single line of sixteen, 5 by 8 pixel, characters. |
| |
| {{:arduino:spilcd:pc173298a.jpg?50 |SPI LCD pixel layout}}The two modules have different character sets, but the characters in common tend to have exactly the same font design, so they may have the same manufacturer. I experimented a little, but could not get either board to display an 5 by 11 character mode. | {{:arduino:spilcd:pc173298a.jpg?50 |SPI LCD pixel layout}}The two modules have different character sets, but the characters in common tend to have exactly the same font design, so they may have the same manufacturer. I experimented a little, but could not get either module to display an 5 by 11 character mode. |
| \\ | \\ |
| \\ | \\ |
| There is no "busy" pin, so delays between commands are necessary to give sufficient time for internal processing. | There is no "busy" pin, so delays between commands are necessary to give sufficient time for internal processing. |
| |
| There was no contrast adjustment on these boards (may be a command programmable feature). | There was no contrast adjustment on these modules (maybe a command programmable feature). |
| |
| The data pins can be any available Arduino pins. | The data pins can be any available Arduino pins. |
| |
| ===== SPI LCD Library ===== | ===== SPI LCD library ===== |
| |
| 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, but I would need to do a lot of experimentation to find any extended commands. |
| | |
| The functions appear to be the same as for the HD44780 but have not been extensively tested for compatibility. | The functions appear to be the same as for the HD44780 but have not been extensively tested for compatibility. |
| There didn't seem to be any need for 4/8 bit interface selection. It is conceivable that the display controller chip might support 4/8 bit parallel modes (just not brought out to pins), but no account of this possibility is included in this driver. So initialisation is simplified. | There didn't seem to be any need for 4/8 bit interface selection. It is conceivable that the display controller chip might support 4/8 bit modes, but no account of this possibility is included in this driver. So initialisation is simplified. |
| |
| When writing data to be displayed on the LCD screen it would be more efficient to assert SS, send a positioning command and then a stream of bytes, and de-assert SS when complete. But this driver has a, print.h library compatible, single character output routine, 'write', which is used to output one character at a time, each preceded by a display-on command. | When writing data to be displayed on the LCD screen it would be more efficient to assert SS, send a positioning command and then a stream of bytes, and de-assert SS when complete. But this driver has a, print.h library compatible, single-character output routine, 'write', which is used to output one character at a time, each preceded by a display-on command. |
| |
| The original firmware sent an extra code, 0xf8, during startup. On a HD44780 chip this would just be a cursor positioning command (to set data cursor to location 0x78), but this would not be a displayable location, and no data is sent to be displayed. It appears that this may be a reset or other initialisation command. | The original firmware sent an extra code, 0xf8, during startup. On an HD44780 chip this would just be a cursor positioning command (to set data cursor to location 0x78), but this would not be a displayable location, and no data is sent to be displayed. It appears that this may be a reset or other initialisation command. |
| |
| I finally realised why I sometimes had trouble setting the programmable characters (only 4 available on these chips) - after setting a programmable character future writes also go to the programmable character CGRAM (corrupting it) until you deliberately switch back to the display ram. This is a problem from the original LiquidCrystal.h library - the solution here is that it just resets the cursor to the home location after programming characters. | I finally realised why I sometimes had trouble setting the programmable characters (only 4 available on these chips) - after setting a programmable character future writes also go to the programmable character CGRAM (corrupting it) until you deliberately switch back to the display ram. This is a problem from the original LiquidCrystal.h library - the solution here is that I just reset the cursor to the home location after programming characters. |
| \\ | \\ |
| \\ | \\ |
| <a href="/dokuwiki/_detail/arduino/spilcd/pc173301a.jpg" class="media"><img width="80%" src="/dokuwiki/_media/arduino/spilcd/pc173301a.jpg" class="media" title="SPI LCD panel test" alt="SPI LCD panel test" /></a> | <a href="/dokuwiki/_detail/arduino/spilcd/pc173301a.jpg" class="media"><img width="80%" src="/dokuwiki/_media/arduino/spilcd/pc173301a.jpg" class="media" title="SPI LCD panel test" alt="SPI LCD panel test" /></a> |
| <div class="container"> | <div class="container"> |
| LCD module displaying text output of LCD_test.ino program | LCD module displaying text output of helloWorld_SPI.ino program |
| </div> | </div> |
| </div> | </div> |
| | |
| * [[https://playground.arduino.cc/Code/LCD|Arduino LCD display drivers]] | * [[https://playground.arduino.cc/Code/LCD|Arduino LCD display drivers]] |
| |
| * [[https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home|New LiquidCrystal]] | * [[https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home|New LiquidCrystal]] |
| |
| * [[https://github.com/adafruit/Adafruit-RGB-LCD-Shield-Library/blob/master/Adafruit_RGBLCDShield.cpp|Adafruit RGB LCD Shield-Library | * [[https://github.com/adafruit/Adafruit-RGB-LCD-Shield-Library/blob/master/Adafruit_RGBLCDShield.cpp|Adafruit RGB LCD Shield-Library |
| ]]. | ]]. |
| |
| | * [[:arduino:ks0073 driver library|KS0073 SPI LCD]], LCD display panel Arduino driver |
| * [[:arduino:metp0000 driver library|METP0000]], NEC µPD7225 based LCD display panel Arduino driver | * [[:arduino:metp0000 driver library|METP0000]], NEC µPD7225 based LCD display panel Arduino driver |
| | * [[:arduino:mx300 driver library|Canon MX300]], Canon MX300/310 printer LCD display panel Arduino driver. |
| * [[:arduino:uPD7228 driver library|NEC µPD7228]] and μPD16434 LCD display panels Arduino driver | * [[:arduino:uPD7228 driver library|NEC µPD7228]] and μPD16434 LCD display panels Arduino driver |
| |
| * [[:arduino:t6a34 driver library|Toshiba T6A34]] SPI, HD44780 compatible, LCD display panel Arduino driver | * [[:arduino:t6a34 driver library|Toshiba T6A34]] SPI, HD44780 compatible, LCD display panel Arduino driver |
| |