programming for HD44780 16x2 OLED?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

hyperion007
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?

Post by hyperion007 »

Hi,

I just want to confirm that you have been using Adafruit's OLED displays?

I have no problems using regular HD44780 LCD displays.

johnsondav
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?

Post by johnsondav »

The LCD's I have been using are almost technically identical to the ones you are using - same controller etc. just by a different trade mark. I have checked to see if they look the same and I cannot see any difference between them. I have downloaded the data sheet for the adafruit LCD to see if the connections are the same. Pins 15 & 16 are not connected on the adafruit but are used for the backlight LED on the LCD displays I am using. Other than that, they are the same controller so they should be controlled in the same way.

Hope this is helpful!

hyperion007
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?

Post by hyperion007 »

Sorry to say, it isn't.

They don't work the same even though they look the same.

Thanks anyway but I will wait for someone from the Matrix staff to take a hard look at it because I cannot figure it out.

dazz
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?

Post by dazz »

Hi
Unless im mistaken(probably am) , according to the data sheet you need the r/w pin connected to check the busy flag, aint got a clue how youd implement it
Its towards the bottom of the arduino c file as well
Regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

johnsondav
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?

Post by johnsondav »

Sorry to here you are having so much trouble with this LCD display, but just to reasure you, don't give up but read on.

The controller is a Hitachi HD44780 LCD controller - no matter who puts their controller onto their parts its still a Hitachi HD44780 LCD controller so will always work the same way.

To get your Western Europe character map, all you need is 4-bit mode by default. Timing is not important! yes, that is what Hitachi say.

Here is a quote from adafruit web site:

"The good news is that not all these pins are necessary for us to connect to the microcontroller (Arduino). RW for example, is not needed if we're only writing to the display (which is the most common thing to do anyways) so we can 'tie' it to ground. There is also a way to talk to the LCD using only 4 data pins instead of 8. This saves us 4 pins! Why would you ever want to use 8 when you could use 4? We're not 100% sure but we think that in some cases its faster to use 8 - it takes twice as long to use 4 - and that speed is important. For us, the speed isn't so important so we'll save some pins!
So to recap, we need 6 pins: RS, EN, D7, D6, D5, and D4 to talk to the LCD."

Here is the web link: http://learn.adafruit.com/character-lcd ... racter-lcd

The tutorial on their web site confirms the wiring as for an Ardunino controller would work just the same for any other controller. Try it.

hyperion007
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?

Post by hyperion007 »

dazz wrote:Hi
Unless im mistaken(probably am) , according to the data sheet you need the r/w pin connected to check the busy flag, aint got a clue how youd implement it
Its towards the bottom of the arduino c file as well
Regards
Dazz
That's correct. It is not an LCD display it is an OLED display. It is similar to the normal HD44780 LCD controller but not the same.
I really don't want to write my own macros for every single line of text or graphics I want to display.

hyperion007
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?

Post by hyperion007 »

So Johnsondav, please read and understand the thread before offering to help. I really do need help with this, and I might not get it if people stopping in for a quick look sees your replies and thinks that you somehow magically solved the problem.

So to make it absolutely clear:

I have NO PROBLEM with a regular character LCD

I DO have problems with the Adafruit OLED display


Thanks anyway.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by Enamul »

OLEDs and VFDs are definitely faster.

A word of caution regarding OLEDs though: The 16x2 OLEDs use a controller that is almost compatible with the common HD44780 LCD controllers. However, the timing and initialization are different and the spec-sheet is largely a work of fiction. Be prepared to do a bit of experimentation when programming it.
other note..
I followed the wiring diagrams for the basic LCD panels, specifically the part where you connect OLED pin 5 (R/W) to ground on the breadboard. I battled with this for a while, but I was finally able to get the display to work by connecting OLED pin 5 to Arduino pin 7.
This assumes you're initializing 6, 7, 8, 9, 10, 11, 12 using the hello world app.
I am planning to order one and have a play with it to investigate the issue :wink:
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by Enamul »

I think that's the code we need to follow which should guide us to solution........

Code: Select all

/*
 Based on the LiquidCrystal Library - Hello World
 
 Demonstrates the use a Winstar 16x2 OLED display.  These are similar, but
 not quite 100% compatible with the Hitachi HD44780 based LCD displays. 
 
 This sketch prints "Hello OLED World" to the LCD
 and shows the time in seconds since startup.
 
  The circuit:
 * LCD RS pin to digital pin 6
 * LCD R/W pin to digital pin 7
 * LCD Enable pin to digital pin 8
 * LCD D4 pin to digital pin 9
 * LCD D5 pin to digital pin 10
 * LCD D6 pin to digital pin 11
 * LCD D7 pin to digital pin 12

 There is no need for the contrast pot as used in the LCD tutorial
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 Library & Example Converted for OLED
 by Bill Earl 30 Jun 2012
 
 This example code is in the public domain.
 */

// include the library code:
#include <Adafruit_CharacterOLED.h>

// initialize the library with the numbers of the interface pins
Adafruit_CharacterOLED lcd(6, 7, 8, 9, 10, 11, 12);

void setup() 
{
    // Print a message to the LCD.
  lcd.begin(16, 2);
  lcd.print("hello OLED World");
}

void loop() 
{
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
 }
Enamul
University of Nottingham
enamul4mm@gmail.com

hyperion007
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?

Post by hyperion007 »

Thank you Enamul!

If you solve this, cosider the OLED paid! (by me if that was unclear :) )


Best of luck
/Daniel S

hyperion007
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?

Post by hyperion007 »

Well I have made some progress.
As you can see in the FC file it is not pretty and would not be very nice nor efficient

That is why I would really like to see a FC component made, or a modification to the existing LCD component. So that I can use component macros instead of doing it this way.

Image
Attachments
PIC18F4550_Adafruit_OLED.fcf
(18.77 KiB) Downloaded 758 times

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by Enamul »

Hi
I have started making a c code for you using your post. It will help you to use the OLED easily in Flowcode. At least before MM releasing anything for OLED.
Enamul
University of Nottingham
enamul4mm@gmail.com

hyperion007
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?

Post by hyperion007 »

GREAT! Thanks!

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by Enamul »

Hi
Don't you like to try 4-bit data bus? Or want to strict into 8-line bus? Busy Flag is essential to check or not?
Enamul
University of Nottingham
enamul4mm@gmail.com

hyperion007
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?

Post by hyperion007 »

I would like to use 4bit data bus but did not know how to do that.

Checking busy flag is very essential if I understand the datasheet correctly. These OLED apparently are very timing sensitive.

dazz
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?

Post by dazz »

Hi enamuel
The arduino file you posted relies on the following two files, i couldnt work out how to convert the waitForReady into flowcode



Adafruit_CharacterOLED.cpp

Code: Select all

// Derived from LiquidCrystal by David Mellis
// With portions adapted from Elco Jacobs OLEDFourBit
// Modified for 4-bit operation of the Winstar 16x2 Character OLED
// By W. Earl for Adafruit - 6/30/12

#include "Adafruit_CharacterOLED.h"

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "Arduino.h"

// On power up, the display is initilaized as:
// 1. Display clear
// 2. Function set:
//    DL="1": 8-bit interface data
//    N="0": 1-line display
//    F="0": 5 x 8 dot character font
// 3. Power turn off
//    PWR=”0”
// 4. Display on/off control: D="0": Display off C="0": Cursor off B="0": Blinking off
// 5. Entry mode set
//    I/D="1": Increment by 1
//    S="0": No shift
// 6. Cursor/Display shift/Mode / Pwr
//    S/C=”0”, R/L=”1”: Shifts cursor position to the right
//    G/C=”0”: Character mode
//    Pwr=”1”: Internal DCDC power on
//
// Note, however, that resetting the Arduino doesn't reset the LCD, so we
// can't assume that its in that state when a sketch starts (and the
// LiquidCrystal constructor is called).

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[i], OUTPUT);
    digitalWrite(_data_pins[i], 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);
}

/********** high level commands, for the user! */
void Adafruit_CharacterOLED::clear()
{
  command(LCD_CLEARDISPLAY);  // clear display, set cursor position to zero
  //  delayMicroseconds(2000);  // this command takes a long time!
}

void Adafruit_CharacterOLED::home()
{
  command(LCD_RETURNHOME);  // set cursor position to zero
  //  delayMicroseconds(2000);  // this command takes a long time!
}

void Adafruit_CharacterOLED::setCursor(uint8_t col, uint8_t row)
{
  uint8_t row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
  if ( row >= _numlines ) 
  {
    row = 0;  //write to first line if out off bounds
  }
  
  command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
}

// Turn the display on/off (quickly)
void Adafruit_CharacterOLED::noDisplay() 
{
  _displaycontrol &= ~LCD_DISPLAYON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void Adafruit_CharacterOLED::display() 
{
  _displaycontrol |= LCD_DISPLAYON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);
}

// Turns the underline cursor on/off
void Adafruit_CharacterOLED::noCursor() 
{
  _displaycontrol &= ~LCD_CURSORON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void Adafruit_CharacterOLED::cursor() 
{
  _displaycontrol |= LCD_CURSORON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);
}

// Turn on and off the blinking cursor
void Adafruit_CharacterOLED::noBlink() 
{
  _displaycontrol &= ~LCD_BLINKON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);
}
void Adafruit_CharacterOLED::blink() 
{
  _displaycontrol |= LCD_BLINKON;
  command(LCD_DISPLAYCONTROL | _displaycontrol);
}

// These commands scroll the display without changing the RAM
void Adafruit_CharacterOLED::scrollDisplayLeft(void) 
{
  command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
}
void Adafruit_CharacterOLED::scrollDisplayRight(void) 
{
  command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
}

// This is for text that flows Left to Right
void Adafruit_CharacterOLED::leftToRight(void) 
{
  _displaymode |= LCD_ENTRYLEFT;
  command(LCD_ENTRYMODESET | _displaymode);
}

// This is for text that flows Right to Left
void Adafruit_CharacterOLED::rightToLeft(void) 
{
  _displaymode &= ~LCD_ENTRYLEFT;
  command(LCD_ENTRYMODESET | _displaymode);
}

// This will 'right justify' text from the cursor
void Adafruit_CharacterOLED::autoscroll(void) 
{
  _displaymode |= LCD_ENTRYSHIFTINCREMENT;
  command(LCD_ENTRYMODESET | _displaymode);
}

// This will 'left justify' text from the cursor
void Adafruit_CharacterOLED::noAutoscroll(void) 
{
  _displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
  command(LCD_ENTRYMODESET | _displaymode);
}

// Allows us to fill the first 8 CGRAM locations
// with custom characters
void Adafruit_CharacterOLED::createChar(uint8_t location, uint8_t charmap[]) 
{
  location &= 0x7; // we only have 8 locations 0-7
  command(LCD_SETCGRAMADDR | (location << 3));
  for (int i=0; i<8; i++) 
  {
    write(charmap[i]);
  }
}

/*********** mid level commands, for sending data/cmds */

inline void Adafruit_CharacterOLED::command(uint8_t value) 
{
  send(value, LOW);
  waitForReady();
}

inline size_t Adafruit_CharacterOLED::write(uint8_t value) 
{
  send(value, HIGH);
  waitForReady();
}

/************ low level data pushing commands **********/

// write either command or data
void Adafruit_CharacterOLED::send(uint8_t value, uint8_t mode) 
{
  digitalWrite(_rs_pin, mode);
  pinMode(_rw_pin, OUTPUT);
  digitalWrite(_rw_pin, LOW);
  
  write4bits(value>>4);
  write4bits(value);
}

void Adafruit_CharacterOLED::pulseEnable(void) 
{
  digitalWrite(_enable_pin, HIGH);
  delayMicroseconds(50);    // Timing Spec?
  digitalWrite(_enable_pin, LOW);
}

void Adafruit_CharacterOLED::write4bits(uint8_t value) 
{
  for (int i = 0; i < 4; i++) 
  {
    pinMode(_data_pins[i], OUTPUT);
    digitalWrite(_data_pins[i], (value >> i) & 0x01);
  }
  delayMicroseconds(50); // Timing spec?
  pulseEnable();
}

// Poll the busy bit until it goes LOW
void Adafruit_CharacterOLED::waitForReady(void) 
{
  unsigned char busy = 1;
  pinMode(_busy_pin, INPUT);
  digitalWrite(_rs_pin, LOW);	
  digitalWrite(_rw_pin, HIGH);      
  do
  {
  	digitalWrite(_enable_pin, LOW);
  	digitalWrite(_enable_pin, HIGH);

  	delayMicroseconds(10);
  	busy = digitalRead(_busy_pin);
  	digitalWrite(_enable_pin, LOW);
  	
  	pulseEnable();		// get remaining 4 bits, which are not used.
  }
  while(busy);
  
  pinMode(_busy_pin, OUTPUT);
  digitalWrite(_rw_pin, LOW);
}

and the following Adafruit_CharacterOLED.h

Code: Select all

#ifndef Adafruit_CharacterOLED_h
#define Adafruit_CharacterOLED_h

#include <inttypes.h>
#include "Print.h"

// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02
#define LCD_ENTRYMODESET 0x04
#define LCD_DISPLAYCONTROL 0x08
#define LCD_CURSORSHIFT 0x10
#define LCD_FUNCTIONSET 0x28
#define LCD_SETCGRAMADDR 0x40
#define LCD_SETDDRAMADDR 0x80

// flags for display entry mode
#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00

// flags for display on/off control
#define LCD_DISPLAYON 0x04
#define LCD_DISPLAYOFF 0x00
#define LCD_CURSORON 0x02
#define LCD_CURSOROFF 0x00
#define LCD_BLINKON 0x01
#define LCD_BLINKOFF 0x00

// flags for display/cursor shift
#define LCD_DISPLAYMOVE 0x08
#define LCD_CURSORMOVE 0x00
#define LCD_MOVERIGHT 0x04
#define LCD_MOVELEFT 0x00

// flags for function set
#define LCD_8BITMODE    0x10
#define LCD_4BITMODE    0x00
#define LCD_JAPANESE    0x00
#define LCD_EUROPEAN_I  0x01
#define LCD_RUSSIAN     0x02
#define LCD_EUROPEAN_II 0x03


class Adafruit_CharacterOLED : public Print {
public:
  Adafruit_CharacterOLED(uint8_t rs, uint8_t rw, uint8_t enable,
		uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
  
  void init(uint8_t rs, uint8_t rw, uint8_t enable,
	    uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
    
  void begin(uint8_t cols, uint8_t rows);

  void clear();
  void home();

  void noDisplay();
  void display();
  void noBlink();
  void blink();
  void noCursor();
  void cursor();
  void scrollDisplayLeft();
  void scrollDisplayRight();
  void leftToRight();
  void rightToLeft();
  void autoscroll();
  void noAutoscroll();

  void createChar(uint8_t, uint8_t[]);
  void setCursor(uint8_t, uint8_t); 
  virtual size_t write(uint8_t);
  void command(uint8_t);
  
private:
  void send(uint8_t, uint8_t);
  void write4bits(uint8_t);
  void pulseEnable();
  void waitForReady();

  uint8_t _rs_pin; // LOW: command.  HIGH: character.
  uint8_t _rw_pin; // LOW: write to LCD.  HIGH: read from LCD.
  uint8_t _enable_pin; // activated by a HIGH pulse.
  uint8_t _busy_pin;   // HIGH means not ready for next command
  uint8_t _data_pins[4];

  uint8_t _displayfunction;
  uint8_t _displaycontrol;
  uint8_t _displaymode;
  uint8_t _initialized;
  uint8_t _currline;
  uint8_t _numlines;
};

#endif

To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

dazz
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?

Post by dazz »

hyperion007 wrote:I would like to use 4bit data bus but did not know how to do that.

Checking busy flag is very essential if I understand the datasheet correctly. These OLED apparently are very timing sensitive.

Hi
I read somewhere on the adafruit forums that instead of reading the check busy flag, which should also mean you dont have to connect the rw pin, you can add a delay and it should work try a 150micro second delay

regards
Dazz
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

hyperion007
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?

Post by hyperion007 »

I think I have tried that but it seems the display needs the R/W pin to go high. Sure you might not need to actually read the busy flag but could instead use a delay but the RW pin does need to be pulled high after data is written to the display.

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by jadiflow »

Has this been resolved?
I have a piece of gear that works flawlessly with a 2x16 Newhaven LCD but when I replace the display with a Newhaven OLED, supposedly identical controller, I can only display anything on the top line - the 2nd line remains blank.
Reading the info here I suspect timing issues, but is there a solution in Flowcode (using FC5)?

Jan

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by jadiflow »

John which display type did you select from the FC5 library for this?
What clock speed is your system running?

Jan

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by jadiflow »

Any more experiences to share with A/N OLED displays? I am using a 16F886 at 4MHz and a 2x16 OLED (NHD-0216KZW-AG5) and only line one shows anything.
The display controller does not hang because that line one can be refreshed and modified normally.
It's just as if there is no line two.
I deselected LVP and connected the lower 4 interface bits to gnd to no avail.

Plugging in a 'regular' backlighted LCD works as it should.
Flowcode 5.

Jan

jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times
Contact:

Re: programming for HD44780 16x2 OLED?

Post by jadiflow »

Have done some more testing on this, with a new Oled display from Winstar.
Still the same issue; it only displays the 1st line, nothing on the 2nd, despite me setting the cursor to various Y values.

Earlier there were some comments here on the requirement for a different init sequence from the 'regular' Flowcode LCD macro. But since the 1st line displays correctly, that does to me NOT seem the problem.
Also, my grounding of W and the unused upper 4 data bits appear not to mess things up.

Does anyone have an idea what could cause the non-display of the 2nd line? I can't get my head around that... :-(

Jan

User avatar
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?

Post by Benj »

Hi Jan,

The memory could be arranged slightly differently on the display you're using. Can you use the print Ascii macro to send a single character to the display again and again. Hopefully before too long you should get the characters appearing on the second line. If not then I can only assume that there is somehow a separate buffer for each line of the LCD which may mean there are two LCD driver chips to control, one for each line of the display.

If you do get characters appearing on the second line then maybe try cursor commands such as 20, 0 or even 40, 0 and see if this makes any difference.

fairbang
Posts: 1
Joined: Sun Sep 02, 2012 9:25 pm
Contact:

Re: programming for HD44780 16x2 OLED?

Post by fairbang »

Hi Benj
I am having this problem as well with no second line of display , is there any solution to this problem , the memory map in the data sheets appears to be identical to the standard 16 x 2 lcd display . I have upgraded to FC7 professional to use the adafruit oled component but I would like to understand why this is happening .

Post Reply