View previous topic :: View next topic |
Author |
Message |
gtx15
Joined: 19 May 2018 Posts: 27
|
Oled Display |
Posted: Sun Jun 28, 2020 3:47 am |
|
|
I replaced a 2x20 LCD HD44780 chipset with this "NHD-0420CW" 4X20 Oled Display. Im able to initialize it and writes to it works, problem is goto x,y and /n carriage returns do nothing. I'm using the flex_lcd.c Driver in 4 bit mode. any help would be great. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sun Jun 28, 2020 4:29 am |
|
|
quick reply.....
I've used versions of the 'flex' driver for years on the common 20x4 LCD modules without problems , so I downloaded a datasheet for yours.
It's a more powerful module so you need to properly configure all the LCD pins to '4 bit parallel' mode. There's a chart on page 5 for that.
Also you'll NEED to change the access to the DDRAM !! There's a chart on page 6 and it's TOTALLY different than the 'common 20x4' LCD modules.
The DDRAM is where the characters get stored to be seen on the screen.
I suggest you copy the 'flex' driver to say 'NHD_0420flex.c" THEN edit the NHD_flex.c code for the proper DDRAM assignments. Do NOT edit 'flex.c' otherwise when you use a 'regular' LCD it won't work !!!
In the driver you'll need to edit these lines...
// These are the line addresses for most 4x20 LCDs.
#define LCD_LINE_1_ADDRESS 0x00
#define LCD_LINE_2_ADDRESS 0x40
#define LCD_LINE_3_ADDRESS 0x14
#define LCD_LINE_4_ADDRESS 0x54 |
|
|
gtx15
Joined: 19 May 2018 Posts: 27
|
|
Posted: Sun Jun 28, 2020 5:23 am |
|
|
I saw that and have changed them to 0x00, 0x20, ox40, and 0x60 . Seems to have no effect. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sun Jun 28, 2020 6:53 am |
|
|
can you print 'Hello World' onto the screen ?
post your program, might be something 'simple '.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19496
|
|
Posted: Sun Jun 28, 2020 10:17 am |
|
|
If you look, the addresses are the same as given in the flex driver
for the Hitachi chipset:
Quote: |
// These are the line addresses for LCD's which use
// the Hitachi HD66712U controller chip.
/*
#define LCD_LINE_1_ADDRESS 0x00
#define LCD_LINE_2_ADDRESS 0x20
#define LCD_LINE_3_ADDRESS 0x40
#define LCD_LINE_4_ADDRESS 0x60
|
Question. Are you using the R/W pin?. I can potentially see problems if
you are not...
The data sheet for the OLED, does not give times for any of the actual
operations. It'd only take one of these to be slower than the default
times, and the driver then won't work correctly without R/W.
The 'example' code has 1mSec delays after every transfer!. Suggests
the controller may be significantly slower than the standard LCD one.
Update. You need to call the extended function set command with
NW=1, to work in four line mode. This is an extra command for the
OLED. Also gives the ability to invert the cursor and choose a different
font. The default for this is off, so you don't actually have four line
operation.
The 'standard' 4 line controller is actually 2*2 line contgrollers used
together. This controller is aq 'close emulation', but wakes up as a
two line controller, and has to be programmed to be a 4 line unit. |
|
|
|