PDA

View Full Version : LCD Reset Problem



Bill Legge
- 22nd February 2009, 04:40
I have come across the same problem on a variety of PIC processors with a variety of 4 line LCDs:

1. They always work OK on power-up.

2. If 're-set' only lines 1 and 3 display, 2 and 4 are blank. If one does multiple re-sets all four line occasionally work.

3. I have experimented with a variety of:
*Oscillator/Xtal speeds
*DEFINE LCD_COMMANDUS delays
*DEFINE LCD_DATAUS delays
*Various brown-out setting in the configuration word/s
*And nothing seems to make all four lines work on re-set

This is a fault that is difficult to pin down. Some systems never have this fault whilst others nearly always resuse to show lines 2 and 4.

I do have the appropriate DEFINES for the LCDs: D,E,RS,Lines,Bits

Any hints please?

Regards Bill Legge

Archangel
- 22nd February 2009, 09:50
Hi Bill,
Try FLAGS = 0 early in your code.

Bill Legge
- 23rd February 2009, 03:09
Joe S

Thanks very much, your tip worked

FLAGS=0 Did the trick.

I've looked up the note on FLAGS=0 in the LCDOUT command page of the PBP manual and don't understand how it works?

1. If I cycle the power to the PIC, without 'FLAGS=0' all is OK.
2. If I re-set I get the missing lines problem unless the statement 'FLAGS=0' is included.

I thought the PIC executed the same code on re-set as on power-up?

Whatever, you help is much appreciated.

Regards Bill Legge

Archangel
- 23rd February 2009, 05:04
Joe S

Thanks very much, your tip worked

FLAGS=0 Did the trick.

I've looked up the note on FLAGS=0 in the LCDOUT command page of the PBP manual and don't understand how it works?

1. If I cycle the power to the PIC, without 'FLAGS=0' all is OK.
2. If I re-set I get the missing lines problem unless the statement 'FLAGS=0' is included.

I thought the PIC executed the same code on re-set as on power-up?

Whatever, you help is much appreciated.

Regards Bill Legge
It causes the LCD to reset each time the lcdout statement sends data to it.

mister_e
- 23rd February 2009, 15:53
little deeper.... when you clear FLAGS value, the next LCDOUT will include the whole LCD initialization commands (1 line or more, 4 or 8 bits mode etc etc... see your LCD datasheet), then send your data.

You can do it manually with few LCDOUT, but since FLAGS-0 do the job, why messing with it euh? ;)

Archangel
- 23rd February 2009, 17:06
Just curious Bill, "reset" used in the first post, what do you mean by that, are you taking the mclr line low or doing a full power off scenario?
I ask because a power off that only browns out the LCD may be the entire problem. There will be times you do not want to use flags = 0 due to latency problems.

Bill Legge
- 24th February 2009, 08:55
Joe S

The boards I'm using have a 10k resistor that normally holds MCLR high. The re-set button takes the MCLR pin direct to ground. The power is on all the time.

I have been lazy with LCDs and not bothered with the spec sheets - just use the PBP LCD commands.

FLAGS=0 has solved most of my problems but I still get the odd occasion when alternate lines of the LCD don't come to life.

I suspect that the proper way to fix this is some combination of FLAGS and the configuration brown-out settings. AND READ THE SPEC SHEETS!

I mostly use PIC16F877A and PIC18F8722 chips on Mikroelektronika boards for developement and move to Futurlec boards for the end product - all hobby stuff, no production.

Thanks for you interest.

Regards Bill Legge