There's a typo in the SUART 'ReadByte()' routine. You need to change two lines of code. The original is this...
Code: Select all
Public Function Access ReadByte() As Byte
Dim Index, Pin, Mode As Byte
// get port, pin and mode...
Pin = FRX.Pin
FSR0 = FRX.AddrPort
Mode = FMode
Index = 8
ASM-
; look For start Bit...
movf INDF0, W ; <Read Bit>
btfsc Mode, 1
comf W
andwf Pin, W
btfss STATUS, Z
bra $ - 10
End ASM
HalfBT
ASM-
movf INDF0, W ; <Read Bit>
btfsc Mode, 1
comf W
andwf Pin, W
btfss STATUS, Z
bra $ - 24
you need to edit like this...
Code: Select all
ASM-
; look For start Bit...
movf INDF0, W ; <Read Bit>
btfsc Mode, 1
comf WREG ; <- *** changed from "W" ***
andwf Pin, W
btfss STATUS, Z
bra $ - 10
End ASM
HalfBT
ASM-
movf INDF0, W ; <Read Bit>
btfsc Mode, 1
comf WREG ; <- *** changed from "W" ***
andwf Pin, W
btfss STATUS, Z
bra $ - 24
Here is some test code which I simulated in ISIS, all now works as expected...
Code: Select all
Device = 18F452
Include "SUART.bas"
Dim ByteIn As Byte
UART.SetBaudrate(sbr9600)
UART.SetMode(umInverted)
UART.SetTX(PORTC.6)
UART.SetRX(PORTC.7)
While true
UART.Write("listening...",13,10)
ByteIn = UART.ReadByte()
UART.Write("Received '",ByteIn,"'",13,10)
Wend