Hi again.
I'll try that, saw similar code to that in another place. One of the interesting things was recalling reading that decimal could be written normally ie. 255, bin used %11111111, hex used $FF, but I didn't think 24h was acceptable (in this flavor of picdom anyway).
I did try:
DEFINE HSER_BAUD 9600
DEFINE HSER_TXSTA 36
Start:
Hserout ["Bob Port Test",13,10]
END
'--------------------------------------
And I tried commenting those out, including the defines, changing PC baud to 2400 and using:
' 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
' Echo received characters in infinite loop
loop: Gosub charin ' Get a character from serial input, if any
If B1 = 0 Then loop ' No character yet
Gosub charout ' Send character to serial output
Goto loop ' 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
Endif
ciret: Return ' Go back to caller
' Subroutine to send a character to USART transmitter
charout: If PIR1.4 = 0 Then charout ' Wait for transmit register empty
TXREG = B1 ' Send character to transmit register
Return ' Go back to caller
'--------------------------------
And a few others that probably not worth including here.
I'll let you know how the code you sent works.
Best Regards,
Bobby
Bookmarks