PDA

View Full Version : LCD misspells and drops Charactors



Archangel
- 14th November 2006, 23:01
Hello Esteemed Forum Members,
Posted below is part of the code I am using to make an LCD serial backpack display and while it works, it drops charactors and misspells words in the string.
I am hoping for a better explanation of what each define actually does than the manual gives, as the manual is clearly written for engineers who already know these things. Thank You ,
JS
include "modedefs.bas"
' Define LCD registers and bits<h4> I got these first 7</h4>
Define LCD_DREG PORTB
Define LCD_DBIT 4
Define LCD_RSREG PORTA
Define LCD_RSBIT 0
Define LCD_EREG PORTA
Define LCD_EBIT 1

DEFINE LCD_LINES 4 'Define using a 4 line LCD
<h4>DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent.
</h4>DEFINE OSC 20
I believe the problem is there as a VFD I have tried does not do this.
JS

mister_e
- 15th November 2006, 04:09
Try a slower baudrate first... 300bauds

I you're using an internal OSC... it may work only at slow baudrate.

Serious serial comm=serious osc (Crystal OR ceramic resonator... i stick to crystal)

Archangel
- 15th November 2006, 20:06
Mister_e,
Slowing the baud rate didn't do it, I tried in my mind to justify why this error occured with a 4 line LCD but not a 2 line VFD,so I tried a different LCD and still got the same errors. I started with the hypothesis, maybe the LCD was using more power than the VFD, causing the pic to brown out, I tried a 1000uF capacitor on the pic VDD (power in) pin and that didn't help. I moved it to the LCD terminal 3 (the contrast line) and viola it stopped making the errors, however it required the LCD to be initialised and then a PIC reset to work. I replaced the 1000uF cap with a .1uF bypass capacitor and all is as it should be.
Fat Dumb and Happy again!
JS

mister_e
- 15th November 2006, 21:04
Good!

The reset stuff is normal, FYI you could also insert the following line

FLAGS=0
and at the next LCDOUT it will send all needed initialisation stuff to your LCD... but i think it's not a too good idea as you could maybe miss some character.

Anyway... who suggest to swap LCD when the power is on? Not me for sure :)

Dave
- 15th November 2006, 22:09
Joe S., How long is the cable from the LCD to the PIC? Do you have a scope? If so put the leads on the power lines from the +5v and the ground at the display and see if you can see any noise in the region of 100mv or so. If this is the case I would power the LCD with separate leads from the LCD to the +5volt source. Depending on the length of the cable you are using, if it is too long the data lines are seeing cross coupling and this is being interpreted as bad data. The maximum length of the cable should not exceed more then about 6 inches. i have had problems in the past with VFD displays that draw much more power. An LCD display shouldn't draw more then a couple of milliamps without the backlighting. Are you running the backlighting from the same cable as the LCD data cable? If so I would change it to seprate cables and run it directly to the output of the supply.

Dave Purola,
N8NTA