Page 1 of 2
programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 10:55 am
by hyperion007
Hi,
I got a almost HD44780 compatible OLED 16x2 display from Adafruit:
http://www.adafruit.com/products/823
But I have not been able to get it to work, I simply don't know how.
The datasheet for it can be found here:
http://www.adafruit.com/datasheets/WS0010.pdf
Anyone up for the challenge? This display is WAY better than any LCD I have ever seen. Looks amazing!
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 11:05 am
by Benj
Hello,
Yes that display looks great. What programming language are you using and which microcontroller series? If you attach your program so far and describe your hardware setup then we should be able to help.
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 11:17 am
by hyperion007
Ah sorry. I am using PIC18F2520 and PIC18F4550 and Flowcode V5
I don't have a program yet. All my previous experiments have been with a regular LCD displays and the FC LCD component.
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 12:06 pm
by Benj
Hello,
There is a schematic you can use at the end of this datasheet.
http://www.matrixmultimedia.com/resourc ... .php?id=82
You may need to supply additional power to the back light pins if available.
Then let us know what pins you are using, which oscillator you are using and the frequency of the oscillator and making a example program should be straightforward.
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 12:34 pm
by hyperion007
Hi,
The wiring isn't the problem. It's all covered in this PDF:
http://www.adafruit.com/datasheets/WEH1602.pdf
I am using a 20MHz Crystal/oscillator
I want to use 8-bit interface because if I have understood the datasheet there are limitations if I want to use 4-bit interface.
Also, the R/W pin on the display needs to be programmed in FC. The regular FC LCD component only has provisions for the R/S pin and with a regular LCD you just wire the R/W pin on the display to ground.
edit: for PIC18F2520 I want to use port RC 0:3 and RB 2:7 for the OLED
for PIC18F4550 I don't care which ports are used as long as it's not the USB ports.
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 3:53 pm
by Benj
Please can you sign up for the Flowcode forum topic and I will provide an example for you.
http://www.matrixmultimedia.com/mmforum ... =46&t=9958
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 5:09 pm
by hyperion007
Sorry, can't
I am not allowed to by my teacher (don't ask me why, there was no logical explanation given and no point arguing

)
If I had the funds I would buy FC V5 my self but as a starving student I can't right now.
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 01, 2013 11:26 pm
by hyperion007
Here are some Arduino library files for this OLED:
https://github.com/ladyada/Adafruit_CharacterOLED
Maybe that can help?
Re: programming for HD44780 16x2 OLED?
Posted: Sat Feb 02, 2013 12:01 am
by dazz
hyperion007 wrote:Sorry, can't
I am not allowed to by my teacher (don't ask me why, there was no logical explanation given and no point arguing

)
If I had the funds I would buy FC V5 my self but as a starving student I can't right now.
Hi Hyperion007
can you Pm Davida or benj as they may be able to sort out access to the V5 forums
Regards
Dazz
Re: programming for HD44780 16x2 OLED?
Posted: Sat Feb 02, 2013 7:35 am
by hyperion007
Sure I could PM them, but what good would that do?
Re: programming for HD44780 16x2 OLED?
Posted: Tue Feb 05, 2013 7:36 am
by hyperion007
This can now be moved to the V5 forum (I have registered for the V5 portion of the forum)
Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 07, 2013 11:53 am
by hyperion007
I managed to get the display to print one strange character once, it wasn't the character I tried to print, but after that it won't display anything

Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 07, 2013 11:57 am
by Benj
Hello,
I managed to get the display to print one strange character once, it wasn't the character I tried to print, but after that it won't display anything

Better then nothing, shows there is life in the display yet. Displays are generally awkward things requiring fairly accurate timings.
Could you attach your program and describe your hardware setup including oscillator type and speed etc.
Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 07, 2013 12:08 pm
by hyperion007
I am using a PIC18F2520 with a 20Mhz oscillator
I have tried many different things in the macro "OLED_INIT" and this is the latest attempt and it isn't working.
I have the DB[0:7] of the display connected to RC[0:7] on the PIC
Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 07, 2013 12:51 pm
by Benj
Hello,
It looks like the display should be compatible with the standard alphanumeric LCDs used by the Flowcode LCD component.
Have a look at the datasheet for the EB005 if you require details for connecting to the microcontroller.
You can then use the functions for the standard LCD component in Flowcode rather then trying to drive the display directly.
There should be topics regarding using 8-bit data mode with the LCD on the forums if you need 8-bit data mode. For most applications 4-bit mode works a treat and saves you 4 I/O pins to use for other purposes.
In your configuration settings disable the following settings:
extended CPU
Low voltage program
Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 07, 2013 1:54 pm
by hyperion007
Hi Ben,
Are you sure about it being compatible with the standard LCD component? because I have tried that and it didn't work at all.
the R/W pin on the display needs to be programmed in FC. The regular FC LCD component only has provisions for the R/S pin and with a regular LCD you just wire the R/W pin on the display to ground.
Also, if I have understood the datasheet correctly, I need to use 8-bit interface in order to use the Western Europe character map.
Anyway, with the regular LCD component in FC I cannot get the display to show anything.
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 08, 2013 10:43 am
by LeighM
Hi
I also have had a quick look and agree with Ben that it looks from the datasheets that you should be able to use the Flowcode LCD component with a little customisation.
The 4 bit data mode plus RS and E should work.
You will need to customise the Start macro as the commands are different.
Have a look at the 4 bit initialisation sequence in the datasheet.
I think you will need something like ..
0x32, 0x28, 0x0c, 0x06, 0x02, 0x01
Hope that helps
Leigh
Re: programming for HD44780 16x2 OLED?
Posted: Fri Feb 08, 2013 11:12 am
by hyperion007
I tried changing the FC5_PIC_LCDDisplay.c but It didn't work
I also tried increasing the delays to 5 and 50ms like so:
RawSend(0x32, 0);
Wdt_Delay_Ms(5);
RawSend(0x28, 0);
Wdt_Delay_Ms(5);
RawSend(0x0c, 0);
Wdt_Delay_Ms(5);
RawSend(0x01, 0);
Wdt_Delay_Ms(5);
RawSend(0x06, 0);
Wdt_Delay_Ms(5);
//clear the display
RawSend(0x01, 0);
Wdt_Delay_Ms(5);
RawSend(0x02, 0);
Wdt_Delay_Ms(5);
But that didn't do anything either.
I did get some sort of strange character after I programmed the chip the first time. with the above changes to the component, but with standard 2ms delays. but after a power cycle it didn't show anything on the display.
I have attached the modified component file and my FC file.
From the adafruit website where they have their libraries etc. I can see stuff like:
Adafruit_CharacterOLED::Adafruit_CharacterOLED(uint8_t rs, uint8_t rw, uint8_t enable,
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
init(rs, rw, enable, d4, d5, d6, d7);
}
void Adafruit_CharacterOLED::init(uint8_t rs, uint8_t rw, uint8_t enable,
uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
{
_rs_pin = rs;
_rw_pin = rw;
_enable_pin = enable;
_data_pins[0] = d4;
_data_pins[1] = d5;
_data_pins[2] = d6;
_data_pins[3] = _busy_pin = d7;
pinMode(_rs_pin, OUTPUT);
pinMode(_rw_pin, OUTPUT);
pinMode(_enable_pin, OUTPUT);
_displayfunction = LCD_FUNCTIONSET | LCD_4BITMODE;
begin(16, 2);
}
void Adafruit_CharacterOLED::begin(uint8_t cols, uint8_t lines)
{
_numlines = lines;
_currline = 0;
pinMode(_rs_pin, OUTPUT);
pinMode(_rw_pin, OUTPUT);
pinMode(_enable_pin, OUTPUT);
digitalWrite(_rs_pin, LOW);
digitalWrite(_enable_pin, LOW);
digitalWrite(_rw_pin, LOW);
delayMicroseconds(50000); // give it some time to power up
// Now we pull both RS and R/W low to begin commands
for (int i = 0; i < 4; i++) {
pinMode(_data_pins, OUTPUT);
digitalWrite(_data_pins, LOW);
}
// Initialization sequence is not quite as documented by Winstar.
// Documented sequence only works on initial power-up. An additional
// step is required to handle a warm-restart.
//
// In the data sheet, the timing specs are all zeros(!). These have been tested to
// reliably handle both warm & cold starts
//
write4bits(0x03); // Missing step from doc. Thanks to Elco Jacobs
delayMicroseconds(5000);
write4bits(0x02);
delayMicroseconds(5000);
write4bits(0x02);
delayMicroseconds(5000);
write4bits(0x08);
delayMicroseconds(5000);
command(0x08); // Turn Off
delayMicroseconds(5000);
command(0x01); // Clear Display
delayMicroseconds(5000);
command(0x06); // Set Entry Mode
delayMicroseconds(5000);
command(0x02); // Home Cursor
delayMicroseconds(5000);
command(0x0C); // Turn On - enable cursor & blink
delayMicroseconds(5000);
}
Re: programming for HD44780 16x2 OLED?
Posted: Mon Feb 11, 2013 11:29 am
by hyperion007
I haven't made any headway this weekend, still hopelessly stuck

Re: programming for HD44780 16x2 OLED?
Posted: Tue Feb 12, 2013 8:32 am
by hyperion007
I am willing to send you one of these displays if that would help? Maybe it then can be included as a component in FC v6?
Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 14, 2013 8:31 am
by hyperion007
Could anyone please help me out with this? I am getting nowhere

Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 14, 2013 10:53 am
by medelec35
Hi hyperion007,
Can you please disable Low Voltage Programming and Extended CPU Enable, then post results.
With correct correct configuration settings, there maybe more of a chance we can get your display to work.
Martin
Re: programming for HD44780 16x2 OLED?
Posted: Thu Feb 14, 2013 12:25 pm
by hyperion007
Hi Martin,
I see that I forgot to mention that I have disabled LVP and Extended CPU Enable but it didn't change anything, still nothing on the display.
Re: programming for HD44780 16x2 OLED?
Posted: Wed Feb 20, 2013 11:04 am
by hyperion007
No one wants to take a stab at this?
Re: programming for HD44780 16x2 OLED?
Posted: Wed Feb 20, 2013 9:54 pm
by johnsondav
Hi.
I've been using these LCD's for some time now for my projects and they work great without any MOd's within Flowcode V5. Just remember to do the following:
Connect the D0; D1; D2; D3 pins on the LCD to GND
BIT 0 from the PIC (from which ever port) goes to D4 on the LCD
BIT1 to D5 on the LCD
BIT2 to D6 on the LCD
BIT 3 to D7 on the LCD
Your LCD should now work okay.
