I have tried with sending out data bytes that received from the modules to PC immediately but the data displayed on the PC is different from the data that I connected the module directly to PC. It seems like the data of the bytes stream corrupts when it passes through the PIC.
This is the testing code:
Code:
INCLUDE "modedefs.bas"
DEFINE LOADER_USED 1
DEFINE OSC 20
B0 VAR BYTE
'PB.7 = Rx, PB.6 = Tx
TRISB = %10000000
loop:
'4800 baud rate
'read byte from SpO2 module
SerIn2 PORTB.7,16572,[B0]
'send byte to PC
SerOut2 PORTB.6,16572,[B0]
GoTo loop
End
What should I do to avoid the data from crashing in Rx buffer of PIC UART, provided I cannot control over the stream of bytes received?
Bookmarks