CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Oled Display

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
gtx15



Joined: 19 May 2018
Posts: 27

View user's profile Send private message

Oled Display
PostPosted: Sun Jun 28, 2020 3:47 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jun 28, 2020 4:29 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jun 28, 2020 5:23 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jun 28, 2020 6:53 am     Reply with quote

can you print 'Hello World' onto the screen ?

post your program, might be something 'simple '.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Sun Jun 28, 2020 10:17 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group