Mike G
03-18-2012, 06:14 PM
I'm having trouble getting the the FullDuplexSerial4portPlus_0v3 object to function as expected. I'm simply trying to echo the the Rx bytes to the PST. FullDuplexSerial work exactly as I expect, each byte is echoed to PST. The 4 port FullDuplexSerial4portPlus_0v3 object sends the same char (*) over and over again. The input device is a bar code reader. The expected receive packet is *1234*<cr><lf>. I'm guessing it might be the 6.25 MHz crystal which is messing up the bit timing, or I don't understand how to instantiate the 4 port driver, or I have a bug.
The idea is to use two barcode readers on either side of a Propeller powered POS terminal. I have two instances of FullDuplexSerial working great but I'd like to free up a COG. I'll take a few minutes to see if this is related to bit_ticks.
Does anyone see something obvious I'm missing?
Here's two commented unit test versions.
CON
_clkmode = xtal1 + pll16x
'_xinfreq = 6_250_000
_xinfreq = 5_000_000
PAD_RX = 16
PAD_TX = 17
ID_LEN = 17
LEFT_PORT = 3
VAR
byte id[ID_LEN]
byte port
DAT
lineBreak byte $13, $10, $0
OBJ
pad : "FullDuplexSerial4portPlus_0v3"
'pad : "FullDuplexSerial"
pst : "Parallax Serial Terminal"
PUB Main | char, frame, i, flag
pst.start(115200)
'pad.start(PAD_RX, PAD_TX, %0000, 115200)
pad.AddPort(LEFT_PORT, PAD_RX, PAD_TX, {
} pad#PINNOTUSED, pad#PINNOTUSED, pad#DEFAULTTHRESHOLD, pad#NOMODE, pad#BAUD115200)
pad.Start
pause(1000)
pst.str(string("Pad Debugger",13))
char := 0
frame := 0
i := 0
repeat
'char := pad.rx
char := pad.rx(LEFT_PORT)
pst.char(char)
pause(20)
PRI Pause(Duration)
waitcnt(((clkfreq / 1_000 * Duration - 3932) #> 381) + cnt)
return
PUB IsIdDelimiter(value)
' # * +
return lookdown(value: $23, $2A, $2B
The idea is to use two barcode readers on either side of a Propeller powered POS terminal. I have two instances of FullDuplexSerial working great but I'd like to free up a COG. I'll take a few minutes to see if this is related to bit_ticks.
Does anyone see something obvious I'm missing?
Here's two commented unit test versions.
CON
_clkmode = xtal1 + pll16x
'_xinfreq = 6_250_000
_xinfreq = 5_000_000
PAD_RX = 16
PAD_TX = 17
ID_LEN = 17
LEFT_PORT = 3
VAR
byte id[ID_LEN]
byte port
DAT
lineBreak byte $13, $10, $0
OBJ
pad : "FullDuplexSerial4portPlus_0v3"
'pad : "FullDuplexSerial"
pst : "Parallax Serial Terminal"
PUB Main | char, frame, i, flag
pst.start(115200)
'pad.start(PAD_RX, PAD_TX, %0000, 115200)
pad.AddPort(LEFT_PORT, PAD_RX, PAD_TX, {
} pad#PINNOTUSED, pad#PINNOTUSED, pad#DEFAULTTHRESHOLD, pad#NOMODE, pad#BAUD115200)
pad.Start
pause(1000)
pst.str(string("Pad Debugger",13))
char := 0
frame := 0
i := 0
repeat
'char := pad.rx
char := pad.rx(LEFT_PORT)
pst.char(char)
pause(20)
PRI Pause(Duration)
waitcnt(((clkfreq / 1_000 * Duration - 3932) #> 381) + cnt)
return
PUB IsIdDelimiter(value)
' # * +
return lookdown(value: $23, $2A, $2B