programming for HD44780 16x2 OLED?
Moderator: Benj
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
programming for HD44780 16x2 OLED?
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!
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!
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
I don't have a program yet. All my previous experiments have been with a regular LCD displays and the FC LCD component.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
http://www.matrixmultimedia.com/mmforum ... =46&t=9958
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
Here are some Arduino library files for this OLED:
https://github.com/ladyada/Adafruit_CharacterOLED
Maybe that can help?
https://github.com/ladyada/Adafruit_CharacterOLED
Maybe that can help?
-
- Posts: 1314
- Joined: Sun Jan 15, 2012 3:15 pm
- Has thanked: 474 times
- Been thanked: 458 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
This can now be moved to the V5 forum (I have registered for the V5 portion of the forum)
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: programming for HD44780 16x2 OLED?
Hello,
Could you attach your program and describe your hardware setup including oscillator type and speed etc.
Better then nothing, shows there is life in the display yet. Displays are generally awkward things requiring fairly accurate timings.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
Could you attach your program and describe your hardware setup including oscillator type and speed etc.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
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
- Attachments
-
- PIC18F2520_temp_OLED.fcf
- (35.71 KiB) Downloaded 594 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
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
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
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
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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);
}
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);
}
- Attachments
-
- FC5_PIC_LCDDisplay.c
- (13.36 KiB) Downloaded 591 times
-
- PIC18F2520_temp_OLED.fcf
- (41.76 KiB) Downloaded 576 times
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
I haven't made any headway this weekend, still hopelessly stuck
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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?
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
Could anyone please help me out with this? I am getting nowhere
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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
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
Martin
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
-
- Posts: 188
- Joined: Thu Jun 28, 2012 7:29 pm
- Location: Durham
- Has thanked: 86 times
- Been thanked: 186 times
- Contact:
Re: programming for HD44780 16x2 OLED?
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.
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.