Is it possible to send HEX bytes with BS1?
Falcon
Posts: 191
I'm trying to send 7 HEX BYTES to a PTZ camera. I have this working with the BS2 with this code:
However, I want to use the BS1. I adjusted the SEROUT statement format (parenthesis vs. Brackets) to this:
I the following note on page 415 of the Basic Stamp Manul:
"NOTE: The BS1's OutputData argument can only be a list of variables and the optional decimal modifier (#)."
Is there a work-arounf for this? Or do I have a formatting error?
Thanks,
falcon
HIGH RS485_Out PAUSE 10 ' Turn on 485 transmitter; wait briefly. SEROUT SIO,baud,[$FF,$02,$00,$02,$00,$20,$24] ' Id LOW RS485_Out ' Switch to receive mode.
However, I want to use the BS1. I adjusted the SEROUT statement format (parenthesis vs. Brackets) to this:
HIGH RS485_Out PAUSE 10 ' Turn on 485 transmitter; wait briefly. SEROUT SIO,baud,($FF,$02,$00,$02,$00,$20,$24) ' Id LOW RS485_Out ' Switch to receive mode.
I the following note on page 415 of the Basic Stamp Manul:
"NOTE: The BS1's OutputData argument can only be a list of variables and the optional decimal modifier (#)."
Is there a work-arounf for this? Or do I have a formatting error?
Thanks,
falcon
Comments
SEROUT SIO, baud, ($41)
are two ways to
send out %01000001
If the SERIN peripheral is set to interpret incoming data as ASCII characters, then the result is seen as an A.
If the SERIN peripheral is set to cache incoming data as numeric, then it'll have got the value transmitted: %01000001.
SEROUT SIO, baud, (#65)
will end up with a 65 printed on the SERIN perpheral.
Is that what you're driving at?
I have simple pan and tilt control working with the BS2 but I can get no camera movement with the BS1 with this code:
What if you use decimal values instead?
$FF,$02,$88,$00,$00,$00,$8A
vs.
255,2,136,0,0,0,138
[code]
baud CON 396 ' 8 bit No Parity True 2400-baud serial baudmode.
]/code]
The code does compile, but the camera does not respond.
falcon
SEROUT SIO, baud, (255,2,136,0)
SEROUT SIO, baud, (0,0,138)
Got it!
I found a wiring error. I had the BS2 mocked up on one breadboard and the BS1 on another. I must have pulled a wire when switching the programming cable back and forth.
I appreciate your help.
For the record, it did work with the one line of decimal numbers.
Thanks,
falcon
Does that mean that using Hex notation is a No-Go?
It did also work with the HEX BYTES after the wiring error was corrected.
I thought the BS1 could/should be able to send HEX BYTES. But I did run into a BS1 limitation on a previous project regarding a serial connection to an XBee so I thought this might be another. And that note in the BSM made me wonder.
Thank you both for your help.
falcon