Problem with PIC & LCD display

I'm having a problem with a fairly simple project incorporating a

16F877A PIC and a 4x20 alphanumeric display module. The circuit interfaces with other logic ICs, though these can be removed from the circuit to isolate the problem.

The circuit is fed, under test conditions, from a linear 12v power supply. The 5v regulator on the circuit board is decoupled using 100nf ceramic capacitors. There is similar decoupling on the PIC itself, and at other places e.g. decoupling the 5v supply on the connector to the LCD display. I have also fitted a 100uH coil in the supply to the 5v regulator to reduce any effects from spurious noise on the supply line.

The problem I'm having difficulty solving is that the display will intermittently go blank. It will go blank, seemingly when the display is written to by the PIC, either (a) due to a spike/noise on the mains supply (this can be intermittently reproduced by repeatedly turning on and off a piece of mains powered equipment on the same circuit), or (b) when the 0v rail (not even necessarily close to the LCD display) is touched by for example a multimeter probe. This is the most consistent way of producing the fault. The multimeter can be turned off and the other probe not connected to anything for this to happen. The PIC doesn't appear to be affected by any of this as it can be shown to still be operating as expected.

I've experienced similar issues before in my limited experience of building small projects with PICs. I had issues with a 16F84A resetting itself when the 0v rail close to the IC was touched with a screwdriver.

Can anybody suggest what vital consideration for circuit design I'm missing. I'm at a bit of a loss as to what I'm doing wrong.

Thanks.

--
Steve H
Reply to
Steve H
Loading thread data ...

On a sunny day (Thu, 1 May 2008 17:51:39 +0100) it happened Steve H wrote in :

I usually use 10uF tantalum

Same 10uF. How long is the cable to the LCD?

Maybe it tunes with the 100nF ;-) Do you have a scope? Is the 7805 or whatever oscillating?

Never had any problems like that, neither with F84 or other PICS. Is your system grounded? I mean is the top of you workbench live or something?

Reply to
Jan Panteltje

In message , Jan Panteltje writes

There is a 47uf electrolytic on the input and output of the 5v reg. I can try a tant to see if there's any change.

Around 30cm. I'm using equipment wire, I think 16/0.2 (don't have the project to hand right now). I've added decoupling on the 5v connection on the module as well.

There's certainly something odd happening... I fitted the coil only after the problems occurred in a seemingly futile attempt to solve it. The 5v line is indeed very stable, having scoped it.

I've run the thing with the 0v connected to earth with no change to the symptoms. In use, it will run off a 12v supply, isolated from a direct earth connection.

I've had similar problems in various places around the same area, e.g. on a bench with an anti-static mat (the circuit insulated directly from it) as well as other locations in the same room.

--
Steve H
Reply to
Steve H

Put a line filter on the mains input.

Reply to
cbarn24050

On a sunny day (Thu, 1 May 2008 18:24:16 +0100) it happened Steve H wrote in :

OK.

I have something here with about 30cm flat cable, works great...

One more thing, is any PIC input floating, any LCD input floating? I mean for example PIC reset, and are you using 4 bit to the LCD?

I would like to know if the PIC actually resets, or there is just some LCD signal that gets messed up, did you test that?

Reply to
Jan Panteltje

In message , Jan Panteltje writes

There are no floating inputs to the PIC. The few unused pins are configured as outputs. The reset pin is connected to 5v via a 100 ohm resistor.

The LCD is used in 4-wire mode with the unused data lines floating. Perhaps I should tie them to 0v? I guessed they'd be OK left alone as it's a bidirectional data bus, but maybe I shouldn't let them float.

I'm probably confusing the issue by introducing a second (but perhaps related in terms of the cause) project I've experienced problems with.

Regarding the current issue with the 16F877A driving the LCD, I'm certain the PIC does not reset. I can say this because of a function in code that lights the backlight for a period of time when a button (there are 4 button inputs pulled up via 4k7 resistors) is pressed. This function continues to work in a way that indicates the PIC in this instance has not reset but has continued to run correctly independently of the LCD blanking out.

A different project I was working on a while ago showed an effect where if I touched a small screwdriver on a track carrying the 0v rail close to the PIC, the PIC reset itself. There may have been a reason for this e.g. I was using a 47k pull-up for the reset at the time - I later learned was bad practice at the very least. I mentioned this previous project because in terms of the cause (simply touching 0v) an unwanted effect occurred. So far as the current LCD project is concerned, I think I've learned from some mistakes in the past, but still can't get it to function reliably.

Thanks for your input so far.

--
Steve H
Reply to
Steve H

In message , snipped-for-privacy@aol.com writes

incorporating a

The commercial linear PSU, I'm guessing, would have a filtered input. Certainly, I've had these sort of problems with a filtered power supply being used. That may reduce problems due to noise on the mains, but I'm not sure about the other effects I'm seeing.

Thanks.

--
Steve H
Reply to
Steve H

On a sunny day (Thu, 1 May 2008 19:28:43 +0100) it happened Steve H wrote in :

No. LCD datasheet says leave not connected.

The thing i have here, now with 4 line LCD too,

formatting link
has none of those problems. In fact it runs even OK out of the box in a very strong RF field (27 MHz). I am personally not using the reset input, but using it for I/O, anyways that was not your problem. Is the LCD contrast (pin 3 IIRC) connected? Very long time agao I had a situation where if I walked with my new shoes on the carpet it would cause 1 inch sparks if I touched any metal, it would reset an IBM PC:-) Static charges?

Reply to
Jan Panteltje

rporating a

s
l

Alot of linears dont, try a different supply or even a battery.

Reply to
cbarn24050

Are you sure it's not resetting?

What else EXACTLY is this PIC circuit connected to (off board in particular)? How long is the cable to the LCD display? What kind of equipment is this? Can you link to a photo? Is it a proper PCB or a plugboard? Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

In message , Jan Panteltje writes

I used a 16x4 LCD with a 16F877A recently in another project and have found it to be completely reliable. For some reason this one will not work. I've got pin 3 connected to a small -ve potential via a pot and a dc-dc converter used for a +/- 12v supply in another part of the circuit. I intend to try an alternative 20x4 display to rule out the possibility of it being over-sensitive to something.

I couldn't completely rule out static, though I'm fairly sure I'm well discharged before touching anything connected with the circuit.

--
Steve H
Reply to
Steve H

If bringing a screwdriver close to the 0 V rail induced a reset, you have an electrostatic discharge (ESD) problem on your bench. Which could cause latent damage to the PIC, which may explain your lock up problems.

For example if you have a piece of carpet on your workbench (nice to keep from scratching cabinets but bad for ESD) and you place a screwdriver on the carpet, when you pick up the screwdriver you have a very nicely charged high voltage capacitor with the plastic handle and metal shaft.

I would work toward reducing your electrostatic problem on your bench and the floor below it (Check out 3M's ESD products).

--
Joe Leikhim K4SAT
"The RFI-EMI-GUY"©

"Treason doth never prosper: what\'s the reason?
For if it prosper, none dare call it treason."

"Follow The Money"  ;-P
Reply to
RFI-EMI-GUY

When I lived in Illinois, the humidity was so low that there was a static charge everywhere I went, now in Florida with this terrible humidity, it is not so much a concern. Still from your "screwdriver" report, you have a problem.

--
Joe Leikhim K4SAT
"The RFI-EMI-GUY"©

"Treason doth never prosper: what\'s the reason?
For if it prosper, none dare call it treason."

"Follow The Money"  ;-P
Reply to
RFI-EMI-GUY

In message , Spehro Pefhany writes

I'm certain the PIC isn't resetting - the LCD module is going blank but the PIC continues to function. It appears the intelligent LCD module locks up/resets itself.

Have no photo to hand and the equipment isn't with me just now. Fully assembled it comprises the PIC with LCD, 4 control buttons and several logic inputs/outputs, four of which control 4 to 16-line latches that switch solenoids via darlington drivers. The unit is part of a gas sampling multiplexer system.

Currently, a lot of the circuitry is disconnected - there are 3 individual PCBs (etched boards). It's working in a bare-bones sort of state at the moment, pretty much the PIC and display only

An earlier version of the device, identical but utilising in place of the 16F877A/LCD a pair of 16F84As and driving a 2 x 7segment LED display, has worked in the field flawlessly for 3 years.

--
Steve H
Reply to
Steve H

Is it the solenoids that are mucking things up?

Lash-ups tend to be more sensitive to EMI.

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

In message , Spehro Pefhany writes

No, I should have pointed out that the solenoids are not operating in the state I'm testing it in. They will be either disconnected or a pair of them will energise at power-up and remain in that state throughout, depending on which bits of the unit I have plugged together.

I know what you mean, though with this project there are 3 boards connected via ribbon cables. I can disconnect the output logic and solenoid circuitry by disconnecting the ribbon connectors on the control board. It is thus a reasonably 'clean' way to run only the control board.

--
Steve H
Reply to
Steve H

[using '877's] A few weeks ago had a bad batch of brand new 4 line displays. Same problem as you're seeing. Sourced from another supplier, fine. Recently did a display (nibble mode) on the end of 1mtr of 'separate wires' loom, no problem. I'd also not trust that reset pin. I usually add 100k and 10uF to allow a defined external reset some time after power up. The cap also kills any dirt subsequently turning up at the pin. Rather then lose benefit of a long reset time I will take the trouble to add a number of extra hardware components to define the state of critical control lines during the power up reset period.
Reply to
john jardine

Have you actually tried connecting the 0V rail directly to the GROUND of the linear PSU?

Reply to
rebel

Can you post a photo of your board and setup? That often helps. Do you have an oscilloscope?

Dave.

Reply to
David L. Jones

In message , David L. Jones writes

First of all, thanks to all who have contributed with help and suggestions so far. Much appreciated.

I've uploaded four pictures of the board etc. to:

formatting link

The unit isn't in a 100% assembled state, but you should see the general idea.

I've done some further testing today which has revealed the following observations:

Firstly, changing the 47uf capacitors on the input and output of the 5v reg to 4u7 tantalums, and also adding one to the decoupling of the PIC itself, made no difference.

Significantly perhaps, powering it with a 12v battery made no difference to the symptom of the display blanking when the 0v rail is touched with a meter probe/screwdriver. This eliminates a problem with the mains filtering.

As I've explained in previous posts, the LCD is written to twice a second normally. Slowing this down significantly to refresh every 3 seconds showed that the display does not blank immediately when the 0v line is touched but will blank on the next write operation. The probe or whatever only needs to be touched on the 0v potential momentarily. The display will stay on and (intermittently) blank on the next write.

Scoping the data and control lines to the LCD shows the signals are of the correct amplitude. All lines read zero ohms between LCD and PIC pins.

I'm going to replace the LCD module with an alternative type to see if it's that causing the problem.

--
Steve H
Reply to
Steve H

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.