- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have been working with PSoC4 for some time, driving a standard 2 line by 16 char LCD display, using the Character LCD Component which contains routines for the Hitachi 44780 interface. This works perfectly, with no problems.
I have now bought an OLED character display from Winstar, model WEH002002ACPP5N00001, which is a 2 line by 20 char display. This has the same pins as the LCD module, and when I hook it up and use the same code as for LCD, it ALMOST works. It displays the output, but all on one line and with line wrapped to the wrong position. So clearly it is not far from working properly.
In spite of much searching through the datasheet I cannot fathom how to get it to work fully. Does anyone know of code that has been written for such OLED displays, or how the Character LCD Component code could be modified to work with this display ?
I should mention that on the web I have seen comments that the Hitachi HD44780 controller and the Winstar OLED Controller are VERY close. Also, I have come across comments about various jumpers on the module board that can be moved to set it up for different operation modes, but am reluctant to start experimenting with these without knowing what I'm doing.
If anyone can offer advice I will be very grateful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cannot get a link to a datasheet for WEH002002ACPP5N00001, canyou provide one,please.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
My apologies; I should have included this in the previous post.
Here is a link via the supplier:
http://www.rapidonline.com/electronic-components/20x2-oled-display-yellow-57-2300
Go to the above, and click on the Technical Specification PDF Icon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The 2nd line is off set by 40hex, So add a 40 hex offset to each character you send. Also do not over write the registers or you will get strange displays do not write more that 20 characters to any line as this will cause an unknowned response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for reply, but I still have problems.
For example, here is the piece of code that is pertinent to display:
LCD_Start();
while(1u) // Loops forever
LCD_ClearDisplay();
LCD_PrintString("String");
CyDelay(20u);
This prints to first line of display:
StringStringStringString.... continuously scrolling
This suggests that the API commands LCD_ClearDisplay and/or LCD_Start
are not correct for the OLED.
To print on the second line, You suggest adding 40 hex (0x40) to each character.
How would I do that in the above example?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
StringStringStringString.... continuously scrolling
You have to reposition cursor when you do a write using API.
If you write 'String" to location 0 then the cursor now becomes
= 6, so the next write occurs there. Repositioning the cursor
to column 0 will cause the looping writes to overwrite the last
write. Which in this case is correct approach.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We have seen here some timing issues with some of the LCD-controllers that are compatible to the Hitachi modell. So please check that when things are not working.
There is an option in the component to suppress re-generating the c-code, switch it on to avoid overwriting of your changes made.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for reply, but I still have problems.
I have done as you suggest Dana, so my code is now:
LCD_Start();
while(1u) // Loops forever
LCD_ClearDisplay();
LCD_Position(0, 0);
LCD_PrintString("String");
CyDelay(20u);
Result is as before:
StringStringStringString.... continuously scrolling
Regarding timing, I have edited the LCD.c file to greatly increase every CyDelay value.
I have compiled the file, and then run Build again.
Result is unchanged, as above.
So, something is still not right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the display controller Hitachi/Renesas 44780 compatible ? Datasheet
does not indicate that.
The clear display command takes 6.2 mS to execute, maybe give a wait
to that, also a wait after you start the module, experiment with this.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I can gather, the OLED controller is NEARLY 447880 compatible.
But that is part of my problem -- I don't know where the differences are,
and where I do find differences, I don't know if they matter, and I don't know
how to edit the LCD.c file to allow for differences.
I guess I was hoping that someone might have been down this route already, and
would be able to say what code changes are required, or might even have written
API code for OLEDs. I'm afraid my own C skills are rudimentary.
I have tried inserting waits as you suggest, but result is same as before.
Regards, Ken.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lets see your program so we can look at it and also include the data sheet for your LCD device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also move your Display routine out side of the for loop. The way it is written now you are banging it to the LCD over and over again that is why is prints String String and STring over and over again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@bobgoar, one should be able to write repeatedly to the
same location a string, by repositioning cursor each time
before the write.
So something is is still very wacky at a basic level.
Maybe try a delay after cursor positioning, but simply ploping in delays does not
make a designer feel secure that he actually understands the problem cause at
hand.
Ken, this is an aside for after you get display running. I have used char displays
in loops before and depending on write rate can get some "artifacts" appearing
in display that may it look low quality. A way around this is to create a display
buffer in ram, in your case MyDisBuff[ 2 ][ 21 ], and when you go to write do a char
for char comparison of the buffer with the string, and if any char has changed,
update buff and write that char to display, if not then do nothing. This will only write
changed chars to display, and virtually eliminates artifacts.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have attached the zip file for the whole design, made with Create Workspace Bundle.
I hope this is what you require.
I have set my code back to be correct for driving the LCD, and checked it works correctly.
Note that all this is a work in progress, so much of my code is far from optimal at present.
Also of course if you try to use it nothing will work without the oscillator circuit!
But the display should be OK, although displayed values will be meaningless.
The display routine is inside the main loop because the frequency and voltage displayed
can and does change at any time. I do realise that some parts, such as the "Freq: " string
can be outside the loop -- I intend to fix this later.
I have also attached the LCD datasheet. This is for an 8 char by 1 row display, but it is
essentially the same as for my 16 char by 2 row LCD.
Many thanks, regards, Ken.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have just clocked your latest reply Dana.
I have not noticed any unwanted artifacts with the LCD display, but
your comment about using a buffer so that I only write characters that
have changed seems like a much more efficient way of driving the display.
So I will certainly try that when I get to the "optimising phase" later
in the project.
Many thanks, Ken.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you look at section 15.2 in datasheet there are delays needed.
You might check the code generated for the LCD module to see
what delays the Cypress code does.
Another quick check is get your hands on a 44780 declared compatible
LCD, just to check no gremlins exist. And check with another OLED
to make sure the module you have is OK.
This code -
if (period >= 100000) {
div_per = 1000 ; afterpt_per = 2 ; units_per = " mS" ;
}
else if (period >= 10000) {
div_per = 1000 ; afterpt_per = 3 ; units_per = " mS" ;
}
else if (period >= 1000) {
div_per = 1000 ; afterpt_per = 4 ; units_per = " mS" ;
}
else if (period >= 100) {
div_per = 1 ; afterpt_per = 2 ; units_per = " uS" ;
}
else if (period >= 10){
div_per = 1 ; afterpt_per = 3 ; units_per = " uS" ;
}
else {
div_per = 1 ; afterpt_per = 4 ; units_per = " uS" ;
}
.....
you might consider storing in a struc array the settings and use a pointer
in the decision tree, just to save code space.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem solved !
After much poking around with the code, I have managed to get my OLED display
working properly. I have made two edits:
To clear the display, I have modified code as follows:
LCD_ClearDisplay(); which is: LCD_WriteControl(0x01);
is replaced with two lines:
LCD_WriteControl(0x00);
LCD_WriteControl(0x01);
To write two lines on display, I have modified code as follows:
Insert:
LCD_WriteControl(0x28);
This overwrites the line in LCD_init() which says:
LCD_WriteControl(LCD_DISPLAY_2_LINES_5x10); /* 2 Lines by 5x10 Characters */
which is same as LCD_WriteControl(0x2C);
i.e. the one bit for N, number of lines, has to be flipped.
This makes it opposite from what the datasheet says!
I don't know if this is a mistake in the datasheet, or what?
Having done above, everything is now working as it should, except that there are
signs of the "artifacts" that you mentioned -- occasional flickering of random pixels.
It is very slight, but it would be nice to get rid of them -- I will investigate that.
Perhaps what I describe above, or a proper tidy version of it, could be made available
somewhwere for others who are trying to drive OLED character displays.
Thanks for comment about using a struc array for multiple decisions.
I'll give that some thought.
Many thanks for your help. Ken.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Super, glad to have been of assistance.
If you have time file a CASE and report this, would be helpful to all.
To create a technical case at Cypress -
“Support”
“Technical Support”
“Create a Case”
You have to be registered on Cypress web site first.
Regards, Dana.