Serial out packaging issue....?
Ollie
Posts: 7
I am trying to send the following hex data as a command to a RFID reader: 01 0b 00 03 04 62 00 00 00 6f 90
I'm using the bs2
I've tried sending it as:
serout so, baud, ($01, $0b......
I'm not getting a response from the RFID reader...?
Any ideas?
Thanks, Ollie
I'm using the bs2
I've tried sending it as:
serout so, baud, ($01, $0b......
I'm not getting a response from the RFID reader...?
Any ideas?
Thanks, Ollie
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
page 21 is where the specific packet info is we are using....
If it's a PC with a serial port, get the thing working that way with TI's help, then port it to a BS2 without their help.
Second question: Why didn't you use the "[font=Arial,Bold size=2]01 0B 00 03 04 62 01 00 00 6E 91" from the example?[/font]
[font=Arial,Bold size=2]·[/font]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
RX pin 6
TX pin 7
BAUD con 84
cmd var byte
Main:
DO
serout TX, BAUD, [noparse][[/noparse]$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90] <
This packet is for a slotted inventory request. page 20 of above mentioned link.
debug "sent"
Pause 2000
serin RX, BAUD, [noparse][[/noparse]cmd] <
never receive response from TI RFID READER
debug HEX ? cmd <
Just to see the value
LOOP
END
Now, you might give the SERIN command a 2 second timeout.
Just remember, the BS2 has NO UART buffer of any kind. It can ONLY recieve 232 when the code is sitting in a SERIN statement, waiting for it.
I am not a huge VB guy but it seems we have to send our hex out as a binary string.
value = %convertedValue <
value eqaul to hex [noparse][[/noparse]$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]
serout TX,BAUD,[noparse][[/noparse]value]
Resp VAR BYTE(6)
SEROUT SerPin, baudmode, [noparse][[/noparse]$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]
SERIN SerPin2, baudmode, [noparse][[/noparse]STR Resp\6]
And make sure you enter the SERIN immediately.
then you can print:
FOR I = 0 to 5
· DEBUG ? Hex Resp(I)
NEXT
DEBUG 13
·
serout· TX,BAUD,[noparse][[/noparse]$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]
what or how are these hex values getting sent?· Meaning does basic stamp convert them into binary, ascii or what?
With the following code we are stopped on the SERIN command waiting for some serial data.
·SEROUT· so, baud, [noparse][[/noparse]$01,$0b,$00,$03,$04,$62,$01,$00,$00,$00,$6E,$90]·· <---- still think·how we are sending this data is the·issue.···························· 1
··· SERIN·· si, baud, [noparse][[/noparse]STR Resp\6]
··· FOR I = 0 TO 5
····· DEBUG ? HEX Resp(I)·· <
·DOES NOT WORK HERE
····· NEXT
···· DEBUG 13· <---- what was this debug for that you put here?
The "DEBUG 13" was to insert a carriage return in your output.
And the result of your SEROUT would be the byte value for 1, the byte value for $0b, the byte value for $00, etc.
In other words, it would match what the spec is requesting.
The various "HEX" or "DEC" modfiers take the value and convert it into the String version of itself.
So, SEROUT .... [noparse][[/noparse]13] will output a CR character.
SEROUT ... [noparse][[/noparse]DEC 13] will output the string "13".
You might single-step the VB version to determine what EXACTLY (including checksum) is being sent by the program. It's also possible the device is returning data to you so fast that the SERIN misses the first character.
SEROUT so, baud, [noparse][[/noparse]$01,$0b,$00,$03,$04,$62,$00,$00,$00,$6F,$90]
SERIN si, baud, [noparse][[/noparse]STR Resp\9]
FOR x = 0 TO 8
DEBUG HEX ? Resp(x)
NEXT
DEBUG 13
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Remember, EVERYTHING in the digital world is only 1s and 0s. Microprocessors, themseves, can be thought of as streams with "gates" that direct the flows of 1s and 0s (sorry for the over-simplification, Chip, but my analogy generator is on the fritz). Anything else you see (even programs) is just a presentation of those 1s and 0s that makes more sense to our brains...
I need sleep...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...