I am somewhat new to PIC.
Am trying to use PBP, and Labusb to Labx1 to send a char over nullmodem cable (db9).
I send a "D" and get ascii chars 56 & 254 or various other chars depending on code. I have tried many,,, many dif combos but,,,, no good results.

Code follows (sorry for all the comented out statements (shows things that I tried and didn't work)).

Sending code:
Define LOADER_USED 1


' RESET_ORG can be set to move the BASIC program out of the way
' of any boot loader running from location 0, such as the
' Microchip USB boot loader
'Define RESET_ORG 800h



' Define LCD registers and bits
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1


ADCON1 = 15 ' Set PORTA and PORTE to digital
Low PORTE.2 ' LCD R/W line low (W)
Pause 100 ' Wait for LCD to start up




CLEAR ;read and write hardware USART
B1 VAR BYTE ;initialize USART
TRISC = %10111111 ;set TX (PORTC.6) to out, rest in
SPBRG = 25 ;set baud rate to 2400
RCSTA = %10010000 ;enable serial port and continuous receive
TXSTA = %00100000 ;enable transmit and asynchronous mode
'define hser_rcsta 90h
'define hser_txsta 20h
' define hser_txsta 24h
' define hser_spbrg 9fh
' baudcon=8

Define OSC 48 ' Core is running at 48MHz
define hser_baud 2400
Data_out var byte


Startup:
'b1 = 1
Data_out = "B"

Pause 500 ' Wait for LCD to startup

Lcdout $fe, 1 ' Initialize and clear display

LCDOUT "Pgm Starting"

Pause 500 ' Wait for LCD visual
;echo received characters in infinite loop
mainloop:
Pause 500 ' Wait .5 second

Lcdout $fe, $c0, "Sending ", data_out ' Move to line 2 and display
' Serout PORTC.6,0,[b1] not working is set to true mode
' txreg = b1
hserout[data_out]
' serout portc.6,4,["D"]
Pause 1000 ' Wait for LCD visual
END

Receiving code:

Define OSC 4 ' Core is running at 4MHz
Define LOADER_USED 1

' Define LCD registers and bits
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
ADCON1 = 7 ' Set PORTA and PORTE to digital
Low PORTE.2 ' LCD R/W line low (W)
OPTION_REG.7 = 0 ' Enable PORTB pullups





' CLEAR ;read and write hardware USART
' B1 VAR BYTE ;initialize USART
recchar var byte
TRISC = %10111111 ;set TX (PORTC.6) to out, rest in
' SPBRG = 25 ;set baud rate to 2400
RCSTA = %10010000 ;enable serial port and continuous receive
TXSTA = %00100000 ;enable transmit and asynchronous mode
define hser_rcsta 90h
' define hser_txsta 24h
' define hser_spbrg 9fh
' define baudcon=8


define hser_baud 2400

Startpgm:
Pause 500 ' Wait for LCD to startup

Lcdout $fe, 1 ' Initialize and clear display

' LCDOUT "Pgm Starting" , 10 ,13
recchar = "A"
' Lcdout $fe, $c0, "Rec=" ' Move to line 2 and display

;echo received characters in infinite loop
mainLOOP:

GOSUB CHARIN ;get a character from serial input, if any
IF recchar = "A" THEN mainLOOP ;no character yet
GOSUB CHAROUT ;send character to serial output
GOTO mainLOOP ;do it forever
;subroutine to get a character
;from usart receiver
CHARIN:
' B1 = 0 ;preset to no character received
IF PIR1.5 = 1 THEN ;if receive flag then...
' B1 = RCREG ;get received character to b1
recchar = rcreg
' hserin[recchar] ;get received character to serial_in
' serin portc.7,4,[recchar] ;get received character to serial_in
' b1 = 1
ENDIF
CIRET:
RETURN ;go back to caller
;subroutine to send a character
CHAROUT: ;to usart transmitter

Lcdout dec recchar ' LCD display
pause 2000
Lcdout $fe, 1 ' Initialize and clear display
recchar = "A"
' B1 = 0

' IF PIR1.4 = 0 THEN CHAROUT ;wait for transmit register empty
' TXREG = B1 ;send character to transmit register
RETURN ;Go back to caller
END