hserin..A little help pleeeease!!
I really need to comunicate a LCD serially with the computer using a PIC18F452, i'm using the windows hyperterminal to send characters through the RS232 and a MAX232 driver circuit included on my PIC trainer, this is the code i'm using to display those characters on the LCD but all i get is kinda chinese characters or nothing instead of the key i'm pressing... i guess there's something wrong with my hserin but i can't figure what exactly. i'm new to PIC so have mercy on my soul
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 9615
DEFINE HSER_SPBRG 25
W0 var BYTE
'Set LCD Data port
DEFINE LCD_DREG PORTB
' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_DBIT 4
' Set LCD Register Select port
DEFINE LCD_RSREG PORTB
' Set LCD Register Select bit
DEFINE LCD_RSBIT 2
' Set LCD Enable port
DEFINE LCD_EREG PORTB
' Set LCD Enable bit
DEFINE LCD_EBIT 3
' Set LCD bus size (4 or 8 bits)
DEFINE LCD_BITS 4
' Set number of lines on LCD
DEFINE LCD_LINES 2
' Set command delay time in us
DEFINE LCD_COMMANDUS 2000
' Set data delay time in us
DEFINE LCD_DATAUS 50
DEFINE HSER_CLROERR 1 'clear overflow error bit
pause 500
Lcdout $fe, 1
W0=0
again: HSERIN [ W0 ]
if W0 = 0 then again
Pause 500 ' Wait for LCD to startup
Lcdout $fe, 1 ' Clear LCD screen
Lcdout W0 ' Display W0
Pause 500 ' Wait .5 second
goto again