This page is about implementing a serial bit-bang protocol to control a Newhaven Display International OLED character display.
OLED (Organic Light Emitting Diode) displays offer wider viewing angles, improved brightness and contrast, and are self-illuminating (require no backlight). Newhaven offers several models of OLED display that use the same version of built-in controller. The built-in controller offers both serial and a 6800/8080 compatible parallel interface.
The application example mates a dsPIC33FJ256GP710-I/PT with a Newhaven OLED. The embedded software implements a simple serial bit-bang protocol to control the OLED and display a message.
While this example implementation uses the dsPIC33FJ256GP710-I/PT, it is easily adapted to other Microchip microcontrollers by making device appropriate pin assignments. The source code could also be used as a reference or ported to other manufacturers microcontroller products.
The Newhaven OLED displays listed in Tables 1 and 2 utilize the same version of built-in controller. The demonstration source code and accompanying program file can be used without modification to drive the OLED displays listed in Table 1.
Additionally, the Newhaven OLED displays listed in Table 2 are compatible with the embedded source code. These displays have additional characters on a line, or additional lines and characters, and can be successfully driven with minor changes to the embedded source code.
|NHD-0216SZW-BY5||2 line x 16 character, yellow|
2 line x 16 character, green
2 line x 16 character, blue
2 line x 16 character, yellow
2 line x 16 character, green
The hardware used in this example is a Newhaven 2x16 OLED character display and the Microchip Explorer 16 DM240001-ND (requires an ICD3 or other programmer/debugger) or DV164037-ND development board with the included Microchip dsPIC33FJ256GP710-I/PT Processor Installation Module (PIM). The Prototype PICtail Plus Daughter Board AC164126-ND is used to access the port pins brought out on the Explorer 16 board.
By default, all of the displays listed in Tables 1 and 2 support the 6800 MPU parallel interface*. Jumper settings are provided in the product data sheet to configure a display to support the 6800 MPU, 8080 MPU, or a serial interface. Any changes to the jumper connection will require a soldering iron and repositioning/omitting 0 ohm resistors. The photo's in table 3 clarify the jumper locations on each PCB. Each photo is applicable to multiple displays indicated in the adjoining list of part numbers.
Table 3. Jumper Locations
* Newhaven will build-to-suit displays configured for serial or 8080 parallel interface. Minimum order quantities will apply. To start the process send an email to email@example.com.
The default build supports a 2x16 display, but any of the displays will actually work with the code built as-is with limitations - the additional characters and lines available in the other display variants will be blank. Preprocessor directives provide conditional compilation of particular lines of code to accommodate the display variants with messages that take advantage of the available lines and characters.
ZIP file with demonstration source code and hex file can be found at project (this is an MPLAB X project). Hex file can be found in folder ".../NHD_OLED_bitbang/NHD_OLED_BB.X/dis/default/production/NHD_OLED_BB.X.production.hex".
To build for a particular display comment/uncomment the appropriate prepocessor directive in file nhd_oled_2x16_main_bb.c:
The source code displays a message that utilizes the built-in font table and also the custom character capability of the display. The message displayed, depending upon line count and length:
Clock frequency of the dsPIC33FJ is configured for 7.37Mhz. A different clock frequency will necessitate a change to the software based time delay routine. Port pins are assigned as follows: RA4 – LCD select, RF6 – Serial clock, RF7 – Serial data in (data from LCD – this is not implemented), and RF8 – Serial data out (data to LCD).
Expand/copy zip file NHD_OLED_bitbang.zip to desired system location. Open MPLAB X IDE, connect the hardware to your computer, and open project "NHD_OLED_BB". Open the project properties to verify hardware and software tool selection matches your installation. Make and Program device.
Newhaven App Note; Serial vs. Parallel Interface
This webpage is a project started and maintained by the applications engineering staff at Digi-Key. It is one way we provide complementary support to engineers, hobbyists, entrepreneurs, and other tech minded folks to assist you with your work. In many ways adding content to this website is the best part of our job, but it isn't our only job. We want to continue to develop and expand the eewiki, and you can help us justify our efforts by letting us know if you have used any of our content to help you use or select Digi-Key products. Additionally, we welcome comments, feedback, suggestions, and questions. Just send an email to firstname.lastname@example.org. To address any questions or comments to a specific author, mention the author in the subject line.
Also, if the product you are designing meets certain criteria, we may be able to send you engineering samples.