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 support@ccsinfo.com

LCD noise?

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



Joined: 05 Dec 2003
Posts: 10
Location: Port Elizabeth, South Africa

View user's profile Send private message Visit poster's website

LCD noise?
PostPosted: Mon Apr 17, 2006 1:59 am     Reply with quote

Hi All,

I have a problem with LCD noise.

Processor: PIC18F458 running @ 20MHz
Compiler: CCS PCH C Compiler, Version 3.236, 29547
LCD: Powertip 4x20 (PC2004LRU) using the Hitachi HD44780 chipset.
PSU: 24Vdc

The current setup has two PCB’s. One with the PIC18F458 and the other, eight relays (5V coil) driven by an ULN2803 chip. Communication between the two boards takes place via I2C (Relay PCB is fitted with the MCP23016 I2C I/O Expander Chip). The micro board has a LM7805 voltage regulator to step the voltage down to 5V level.

My problem appears with the LCD when the relays are pulsed. Funny characters start appearing on the display. New text written to the display appears on the wrong x, y coordinates. The LCD is operated in 4-bit mode, and I use the standard CCS library (LCD420.c). The LCD cable length from micro board to the LCD is about 100mm of ribbon cable.

Currently, I have the relays connected to a 24Vdc stack lamp from Telemecanique (Green, Orange, and Red). Without the stack lamp connected, the LCD seems to function much better than with it.

I have also connected the micro board to a 5V supply and the load on a separate 24V supply. The results are much better as the LCD is fine for a very long time, but eventually it does crash. When the LCD goes “funny” the 18F458 still runs fine and the pulsing of the relays continue. The only way I can currently fix it is, by reinitialising the LCD from time to time.

From all this it appears as if I have noise on the LCD power/data lines, causing all these problems.

Any ideas on how I can fix this problem?

Thanks,
Johannes Geldenhuys
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Mon Apr 17, 2006 2:32 am     Reply with quote

There is a possibility that the erroneous behavior of the LCD is caused by the bug in the code, and not by noise. Does your LCD work properly, when you power it from a completely separate power supply (say, a separate wall transformer)?

- If LCD does work properly in that case, then your problem is indeed a conducted noise from the relays (BTW, do you have protection diodes in parallel with relays?) or lamps (BTW, what kind of lamps are you using? fluorescent?). You can reduce the noise by adding some inductance to the power supply line, which goes to the LCD. Add a choke or an LC filter or run your cable through a ferrite ring.

- If LCD doesn't work properly, when powered from a separate supply, it could be either a bug in the code, of your LCD picks up radiated noise somewhere (for example, fluorescent lamps make good transmit antenna). Shielding is pretty much the only way of dealing with the radiated noise, unless you can remove the source of the noise.
Johannes



Joined: 05 Dec 2003
Posts: 10
Location: Port Elizabeth, South Africa

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 20, 2006 6:42 am     Reply with quote

Thanks kender.

I have done some more testing and still have the same problem. Again I have tested with two PSU's (5V for logic and 24V for load). Everything operated fine.

I have found the following interesting scenario. When I use one single 24Vdc supply to operate both the logic and the load, but I use a buzzer (20mA) instead of an incandescent lamp (0.4A) for the load, the LCD operates fine. The LCD also operates fine if the load is removed from the relay contact. So in short, when the relay is pulsed ON/OFF with a small load (buzzer) or no load on the relay contacts, the LCD operates fine (keeping in mind that I use a single PSU here).

The ULN has build in clamp diodes to prevent noise from the relay coil, so I guess the problem with back emf should be illuminated.
I have also tried ferric rings, but nothing has improved. I haven’t tried using chokes or LC filters yet.

A while back, I had a similar problem when I did some tests in a factory where they weld catalytic converters. The setup was more or less the same. The same Micro PCB with the same LCD. No relays had to be switched. Whenever the welder started welding the arc caused the LCD display to go blank, drop characters etc. I even had the micro running from a 24V via UPS supply (disconnected from mains) to illuminate the possibility of noise being generated down the supply lines from the welder to the micro.

After all this testing I really thought that it must be EMI causing the LCD to go haywire. But then again, why don’t I have the problem when a separate supply is used for the logic and the load?

I will keep testing.

Johannes
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 20, 2006 7:56 am     Reply with quote

I would check that your supply voltage doesn't droop at the same time the LCD is goes bad. Also try to put 10k-3k pull-up resistor on the LCD lines. It might fix some types of noise.
zogbog



Joined: 02 Jun 2004
Posts: 16

View user's profile Send private message Send e-mail MSN Messenger

Noise Issue
PostPosted: Fri Apr 21, 2006 4:22 am     Reply with quote

I have done some projects which have had similar noise issues. I used a pic 18F252 to dirve some 400V DC contactors. The micro was connected to an lcd via a ribbon cable so the LCD could be panel mounted.

The diodes in the ULN2803 are probably not good enough to clamp the spikes so put some fast diodes right next to the coils of the relays.

Also if you can seperate the 0V of the micro from the 0V of the relay PCB with a 10R res.

I used ferrite clamps on the ribbon cable to the LCD which worked great but You didnt say if the LCD is PCB mounted or not. But try to put the ferrites on the I2C lines being cautious that they do mess up your comms speed. Screened cable grounded at the micro side of the system will also help.

You say that the PIC is still running but are you sure. Switching noise has a nasty habbit of reseting the wdt on the pic

Hope this helps
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