steprog
11-01-2010, 10:14 PM
Hi Guys,
I got an issue with the fullduplexserial object. I set up 3 uarts. One for going to the terminal, one for simulating data being sent to me, and one that communicates to some other equipment.
With 3 uarts and 3 different lines being used, I figured this would work, however my transmission goes out the same uart not three.
Here is the code Ignore the comments, I had to put them in to get my integration to work. Please forgive any sloppyness, really in a hurry.
Any ideas would be appreciated.
debug.start(pcDebugRX,pcDebugTX,Mode,pcDebugBaud) ' start the PC debug object
uart1.start(RX1,TX1,Mode, pcDebugBaud)
uart2.start(RX2,TX2,Mode, pcDebugBaud)
debug.rxflush
uart1.rxflush
uart2.rxflush
' Test Only
Checksum:=$24
ComByte:= $22
uart1.tx(Sync[0])
uart1.tx(Sync[1])
uart1.tx(Checksum)
uart1.tx(ComByte)
waitcnt(clkfreq*3 + cnt) ' wait for PC to reply
comtest:= uart2.rx
comtest2:= uart2.rx
'' debug.tx(13)
' display(string("Received"))
' debug.hex(comtest,2)
' debug.hex(comtest2,2)
' debug.tx(13)
if comtest == $CA and comtest2 == $35
' display(string("Good Sync "))
Checksum:= uart2.rx
ComByte:= uart2.rx
' debug.hex(Checksum,2)
' debug.str (@space)
' debug.hex(ComByte,2)
' debug.tx(13)
DoCheckSum
If DoCheckSum
ParcCommand
else
Error[1]:=$01
ParcCommand
CreateCheckSum
SendStatus
else
uart2.rxflush
PRI SendStatus
debug.tx(Sync[0])
debug.tx(Sync[1])
debug.tx(CheckSum)
debug.tx(ComByte)
debug.tx(Error[0])
debug.tx(Error[1])
debug.tx(Therm1[0])
debug.tx(Therm1[1])
debug.tx(Therm2[0])
debug.tx(Therm2[1])
debug.tx(Therm3[0])
debug.tx(Therm3[1])
debug.tx(Therm4[0])
debug.tx(Therm4[1])
{
display(string("transmit")) 'For USB output
debug.hex(Sync[0],2)
debug.hex(Sync[1],2)
debug.str (@space)
debug.hex(CheckSum,2)
debug.str (@space)
debug.hex(ComByte,2)
debug.str (@space)
debug.hex(Error[0],2)
debug.hex(Error[1],2)
debug.tx(13)
debug.hex(Therm1[0],2)
debug.hex(Therm1[1],2)
debug.str (@space)
debug.hex(Therm2[0],2)
debug.hex(Therm2[1],2)
debug.str (@space)
debug.hex(Therm3[0],2)
debug.hex(Therm3[1],2)
debug.str (@space)
debug.hex(Therm4[0],2)
debug.hex(Therm4[1],2)
debug.tx(13)
}
I got an issue with the fullduplexserial object. I set up 3 uarts. One for going to the terminal, one for simulating data being sent to me, and one that communicates to some other equipment.
With 3 uarts and 3 different lines being used, I figured this would work, however my transmission goes out the same uart not three.
Here is the code Ignore the comments, I had to put them in to get my integration to work. Please forgive any sloppyness, really in a hurry.
Any ideas would be appreciated.
debug.start(pcDebugRX,pcDebugTX,Mode,pcDebugBaud) ' start the PC debug object
uart1.start(RX1,TX1,Mode, pcDebugBaud)
uart2.start(RX2,TX2,Mode, pcDebugBaud)
debug.rxflush
uart1.rxflush
uart2.rxflush
' Test Only
Checksum:=$24
ComByte:= $22
uart1.tx(Sync[0])
uart1.tx(Sync[1])
uart1.tx(Checksum)
uart1.tx(ComByte)
waitcnt(clkfreq*3 + cnt) ' wait for PC to reply
comtest:= uart2.rx
comtest2:= uart2.rx
'' debug.tx(13)
' display(string("Received"))
' debug.hex(comtest,2)
' debug.hex(comtest2,2)
' debug.tx(13)
if comtest == $CA and comtest2 == $35
' display(string("Good Sync "))
Checksum:= uart2.rx
ComByte:= uart2.rx
' debug.hex(Checksum,2)
' debug.str (@space)
' debug.hex(ComByte,2)
' debug.tx(13)
DoCheckSum
If DoCheckSum
ParcCommand
else
Error[1]:=$01
ParcCommand
CreateCheckSum
SendStatus
else
uart2.rxflush
PRI SendStatus
debug.tx(Sync[0])
debug.tx(Sync[1])
debug.tx(CheckSum)
debug.tx(ComByte)
debug.tx(Error[0])
debug.tx(Error[1])
debug.tx(Therm1[0])
debug.tx(Therm1[1])
debug.tx(Therm2[0])
debug.tx(Therm2[1])
debug.tx(Therm3[0])
debug.tx(Therm3[1])
debug.tx(Therm4[0])
debug.tx(Therm4[1])
{
display(string("transmit")) 'For USB output
debug.hex(Sync[0],2)
debug.hex(Sync[1],2)
debug.str (@space)
debug.hex(CheckSum,2)
debug.str (@space)
debug.hex(ComByte,2)
debug.str (@space)
debug.hex(Error[0],2)
debug.hex(Error[1],2)
debug.tx(13)
debug.hex(Therm1[0],2)
debug.hex(Therm1[1],2)
debug.str (@space)
debug.hex(Therm2[0],2)
debug.hex(Therm2[1],2)
debug.str (@space)
debug.hex(Therm3[0],2)
debug.hex(Therm3[1],2)
debug.str (@space)
debug.hex(Therm4[0],2)
debug.hex(Therm4[1],2)
debug.tx(13)
}