Ive tried it hundreds of ways. It just doesn't work. Or rather, it works fine, but it will not acknowledge input from my terminal on my PC
Code:
' Name : HSERX.pbp
' Compiler : PICBASIC PRO Compiler 2.6
' Assembler : PM or MPASM
' Target PIC : 40-pin 16F877A, 18F452 or similar
' Hardware : LAB-X1 Experimenter Board
' Oscillator : 4MHz external crystal
' Keywords : HSERIN, HSEROUT, LCDOUT
' Description : PICBASIC PRO to send and receive from the hardware
' serial port.
'
' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
Define LOADER_USED 1
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 77 ' 9600 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
APFCON0.2 = 1 'TX Pin Select - 0 = Pin B7 1 = Pin C4
APFCON0.7 = 1 'RX Pin Select - 0 = Pin B5 1 = Pin C5
OPTION_REG.6 = 1
#CONFIG
__config _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF
__config _CONFIG2, _PLLEN_OFF & _LVP_OFF
#ENDCONFIG
DEFINE OSC 8
ANSELA = 0
ANSELB = 0
ANSELC = 0
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_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 1500
DEFINE LCD_DATAUS 44
LED var PORTC.7
high LED
char Var word ' Storage for serial character
col Var Byte ' Keypad column
row Var Byte ' Keypad row
key Var Byte ' Key value
lastkey Var Byte ' Last key storage
bklt var PORTC.7
TRISC.7 = 0
bklt = 1
ADCON1 = 7 ' Set PORTA and PORTE to digital
Pause 500 ' Wait for LCD to startup
OPTION_REG.7 = 0 ' Enable PORTB pullups
key = 0 ' Initialize vars
lastkey = 0
Lcdout $fe, 1 ' Initialize and clear LCD display
lcdout $FE, $01, "LCD IS WORKING"
lcdout $FE, $C0, "LINE 2 WORKS 2"
pause 5000
LCdout $FE, $01
mainloop:
Lcdout $FE, $01, "..."
lcdout dec char ' Send char to display
Hserin [char] ' Get a char from serial port
Goto mainloop ' Do it all over again
End
Bookmarks