-
garbled text on LCD
Hi there,
I'm getting garbled text on my Hitachi based LCD attached to a 16F876. Most of the letters are legible but sometimes it skips a letter or misprints multiple letters. I've tried three seperate displays with the same results.
Here's my code.
'Chip config
trisa = %00000000
trisb = %00000000
'General Defines
define LOADER_USED 1
define OSC 20
'LCD Defines Pins / port for LCD data I/O
define LCD_DREG PORTB
define LCD_DBIT 4
define LCD_RSREG PORTB
define LCD_RSBIT 3
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 0
define LCD_BITS 4
DEFINE LCD_LINES 4
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
START:
pause 600
lcdout $fe,1
lcdout $fe,2
pause 1000
porta = %00000001
lcdout "hello world"
pause 1000
porta = %00000000
goto start
end
-
Try remove those
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
else, try to play with LCD_COMMANDUS and LCD_DATAUS value
Also try to print to LCD in a one task
LCDOUT $FE,1,"Hello world !"
Be sure you program your PIC with HS oscillator setting.
-
RIGHT!
It looked like a 'baud' problem so then I guess speed and process time would be similar!!
Thanks again...and again...and again...
-
That worked great.
It seems like an awful lot of typing the defines though. Could I somehow make an include file that has all of that in it?
-
Yes you can. But i'll prefer to do some program header and use them after. In my case, i'd do program header for each PIC i use with the configuration fuses and blah blah blah. You can do some with LCD define too and reuse them after. I feel safer to see all the code in front of me. BUT if you still want to do some INCLUDE files, create a new file.bas and then place INCLUDE "lcdstuff.bas" at the top of your code.