Author Topic: Arduino demo code for running the NHD-0420DZW-AB5 OLED display via SPI  (Read 3875 times)

llamero

  • Newbie
  • *
  • Posts: 1
  • Karma: 1
    • View Profile
I worked out a few functions that allow the NHD-0420DZW-AB5 OLED display to be controlled via SPI on an Arduino.  The catch is that the 2-bit RsRW header means that communication requires bitbanging rather than using the SPI library, since the SPI library can only send 8-bit blocks.

The demo code will initialize the display, load up a splash screen, and then show animated arrows.  The CS pin is pin 9, and all the other pins are the standard SPI pins.  One note, bitbanging is much slower than the built in SPI bus (2MHz vs 20MHz), so you can use SPI.end() and SPI.begin() to toggle the SPI bus off and on (the SPI bus has to be off to allow the bitbanging function to work, and on to allow the SPI library to work).

The code can be found at: https://github.com/Llamero/OLED_Display_Demo/blob/master/Minimal_display_code/Minimal_display_code.ino

If anyone has improvements, please feel free to create a fork.

Cheers,
  Ben Smith
« Last Edit: February 14, 2018, 07:11:46 PM by llamero »

Ted_M

  • Administrator
  • Full Member
  • *****
  • Posts: 109
  • Karma: 4
    • View Profile
Thanks for submitting your example code!  This is very helpful.

 

Blank Display on NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM

Started by SteveCBoard Character LCDs

Replies: 3
Views: 10172
Last post May 13, 2014, 12:04:36 AM
by SteveC
Display NHD-4.3-480272EF-ASXN#-T and NHD-4.3-480272EF-ASXN#-T revA

Started by rvalorBoard TFTs

Replies: 1
Views: 398
Last post April 25, 2019, 03:35:10 PM
by Ted_M
NHD‐C12864A1Z‐FSW‐FBW‐HTT display clears after draw

Started by EdAverillBoard Graphic LCDs

Replies: 6
Views: 12227
Last post November 07, 2014, 08:25:20 AM
by Michael_L
NHD‐4.3‐480272EF‐ATXL#‐CTP | FAN5333 | BBB | Nothing on the Display

Started by Alias_AliasBoard TFTs

Replies: 1
Views: 8899
Last post September 25, 2015, 03:09:24 PM
by Paul_B
NHD-C0220BiZ Sometimes Ignoring "Clear Display" Command

Started by dstoverBoard Character LCDs

Replies: 2
Views: 7532
Last post March 27, 2014, 05:41:27 PM
by Michael_L