Hexadecimal Serial Messages
Archiver
Posts: 46,084
Dear All
I am tryin to get RS 232 signals from the BS2 SX.The stamp will send
hexadecimal signals(7 byte size) of the form "FF 01 00 04 20 00 25"
Can I use the serial port avaiable with education board for this.Do
have to make any special connections??
Also will this code work(I mean is it ok if I send the hex message
like this)
SerString Var Byte(7)
SerString(0)=$FF
SerString(1)=$01
SerString(2)=$00
SerString(3)=$04
SerString(4)=$20
SerString(5)=$00
SerString(6)=$25
SEROUT 16, 240, [noparse][[/noparse]STR SerString\7]
I would be really grateful if any of you could help me
Best
Jimmy
I am tryin to get RS 232 signals from the BS2 SX.The stamp will send
hexadecimal signals(7 byte size) of the form "FF 01 00 04 20 00 25"
Can I use the serial port avaiable with education board for this.Do
have to make any special connections??
Also will this code work(I mean is it ok if I send the hex message
like this)
SerString Var Byte(7)
SerString(0)=$FF
SerString(1)=$01
SerString(2)=$00
SerString(3)=$04
SerString(4)=$20
SerString(5)=$00
SerString(6)=$25
SEROUT 16, 240, [noparse][[/noparse]STR SerString\7]
I would be really grateful if any of you could help me
Best
Jimmy
Comments
You can use the serial connector from the board of education to
transmit data between your computer and the basic stamp (I do this
all the time in my projects). However, when sending data from
your computer to the stamp, you have to take into account that
the stamp echoes all characters it receives. This is beacuse the
Rx and Tx pins are wired together on the stamp. If you use
a terminal program you have to turn local echo off or each character
will be displayed twice. If you make your own program, you have
to receive and discard the echoed characters.
Beside this, to conserve precious RAM I recommend using the
scratchpad RAM to hold data for transmission. The send loop
would look about like this:
for n = 0 to (datalen - 1)
get SPRST + n, tmp1 ' Scratch Pad Ram STart constant
serout TxD,BAUD,[noparse][[/noparse]tmp1]
next
seperatedly using the HEX modifier. To match your example (with spaces
between data bytes), I would add this to your code:
FOR idx = 0 TO 6
SEROUT 16, 240, [noparse][[/noparse]HEX2 serString(idx), " "]
NEXT
-- Jon Williams
-- Parallax
In a message dated 4/23/2003 12:11:39 AM Central Standard Time,
jimmy_prett@y... writes:
> Dear All
> I am tryin to get RS 232 signals from the BS2 SX.The stamp will send
> hexadecimal signals(7 byte size) of the form "FF 01 00 04 20 00 25"
> Can I use the serial port avaiable with education board for this.Do
> have to make any special connections??
> Also will this code work(I mean is it ok if I send the hex message
> like this)
> SerString Var Byte(7)
> SerString(0)=$FF
> SerString(1)=$01
> SerString(2)=$00
> SerString(3)=$04
> SerString(4)=$20
> SerString(5)=$00
> SerString(6)=$25
> SEROUT 16, 240, [noparse][[/noparse]STR SerString\7]
> I would be really grateful if any of you could help me
> Best
> Jimmy
>
[noparse][[/noparse]Non-text portions of this message have been removed]
Note 'Hex' may confuse some people. If you
use: SEROUT <pin>, <BaudMode>, [noparse][[/noparse]HEX <value>] then
<value> converted to one or more hex characters
will be output.
If you just output [noparse][[/noparse] $ff ], then the one byte
containing $ff will be output, which I believe
is what you intend.
--- In basicstamps@yahoogroups.com, "jimmy_prett" <jimmy_prett@y...>
wrote:
> Dear All
> I am tryin to get RS 232 signals from the BS2 SX.The stamp will
send
> hexadecimal signals(7 byte size) of the form "FF 01 00 04 20 00 25"
> Can I use the serial port avaiable with education board for this.Do
> have to make any special connections??
> Also will this code work(I mean is it ok if I send the hex message
> like this)
> SerString Var Byte(7)
> SerString(0)=$FF
> SerString(1)=$01
> SerString(2)=$00
> SerString(3)=$04
> SerString(4)=$20
> SerString(5)=$00
> SerString(6)=$25
> SEROUT 16, 240, [noparse][[/noparse]STR SerString\7]
> I would be really grateful if any of you could help me
> Best
> Jimmy