PDA

View Full Version : OLED Display Noise problem



gunayburak
- 28th May 2016, 19:19
Hello everyone ;

I've been working on a project which requires an LCD display then I decided to get an oled in order to free some pins also to ease the PCB design
and I purchased an OLED code named EA W162-XBLW (ICEWHITE) of Electronic Assembly but I have a disturbing problem with the LCD .. After I power the circuit up I can perfectly display all the characters on whereever I want on the lcd but there is an incredible noise moving all around the LCD in a form of a pixel , So far I have tried using capacitors even those larger ones and even added the define LCD command and data line parameters with several tries ,, but no lock so far .. Here I share the code and a picture ... I hope any of you had such a weird problem in the past and solved it ...


The code is for 16F1827


#config
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_19 & _LVP_OFF
#ENDCONFIG


'-------------------------------------------------------------------------------
define OSC 4
OSCCON=%01101010 'OSC is @ 4 MHZ


'------------- LCD DEFINES ------------------------
DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4


DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 7 'LCD register select bit


DEFINE LCD_RWREG PORTA ' LCD read/write port
DEFINE LCD_RWBIT 0 ' LCD read/write pin bit


DEFINE LCD_EREG PORTA 'LCD enable port
DEFINE LCD_EBIT 6 'LCD enable bit


DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD


'------------- LCD DEFINES -------------------------




'-------------------------------------------------------------------------------
PORTA=%00000000 : PORTB=%00000000
TRISA=%00000000 : TRISB=%00000000
'ADCON0=%00000001 : ADCON1=%10110000
ANSELA=%00000 : ANSELB=%00000000
'OPTION_REG.7=0
'-------------------------------------------------------------------------------



pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

MAIN:

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "


goto main


8246

LinkMTech
- 28th May 2016, 20:24
Hi,

I would suggest writing to the LCD only when you need to update the display info.
Constantly writing to it in a loop without any kind of delay may be causing the problem.



pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C
lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "


Main:
Do stuff
IF something_new THEN Update_LCD

GOTO Main


Update_LCD:

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," New data "

GOTO Main

gunayburak
- 28th May 2016, 22:00
Hi,

I would suggest writing to the LCD only when you need to update the display info.
Constantly writing to it in a loop without any kind of delay may be causing the problem.



pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C
lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "


Main:
Do stuff
IF something_new THEN Update_LCD

GOTO Main


Update_LCD:

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," New data "

GOTO Main



Thanks for your response .But what if I need to display some sort of ADC reading which requires an instant update on the lcd continuously ?? You know how fast those readings may change ...

LinkMTech
- 28th May 2016, 23:18
You can only "see" so fast before it becomes a blur.
Try adding a PAUSE 33 in your main loop as it is, making it 30fps, just to test if the ghost dots go away.

gunayburak
- 29th May 2016, 08:01
You can only "see" so fast before it becomes a blur.
Try adding a PAUSE 33 in your main loop as it is, making it 30fps, just to test if the ghost dots go away.

Tried but still no luck :(

Jerson
- 29th May 2016, 11:56
Have you got your decoupling capacitors on board?

gunayburak
- 29th May 2016, 12:06
Have you got your decoupling capacitors on board?
Yes I have tried a several values of capacitors even those large capacitors around 470uf and smaller ones and also together but it doesn't help ..

pedja089
- 29th May 2016, 12:20
Try something like this

pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "

Main:
GOTO Main
And remove everything from board except power supply, PIC and LCD. Add 10uF, 100nF, 10nF capacitors to LCD power pins, preferably use SMD.
If problem still persist then problem is in LCD. Or it can be "dirty" power supply. You didn't post schematic, so...

You said that you need to display data as fast as possible. If that is really what you need, then use 7 segment led display. And you can get 3-4K FPS, but then you need super human to read that.
If only regular humans will read display then more then 4 or 5 updates is more then enough.
Look at multimeter Display Digital: 6,000 counts, updates 4 per second
http://en-us.fluke.com/products/digital-multimeters/fluke-115-digital-multimeter.html#techspecs

gunayburak
- 29th May 2016, 12:25
I tried adding pause 100 command right after the lcdout commands but the noise only got lowered just a little .. This is definitely not normal .. But when I apply 1000 ms of delay it almost stops making noise on the screen(there is still a little) ... But It musn't be that bad .. It is an oled and the datasheet claims parameters for write/read around nanosecs .. Where do I do the mistake ? , May it have anything to do with the LCD or a defective circuit component ... On the other hand I think It musn't have because It can display chars succesfully with a huge amount of delay periods ... :(

gunayburak
- 29th May 2016, 12:28
Try something like this

pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "

Main:
GOTO Main
And remove everything from board except power supply, PIC and LCD. Add 10uF, 100nF, 10nF capacitors to LCD power pins, preferably use SMD.
If problem still persist then problem is in LCD. Or it can be "dirty" power supply. You didn't post schematic, so...

You said that you need to display data as fast as possible. If that is really what you need, then use 7 segment led display. And you can get 3-4K FPS, but then you need super human to read that.
If only regular humans will read display then more then 4 or 5 updates is more then enough.
Look at multimeter Display Digital: 6,000 counts, updates 4 per second
http://en-us.fluke.com/products/digital-multimeters/fluke-115-digital-multimeter.html#techspecs

It is not a regular eye read actually I am planning to make a vumeter to read that's why I need that fast readings ...

pedja089
- 29th May 2016, 12:39
That sound to me as bad PCB design and/or power supply. But sill could be bad LCD driver.
If long delays make artifact disappear, then capacitive coupling between LCD signals and power lines can cause that.
You can try test that. Add pull down resistor 1K to LCD Enable pin, and create easy way to disconnect LCD and resistor from PIC, as close as possible to LCD.

pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "
PAUSE 10000' Disconnect only LCD enable pin before pause timeout
Main:
lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "
GOTO Main
Display shouldn't update any more. If you see dots then 99% problem is with PCB layout, and decoupling.
If there is no dots on LCD then problem is with LCD.

gunayburak
- 29th May 2016, 13:18
That sound to me as bad PCB design and/or power supply. But sill could be bad LCD driver.
If long delays make artifact disappear, then capacitive coupling between LCD signals and power lines can cause that.
You can try test that. Add pull down resistor 1K to LCD Enable pin, and create easy way to disconnect LCD and resistor from PIC, as close as possible to LCD.

pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "
PAUSE 10000' Disconnect only LCD enable pin before pause timeout
Main:
lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "
GOTO Main
Display shouldn't update any more. If you see dots then 99% problem is with PCB layout, and decoupling.
If there is no dots on LCD then problem is with LCD.

Well ;

I did exactly as you asked me to do and as you say it's got to do with the lcd then ...

Scampy
- 29th May 2016, 13:50
Well ;

I did exactly as you asked me to do and as you say it's got to do with the lcd then ...

I don't have the same chip, but used an 18F4580 with a 2 x 16 LCD and just changed the lines to run the LCD from port B to suit the EasyPIC5 development board and I don't get any strange random pixels and I'm running the chip at 20Mhz so the switching is much faster, so it would suggest that it is your hardware that is at fault.



ASM
__CONFIG _CONFIG1H, _OSC_HS_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM


DEFINE OSC 20

DEFINE LCD_DREG PORTB ' LCD Data port
DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4)
DEFINE LCD_EREG PORTB ' LCD Enable port
DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB ' LCD Register Select port
DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD)
DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4 ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us

'-------------------------------------------------------------------------------
PORTA=%00000000 : PORTB=%00000000
TRISA=%00000000 : TRISB=%00000000
'ADCON0=%00000001 : ADCON1=%10110000
'ANSELA=%00000 : ANSELB=%00000000
'OPTION_REG.7=0
'-------------------------------------------------------------------------------


pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

MAIN:

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "

goto main



Replaced the 20Mhz with a 4Mhz xtal and recoded and the display was fine.

gunayburak
- 29th May 2016, 14:03
I don't have the same chip, but used an 18F4580 with a 2 x 16 LCD and just changed the lines to run the LCD from port B to suit the EasyPIC5 development board and I don't get any strange random pixels and I'm running the chip at 20Mhz so the switching is much faster, so it would suggest that it is your hardware that is at fault.



ASM
__CONFIG _CONFIG1H, _OSC_HS_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM


DEFINE OSC 20

DEFINE LCD_DREG PORTB ' LCD Data port
DEFINE LCD_DBIT 0 ' starting Data bit (0 or 4)
DEFINE LCD_EREG PORTB ' LCD Enable port
DEFINE LCD_EBIT 5 ' Enable bit (on EasyPIC 5 LCD)
DEFINE LCD_RSREG PORTB ' LCD Register Select port
DEFINE LCD_RSBIT 4 ' Register Select bit (on EasyPIC 5 LCD)
DEFINE LCD_BITS 4 ' LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 4 ' number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Command delay time in us
DEFINE LCD_DATAUS 50 ' Data delay time in us

'-------------------------------------------------------------------------------
PORTA=000000 : PORTB=000000
TRISA=000000 : TRISB=000000
'ADCON0=000001 : ADCON1=110000
'ANSELA=000 : ANSELB=000000
'OPTION_REG.7=0
'-------------------------------------------------------------------------------


pause 500

lcdout $FE,$28
lcdout $FE,$17
lcdout $FE,$06
lcdout $FE,$08
lcdout $FE,$01
lcdout $FE,$02
lcdout $FE,$0C

MAIN:

lcdout $FE,$80,"BU BiR DENEMEDiR"
LCDOUT $FE,$C0," iKiNCi SATIR "

goto main



Replaced the 20Mhz with a 4Mhz xtal and recoded and the display was fine.

What can I say .. I am so unlucky with these OLEDs .. But thanks for your effort anyway ..

gunayburak
- 4th June 2016, 10:53
Today a new EA OLED display has arrived yet the same problem still occurs ... There might be a picbasic incompatibility with the lcd because my connections are exactly the same with the code I shared , nothing more nothing less ..

Scampy
- 5th June 2016, 09:22
Looking at the data sheet, by default it's in 4/8 bit mode so should work the same way as a normal 2 x 16 LCD display. The only suggestion to prove if the OLED is part of a faulty batch would be to run the code above on a different PIC (18F4580 or the good old 16F877A) - If that works then the problem would appear to be with the original pic, if the OLED still gives odd pixels then its the display and I would send them back for a refund and order from a different supplier

tumbleweed
- 5th June 2016, 14:14
Usually issues with junk appearing in the display have to do with not allowing the LCD time to process commands.
If you want to hammer the display as fast as possible then you might try reading the BUSY status flag between operations.

Try this and see if it gets any better (untested, so beware)...


'-------------------------------------------------------------------------------
define OSC 4
OSCCON=%01101010 'OSC is @ 4 MHZ

'------------- LCD DEFINES ------------------------
DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4

DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 7 'LCD register select bit

DEFINE LCD_RWREG PORTA 'LCD read/write port
DEFINE LCD_RWBIT 0 'LCD read/write pin bit

DEFINE LCD_EREG PORTA 'LCD enable port
DEFINE LCD_EBIT 6 'LCD enable bit

DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD

DEFINE LCD_COMMANDUS 6200 'command delay time (in us) - clear display requires 6.2ms
DEFINE LCD_DATAUS 50 'data delay time (in us)

'-------------------------------------------------------------------------------
PORTA = %00000000
PORTB = %00000000
TRISA = %00000000
TRISB = %00000000
ANSELA = %00000
ANSELB = %00000000
'ADCON0=%00000001
'ADCON1=%10110000
'OPTION_REG.7=0
'-------------------------------------------------------------------------------

pause 500 'wait for display powerup

lcdout $FE,$28 'function set 4-bit mode
call lcd_busy_wait
lcdout $FE,$08 'display off
call lcd_busy_wait
lcdout $FE,$06 'entry mode set
call lcd_busy_wait
lcdout $FE,$17 'char mode + internal power
call lcd_busy_wait
lcdout $FE,$01 'clear display (requires long delay)
call lcd_busy_wait
lcdout $FE,$02 'home
call lcd_busy_wait
lcdout $FE,$0C 'display on

MAIN:
call lcd_busy_wait
lcdout $FE,$80,"BU BiR DENEMEDiR"
call lcd_busy_wait
lcdout $FE,$C0," iKiNCi SATIR "
goto main

'sub lcd_busy_wait
'read lcd busy flag until busy=0
WAITST CON 1 ' delay 1us
busy var bit
lcd_busy_wait:
busy = 1
TRISB = TRISB or $F0 'set PORTB D4-D7 to inputs
@ bcf LCD_RSREG, LCD_RSBIT 'RS=0
@ bsf LCD_RWREG, LCD_RWBIT 'RW=1
pauseus WAITST

'wait for lcd busy flag (D7) to be low
do while (busy = 1)
@ bsf LCD_EREG, LCD_EBIT 'EN=1
pauseus WAITST
busy = PORTB.7 'read busy bit (bit 7 in upper nibble)
@ bcf LCD_EREG, LCD_EBIT 'EN=0
pauseus WAITST
' dummy read of lower nibble
@ bsf LCD_EREG, LCD_EBIT 'EN=1
pauseus WAITST
@ bcf LCD_EREG, LCD_EBIT 'EN=0
pauseus WAITST
loop

TRISB = TRISB and not $F0 'set PORTB D4-D7 back to outputs
@ bcf LCD_RWREG, LCD_RWBIT 'RW=0
return


You might find that you need to split the cursor position commands and data...


call lcd_busy_wait
lcdout $FE,$80 'move cursor
call lcd_busy_wait
lcdout "BU BiR DENEMEDiR" 'send data


Even with doing things like this some displays just don't like being continuously written to and you need to use delays.
Reading the BUSY flag really needs to be done for each byte transferred, so it may not help much at all.

gunayburak
- 12th June 2016, 08:15
Usually issues with junk appearing in the display have to do with not allowing the LCD time to process commands.
If you want to hammer the display as fast as possible then you might try reading the BUSY status flag between operations.

Try this and see if it gets any better (untested, so beware)...


'-------------------------------------------------------------------------------
define OSC 4
OSCCON=%01101010 'OSC is @ 4 MHZ

'------------- LCD DEFINES ------------------------
DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4

DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 7 'LCD register select bit

DEFINE LCD_RWREG PORTA 'LCD read/write port
DEFINE LCD_RWBIT 0 'LCD read/write pin bit

DEFINE LCD_EREG PORTA 'LCD enable port
DEFINE LCD_EBIT 6 'LCD enable bit

DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD

DEFINE LCD_COMMANDUS 6200 'command delay time (in us) - clear display requires 6.2ms
DEFINE LCD_DATAUS 50 'data delay time (in us)

'-------------------------------------------------------------------------------
PORTA = %00000000
PORTB = %00000000
TRISA = %00000000
TRISB = %00000000
ANSELA = %00000
ANSELB = %00000000
'ADCON0=%00000001
'ADCON1=%10110000
'OPTION_REG.7=0
'-------------------------------------------------------------------------------

pause 500 'wait for display powerup

lcdout $FE,$28 'function set 4-bit mode
call lcd_busy_wait
lcdout $FE,$08 'display off
call lcd_busy_wait
lcdout $FE,$06 'entry mode set
call lcd_busy_wait
lcdout $FE,$17 'char mode + internal power
call lcd_busy_wait
lcdout $FE,$01 'clear display (requires long delay)
call lcd_busy_wait
lcdout $FE,$02 'home
call lcd_busy_wait
lcdout $FE,$0C 'display on

MAIN:
call lcd_busy_wait
lcdout $FE,$80,"BU BiR DENEMEDiR"
call lcd_busy_wait
lcdout $FE,$C0," iKiNCi SATIR "
goto main

'sub lcd_busy_wait
'read lcd busy flag until busy=0
WAITST CON 1 ' delay 1us
busy var bit
lcd_busy_wait:
busy = 1
TRISB = TRISB or $F0 'set PORTB D4-D7 to inputs
@ bcf LCD_RSREG, LCD_RSBIT 'RS=0
@ bsf LCD_RWREG, LCD_RWBIT 'RW=1
pauseus WAITST

'wait for lcd busy flag (D7) to be low
do while (busy = 1)
@ bsf LCD_EREG, LCD_EBIT 'EN=1
pauseus WAITST
busy = PORTB.7 'read busy bit (bit 7 in upper nibble)
@ bcf LCD_EREG, LCD_EBIT 'EN=0
pauseus WAITST
' dummy read of lower nibble
@ bsf LCD_EREG, LCD_EBIT 'EN=1
pauseus WAITST
@ bcf LCD_EREG, LCD_EBIT 'EN=0
pauseus WAITST
loop

TRISB = TRISB and not $F0 'set PORTB D4-D7 back to outputs
@ bcf LCD_RWREG, LCD_RWBIT 'RW=0
return


You might find that you need to split the cursor position commands and data...


call lcd_busy_wait
lcdout $FE,$80 'move cursor
call lcd_busy_wait
lcdout "BU BiR DENEMEDiR" 'send data


Even with doing things like this some displays just don't like being continuously written to and you need to use delays.
Reading the BUSY flag really needs to be done for each byte transferred, so it may not help much at all.

Thanks for your great effort but now it doesn't show anything on the display .. :(

CuriousOne
- 29th June 2016, 09:32
It is not bug, it is feature :)
These oled displays are so fast, so you're seeing the cursor moving :)

gunayburak
- 30th June 2016, 16:18
So any clue how to turn off this moving cursor .. Besides these moving cursor must be moving only at the first line of each character yet I see this noise on all over the screen ..

OldMarty
- 1st July 2016, 04:52
I recall most LCD's have a "cursor off" command? (i believe the OLED replacements for LCD's should also have cursor-off too).

Turn the cursor off at the beginning of your code, just after the LCD initialises. If you ever need to see the cursor as a prompt, then re-enable the cursor during that part of the code only.

hope this might help?

Dave
- 1st July 2016, 19:31
Do you have a data sheet available to view?

gunayburak
- 1st July 2016, 23:13
http://www.lcd-module.de/fileadmin/eng/pdf/doma/olede.pdf

Here it is .. The model code name is :


EA W162-XB

CuriousOne
- 5th July 2016, 09:38
I saw an article about these displays in Russian couple of months ago, that guy also had cursor issue and he dealt somehow with it. I will check my history later and let you know.

pedja089
- 5th July 2016, 10:15
Look at page 4 of datasheet
Display On/Off Control 0 0 0 0 0 0 1 D C B Sets entire Display (D) ON/OFF. Sets Cursor (C) ON/OFF. Sets Blinking (B) of Cursor Position Character.