How to send and receive Long hex string (serial communication)
Archiver
Posts: 46,084
Hello friends:
Dose anyone know how to send and receive a serial string of 16 bytes
with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400, using
BS2? An example is 020E011001000000000000047C0CCDA5 in HEX.
My question is: how to set the baudmode? how to send the string by
SEROUT? how to receive this kind of string by SERIN?
Thanks.
Dose anyone know how to send and receive a serial string of 16 bytes
with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400, using
BS2? An example is 020E011001000000000000047C0CCDA5 in HEX.
My question is: how to set the baudmode? how to send the string by
SEROUT? how to receive this kind of string by SERIN?
Thanks.
Comments
online Help file (yes, that's a hint). You didn't specify inverted baud
mode or true. Assuming inverted, you can send 16 bytes like this:
SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
Now, are you wanting to send the 16 bytes as a string like in your
example? If yes, I think you'll have to do it in a loop:
FOR idx = 0 TO 15
SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
NEXT
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: zy93@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=f8jXj_TEn6v8yE55noxWvI4-jYXQM_sLbYgjNWMwx_yszPO3a-oRPsyaGn7y82yUycqxdqp2vCg]zy93@h...[/url
Sent: Tuesday, December 16, 2003 5:46 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string (serial
communication)
Hello friends:
Dose anyone know how to send and receive a serial string of 16 bytes
with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400, using
BS2? An example is 020E011001000000000000047C0CCDA5 in HEX.
My question is: how to set the baudmode? how to send the string by
SEROUT? how to receive this kind of string by SERIN?
Thanks.
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/basicstamps/
To unsubscribe from this group, send an email to:
basicstamps-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Try something like:
YourPin CON *whatever pin you want to use*
data1 VAR byte
data2 VAR byte
data* VAR byte
data16 VAR byte
SERIN YourPin,396, [noparse][[/noparse]hex data1,hex data2,hex data*,hex data16]
Of course, you need to include all 16 VARs in the serin statement and
declare them at the top. You didn't say inverted, so I assumed non-inverted
for the baud mode. The manul has a complete section on the SERIN command.
Jonathan
www.madlabs.info
Original Message
From: <zy93@h...>
To: <basicstamps@yahoogroups.com>
Sent: Tuesday, December 16, 2003 3:46 AM
Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string (serial
communication)
> Hello friends:
> Dose anyone know how to send and receive a serial string of 16 bytes
> with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400, using
> BS2? An example is 020E011001000000000000047C0CCDA5 in HEX.
> My question is: how to set the baudmode? how to send the string by
> SEROUT? how to receive this kind of string by SERIN?
> Thanks.
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
He was asking about 8-data bits, Even Parity.
I didn't think the BS2 did that.
AND, I've never seen the 'buffer\16' syntax used
on SEROUT -- I thought SEROUT ONLY did 8 data bits,
or 7 data bits even parity. If you try to send
16 bits from a buffer (buffer VAR BYTE(2)), which
byte goes first?
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> This is pretty easy and you'll find lots of good information in the
> online Help file (yes, that's a hint). You didn't specify inverted
baud
> mode or true. Assuming inverted, you can send 16 bytes like this:
>
> SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
>
> Now, are you wanting to send the 16 bytes as a string like in your
> example? If yes, I think you'll have to do it in a loop:
>
> FOR idx = 0 TO 15
> SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> NEXT
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> Sent: Tuesday, December 16, 2003 5:46 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
(serial
> communication)
>
>
> Hello friends:
> Dose anyone know how to send and receive a serial string of 16
bytes
> with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400,
using
>
> BS2? An example is 020E011001000000000000047C0CCDA5 in HEX.
> My question is: how to set the baudmode? how to send the string by
> SEROUT? how to receive this kind of string by SERIN?
> Thanks.
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
Any of our serial output commands will send a "string" of bytes, but it
can only send them as raw bytes and not formated with DEC, HEX, etc.
You can see the \bytes parameter in action with this demo.
buffer VAR Byte(3)
Setup:
buffer(0) = "A"
buffer(1) = "B"
buffer(2) = "C"
Send_It:
DEBUG CLS ' open DEBUG window
SEROUT 16, 84, [noparse][[/noparse]STR buffer\3] ' send three bytes
END
ABC will be displayed in the DEBUG window. Another mistake I made was
not including the STR modifier in my original post.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: allan.lane@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=MDZ2iOOzPoCudEPcgPVDOP1vaBktienR4Zs1NN67RL6WiLRFs0r3SWTxi0fj5tp6HWFg9_aUcvzFEU8S29uRvhio2CkB]allan.lane@h...[/url
Sent: Tuesday, December 16, 2003 12:06 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
(serial communication)
Say What?
He was asking about 8-data bits, Even Parity.
I didn't think the BS2 did that.
AND, I've never seen the 'buffer\16' syntax used
on SEROUT -- I thought SEROUT ONLY did 8 data bits,
or 7 data bits even parity. If you try to send
16 bits from a buffer (buffer VAR BYTE(2)), which
byte goes first?
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> This is pretty easy and you'll find lots of good information in the
> online Help file (yes, that's a hint). You didn't specify inverted
baud
> mode or true. Assuming inverted, you can send 16 bytes like this:
>
> SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
>
> Now, are you wanting to send the 16 bytes as a string like in your
> example? If yes, I think you'll have to do it in a loop:
>
> FOR idx = 0 TO 15
> SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> NEXT
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> Sent: Tuesday, December 16, 2003 5:46 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
(serial
> communication)
>
>
> Hello friends:
> Dose anyone know how to send and receive a serial string of 16
bytes
> with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400,
using
>
> BS2? An example is 020E011001000000000000047C0CCDA5 in HEX. My
> question is: how to set the baudmode? how to send the string by
> SEROUT? how to receive this kind of string by SERIN? Thanks.
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/basicstamps/
To unsubscribe from this group, send an email to:
basicstamps-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
came up last month, I posted a bit-bang subroutine to do it. 417
microseconds per bit. Look at the archive on 11/5/03, "Serial
output".
-- Tracy
>Say What?
>
>He was asking about 8-data bits, Even Parity.
>I didn't think the BS2 did that.
> > Hello friends:
>> Dose anyone know how to send and receive a serial string of 16
>bytes
>> with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400,
>using
>>
>
> > BS2?
=...
I try the ways you told, but they din't work. Could you please give
other suggestion?
BR, ZY
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> Sorry, I missed the even parity part.
>
> Any of our serial output commands will send a "string" of bytes,
but it
> can only send them as raw bytes and not formated with DEC, HEX, etc.
> You can see the \bytes parameter in action with this demo.
>
> buffer VAR Byte(3)
>
> Setup:
> buffer(0) = "A"
> buffer(1) = "B"
> buffer(2) = "C"
>
> Send_It:
> DEBUG CLS ' open DEBUG window
> SEROUT 16, 84, [noparse][[/noparse]STR buffer\3] ' send three bytes
> END
>
> ABC will be displayed in the DEBUG window. Another mistake I made
was
> not including the STR modifier in my original post.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: allan.lane@h... [noparse][[/noparse]mailto:allan.lane@h...]
>
> Sent: Tuesday, December 16, 2003 12:06 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
> (serial communication)
>
>
> Say What?
>
> He was asking about 8-data bits, Even Parity.
> I didn't think the BS2 did that.
>
> AND, I've never seen the 'buffer\16' syntax used
> on SEROUT -- I thought SEROUT ONLY did 8 data bits,
> or 7 data bits even parity. If you try to send
> 16 bits from a buffer (buffer VAR BYTE(2)), which
> byte goes first?
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > This is pretty easy and you'll find lots of good information in
the
> > online Help file (yes, that's a hint). You didn't specify
inverted
> baud
> > mode or true. Assuming inverted, you can send 16 bytes like this:
> >
> > SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
> >
> > Now, are you wanting to send the 16 bytes as a string like in
your
> > example? If yes, I think you'll have to do it in a loop:
> >
> > FOR idx = 0 TO 15
> > SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> > NEXT
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
Original Message
> > From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> > Sent: Tuesday, December 16, 2003 5:46 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
> (serial
> > communication)
> >
> >
> > Hello friends:
> > Dose anyone know how to send and receive a serial string of 16
> bytes
> > with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400,
> using
> >
> > BS2? An example is 020E011001000000000000047C0CCDA5 in HEX. My
> > question is: how to set the baudmode? how to send the string by
> > SEROUT? how to receive this kind of string by SERIN? Thanks.
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/basicstamps/
> >
> > To unsubscribe from this group, send an email to:
> > basicstamps-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
I try the ways you told, but they din't work. Could you please give
other suggestion?
BR, ZY
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> Sorry, I missed the even parity part.
>
> Any of our serial output commands will send a "string" of bytes,
but it
> can only send them as raw bytes and not formated with DEC, HEX, etc.
> You can see the \bytes parameter in action with this demo.
>
> buffer VAR Byte(3)
>
> Setup:
> buffer(0) = "A"
> buffer(1) = "B"
> buffer(2) = "C"
>
> Send_It:
> DEBUG CLS ' open DEBUG window
> SEROUT 16, 84, [noparse][[/noparse]STR buffer\3] ' send three bytes
> END
>
> ABC will be displayed in the DEBUG window. Another mistake I made
was
> not including the STR modifier in my original post.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: allan.lane@h... [noparse][[/noparse]mailto:allan.lane@h...]
>
> Sent: Tuesday, December 16, 2003 12:06 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
> (serial communication)
>
>
> Say What?
>
> He was asking about 8-data bits, Even Parity.
> I didn't think the BS2 did that.
>
> AND, I've never seen the 'buffer\16' syntax used
> on SEROUT -- I thought SEROUT ONLY did 8 data bits,
> or 7 data bits even parity. If you try to send
> 16 bits from a buffer (buffer VAR BYTE(2)), which
> byte goes first?
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > This is pretty easy and you'll find lots of good information in
the
> > online Help file (yes, that's a hint). You didn't specify
inverted
> baud
> > mode or true. Assuming inverted, you can send 16 bytes like this:
> >
> > SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
> >
> > Now, are you wanting to send the 16 bytes as a string like in
your
> > example? If yes, I think you'll have to do it in a loop:
> >
> > FOR idx = 0 TO 15
> > SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> > NEXT
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
Original Message
> > From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> > Sent: Tuesday, December 16, 2003 5:46 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
> (serial
> > communication)
> >
> >
> > Hello friends:
> > Dose anyone know how to send and receive a serial string of 16
> bytes
> > with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400,
> using
> >
> > BS2? An example is 020E011001000000000000047C0CCDA5 in HEX. My
> > question is: how to set the baudmode? how to send the string by
> > SEROUT? how to receive this kind of string by SERIN? Thanks.
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/basicstamps/
> >
> > To unsubscribe from this group, send an email to:
> > basicstamps-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
that is not working for you.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: zy93@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=faPSI-MFGmXpOzfZBDPEXhjgc4GxF5a_r__rFCh4wqgbnNqNun97H8APIQoT8zNQrHslSVlSVOWFFg]zy93@h...[/url
Sent: Wednesday, December 17, 2003 7:54 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
(serial communication)
Hello all:
I try the ways you told, but they din't work. Could you please give
other suggestion?
BR, ZY
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> Sorry, I missed the even parity part.
>
> Any of our serial output commands will send a "string" of bytes,
but it
> can only send them as raw bytes and not formated with DEC, HEX, etc.
> You can see the \bytes parameter in action with this demo.
>
> buffer VAR Byte(3)
>
> Setup:
> buffer(0) = "A"
> buffer(1) = "B"
> buffer(2) = "C"
>
> Send_It:
> DEBUG CLS ' open DEBUG window
> SEROUT 16, 84, [noparse][[/noparse]STR buffer\3] ' send three bytes
> END
>
> ABC will be displayed in the DEBUG window. Another mistake I made
was
> not including the STR modifier in my original post.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
>
Original Message
> From: allan.lane@h... [noparse][[/noparse]mailto:allan.lane@h...]
>
> Sent: Tuesday, December 16, 2003 12:06 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
> (serial communication)
>
>
> Say What?
>
> He was asking about 8-data bits, Even Parity.
> I didn't think the BS2 did that.
>
> AND, I've never seen the 'buffer\16' syntax used
> on SEROUT -- I thought SEROUT ONLY did 8 data bits,
> or 7 data bits even parity. If you try to send
> 16 bits from a buffer (buffer VAR BYTE(2)), which
> byte goes first?
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > This is pretty easy and you'll find lots of good information in
the
> > online Help file (yes, that's a hint). You didn't specify
inverted
> baud
> > mode or true. Assuming inverted, you can send 16 bytes like this:
> >
> > SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
> >
> > Now, are you wanting to send the 16 bytes as a string like in
your
> > example? If yes, I think you'll have to do it in a loop:
> >
> > FOR idx = 0 TO 15
> > SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> > NEXT
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
Original Message
> > From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> > Sent: Tuesday, December 16, 2003 5:46 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
> (serial
> > communication)
> >
> >
> > Hello friends:
> > Dose anyone know how to send and receive a serial string of 16
> bytes
> > with 1start bit, 8 databit,1 stop bit, even parity, baydrate 2400,
> using
> >
> > BS2? An example is 020E011001000000000000047C0CCDA5 in HEX. My
> > question is: how to set the baudmode? how to send the string by
> > SEROUT? how to receive this kind of string by SERIN? Thanks.
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/basicstamps/
> >
> > To unsubscribe from this group, send an email to:
> > basicstamps-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/basicstamps/
To unsubscribe from this group, send an email to:
basicstamps-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
I use PC to communicate with the control unit before by using VB. The
string like 020E011001000000000000047C0CCDA5. It works very well. But
now I am trying to use BS2 replace the PC. So I think the code should
be the same as before in order to communicate with the control
unit.The communication protocol requires: 8 databit, 1 stopbit, 2400,
even.
What code and baudmode here should be for BS2??
Thanks, ZY
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> Perhaps you should clarify your request or provide a snippet of code
> that is not working for you.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> Sent: Wednesday, December 17, 2003 7:54 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
> (serial communication)
>
>
> Hello all:
> I try the ways you told, but they din't work. Could you please give
> other suggestion?
> BR, ZY
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > Sorry, I missed the even parity part.
> >
> > Any of our serial output commands will send a "string" of bytes,
> but it
> > can only send them as raw bytes and not formated with DEC, HEX,
etc.
> > You can see the \bytes parameter in action with this demo.
> >
> > buffer VAR Byte(3)
> >
> > Setup:
> > buffer(0) = "A"
> > buffer(1) = "B"
> > buffer(2) = "C"
> >
> > Send_It:
> > DEBUG CLS ' open DEBUG window
> > SEROUT 16, 84, [noparse][[/noparse]STR buffer\3] ' send three bytes
> > END
> >
> > ABC will be displayed in the DEBUG window. Another mistake I made
> was
> > not including the STR modifier in my original post.
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
> >
Original Message
> > From: allan.lane@h... [noparse][[/noparse]mailto:allan.lane@h...]
> >
> > Sent: Tuesday, December 16, 2003 12:06 PM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex
string
> > (serial communication)
> >
> >
> > Say What?
> >
> > He was asking about 8-data bits, Even Parity.
> > I didn't think the BS2 did that.
> >
> > AND, I've never seen the 'buffer\16' syntax used
> > on SEROUT -- I thought SEROUT ONLY did 8 data bits,
> > or 7 data bits even parity. If you try to send
> > 16 bits from a buffer (buffer VAR BYTE(2)), which
> > byte goes first?
> >
> > --- In basicstamps@yahoogroups.com, "Jon Williams"
<jwilliams@p...>
> > wrote:
> > > This is pretty easy and you'll find lots of good information in
> the
> > > online Help file (yes, that's a hint). You didn't specify
> inverted
> > baud
> > > mode or true. Assuming inverted, you can send 16 bytes like
this:
> > >
> > > SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
> > >
> > > Now, are you wanting to send the 16 bytes as a string like in
> your
> > > example? If yes, I think you'll have to do it in a loop:
> > >
> > > FOR idx = 0 TO 15
> > > SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> > > NEXT
> > >
> > > -- Jon Williams
> > > -- Applications Engineer, Parallax
> > > -- Dallas Office
> > >
> > >
> > >
Original Message
> > > From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> > > Sent: Tuesday, December 16, 2003 5:46 AM
> > > To: basicstamps@yahoogroups.com
> > > Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
> > (serial
> > > communication)
> > >
> > >
> > > Hello friends:
> > > Dose anyone know how to send and receive a serial string of 16
> > bytes
> > > with 1start bit, 8 databit,1 stop bit, even parity, baydrate
2400,
> > using
> > >
> > > BS2? An example is 020E011001000000000000047C0CCDA5 in HEX. My
> > > question is: how to set the baudmode? how to send the string by
> > > SEROUT? how to receive this kind of string by SERIN? Thanks.
> > >
> > >
> > > To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > > from the same email address that you subscribed. Text in the
> > Subject
> > > and Body of the message will be ignored.
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > > To visit your group on the web, go to:
> > > http://groups.yahoo.com/group/basicstamps/
> > >
> > > To unsubscribe from this group, send an email to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > >
> > > Your use of Yahoo! Groups is subject to:
> > > http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> > >
> > > This message has been scanned by WebShield. Please report SPAM
to
> > > abuse@p...
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/basicstamps/
> >
> > To unsubscribe from this group, send an email to:
> > basicstamps-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
BASIC Stamp doesn't do eight bits and even parity. Dr. Tracy Allen
wrote a "bit-bang" rouitine that may help you. Here's a copy from
Tracy's original post on the subject:
Each bit at 2400 baud is 417 microseconds. You might be able to send
each byte with a subroutine such as the following. You have to enter
the subroutine with the word variable serword already loaded with the
11 bits that need to be transmitted, including the start bit, 8 data
bits, parity bit (your program has to calculate parity), and the stop
bit.
' word variable serit contains the assembled 11 bits
' right justified
' adjust the variable "padding" to get correct timing
' p1 is a dummy pulse that appears, just for timing.
' the out command takes about 220 microseconds,
' the pulsout takes another 220 microseconds, plus
' the length of the dummy pulse.
Send_2400:
output 0
out0=serword.bit10 ' start bit
pulsout 1,padding
out0=serword.bit9
pulsout 1,padding
out0=serword.bit8
pulsout 1,padding
out0=serword.bit7
pulsout 1,padding
out0=serword.bit6
pulsout 1,padding
out0=serword.bit5
pulsout 1,padding
out0=serword.bit4
pulsout 1,padding
out0=serword.bit3
pulsout 1,padding
out0=serword.bit2
pulsout 1,padding
out0=serword.bit1
pulsout 1,padding
out0=serword.bit0 ' stop bit
RETURN
A FOR-NEXT loop probably would not work, because the FOR-NEXT logic
takes about 800 microseconds.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: zy93@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=PnSdSsuAc1YuEARA7lwQ-rE9dgbqFvyA_2Cxw5H0YeI1FE34ROObc78L3SvY-tLL0FGAIluwXwU]zy93@h...[/url
Sent: Wednesday, December 17, 2003 8:20 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
(serial communication)
Hello:
I use PC to communicate with the control unit before by using VB. The
string like 020E011001000000000000047C0CCDA5. It works very well. But
now I am trying to use BS2 replace the PC. So I think the code should
be the same as before in order to communicate with the control
unit.The communication protocol requires: 8 databit, 1 stopbit, 2400,
even.
What code and baudmode here should be for BS2??
Thanks, ZY
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> Perhaps you should clarify your request or provide a snippet of code
> that is not working for you.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> Sent: Wednesday, December 17, 2003 7:54 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
> (serial communication)
>
>
> Hello all:
> I try the ways you told, but they din't work. Could you please give
> other suggestion?
> BR, ZY
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > Sorry, I missed the even parity part.
> >
> > Any of our serial output commands will send a "string" of bytes,
> but it
> > can only send them as raw bytes and not formated with DEC, HEX,
etc.
> > You can see the \bytes parameter in action with this demo.
> >
> > buffer VAR Byte(3)
> >
> > Setup:
> > buffer(0) = "A"
> > buffer(1) = "B"
> > buffer(2) = "C"
> >
> > Send_It:
> > DEBUG CLS ' open DEBUG window
> > SEROUT 16, 84, [noparse][[/noparse]STR buffer\3] ' send three bytes
> > END
> >
> > ABC will be displayed in the DEBUG window. Another mistake I made
> was
> > not including the STR modifier in my original post.
> >
> > -- Jon Williams
> > -- Applications Engineer, Parallax
> > -- Dallas Office
> >
> >
> >
> >
Original Message
> > From: allan.lane@h... [noparse][[/noparse]mailto:allan.lane@h...]
> >
> > Sent: Tuesday, December 16, 2003 12:06 PM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex
string
> > (serial communication)
> >
> >
> > Say What?
> >
> > He was asking about 8-data bits, Even Parity.
> > I didn't think the BS2 did that.
> >
> > AND, I've never seen the 'buffer\16' syntax used
> > on SEROUT -- I thought SEROUT ONLY did 8 data bits,
> > or 7 data bits even parity. If you try to send
> > 16 bits from a buffer (buffer VAR BYTE(2)), which
> > byte goes first?
> >
> > --- In basicstamps@yahoogroups.com, "Jon Williams"
<jwilliams@p...>
> > wrote:
> > > This is pretty easy and you'll find lots of good information in
> the
> > > online Help file (yes, that's a hint). You didn't specify
> inverted
> > baud
> > > mode or true. Assuming inverted, you can send 16 bytes like
this:
> > >
> > > SEROUT TxPin, 16780, [noparse][[/noparse]buffer\16]
> > >
> > > Now, are you wanting to send the 16 bytes as a string like in
> your
> > > example? If yes, I think you'll have to do it in a loop:
> > >
> > > FOR idx = 0 TO 15
> > > SEROUT TxPin, 16780, [noparse][[/noparse]HEX2 buffer(idx)]
> > > NEXT
> > >
> > > -- Jon Williams
> > > -- Applications Engineer, Parallax
> > > -- Dallas Office
> > >
> > >
> > >
Original Message
> > > From: zy93@h... [noparse][[/noparse]mailto:zy93@h...]
> > > Sent: Tuesday, December 16, 2003 5:46 AM
> > > To: basicstamps@yahoogroups.com
> > > Subject: [noparse][[/noparse]basicstamps] How to send and receive Long hex string
> > (serial
> > > communication)
> > >
> > >
> > > Hello friends:
> > > Dose anyone know how to send and receive a serial string of 16
> > bytes
> > > with 1start bit, 8 databit,1 stop bit, even parity, baydrate
2400,
> > using
> > >
> > > BS2? An example is 020E011001000000000000047C0CCDA5 in HEX. My
> > > question is: how to set the baudmode? how to send the string by
> > > SEROUT? how to receive this kind of string by SERIN? Thanks.
> > >
> > >
> > > To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > > from the same email address that you subscribed. Text in the
> > Subject
> > > and Body of the message will be ignored.
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > > To visit your group on the web, go to:
> > > http://groups.yahoo.com/group/basicstamps/
> > >
> > > To unsubscribe from this group, send an email to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > >
> > > Your use of Yahoo! Groups is subject to:
> > > http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> > >
> > > This message has been scanned by WebShield. Please report SPAM
to
> > > abuse@p...
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/basicstamps/
> >
> > To unsubscribe from this group, send an email to:
> > basicstamps-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to:
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
> To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/basicstamps/
To unsubscribe from this group, send an email to:
basicstamps-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Here is a more specific and tested routine that sends 2400 baud, 8
bits, even parity. The message Jon referred to was an earlier one
that had a general approach, not a specific solution.
send2400:
wx=mybyte
FOR i=0 TO 7
wx.bit8= wx0(i) ^ wx.bit8 ' calculate even parity
NEXT
wx = wx << 1 | 1 ' append start bit on right
wx=wx ^ %11011011011 ' pre-compensate for inversions to follow
OUT2= ~~~wx0(0) ' start bit
OUT2= ~~~wx0(1) ' data bit 0
OUT2= ~~~~wx0(2) ' the ~~~~ or ~~~ pad the time per bit
OUT2= ~~~wx0(3) ' they just eat up a little time
OUT2= ~~~wx0(4) ' to make it 417uS per bit average
OUT2= ~~~~wx0(5) ' and spread the difference over the 8 bits.
OUT2= ~~~wx0(6)
OUT2= ~~~wx0(7)
OUT2= ~~~~wx0(8) ' data bit 7
OUT2= ~~~wx0(9) ' even parity
OUT2= ~~~wx0(10) ' stop bit
RETURN
However, I see now in the subject line, your question is not only
"send" but "receive". I don't think the BS2 can do that because
there is simply not enough time to sync with a start bit. I think
the BS2p or 'pe might be able to do it, with help of the POLLWAIT 8
command. But the original BS2 does not have that command.
Otherwise, external hardware (MAX3110) will be needed with the Stamp.
The MAX3100 is a UART chip, and additional links and info can be
found here.. <http://www.emesys.com/BS2IrDA.htm>.
>As was pointed out [noparse][[/noparse]because I missed it in your original post], the
>BASIC Stamp doesn't do eight bits and even parity. Dr. Tracy Allen
>wrote a "bit-bang" rouitine that may help you. Here's a copy from
>Tracy's original post on the subject:
>
>Each bit at 2400 baud is 417 microseconds. You might be able to send
>each byte with a subroutine such as the following. You have to enter
>the subroutine with the word variable serword already loaded with the
>11 bits that need to be transmitted, including the start bit, 8 data
>bits, parity bit (your program has to calculate parity), and the stop
>bit.
>
>' word variable serit contains the assembled 11 bits
>' right justified
>' adjust the variable "padding" to get correct timing
>' p1 is a dummy pulse that appears, just for timing.
>' the out command takes about 220 microseconds,
>' the pulsout takes another 220 microseconds, plus
>' the length of the dummy pulse.
>
>Send_2400:
> output 0
> out0=serword.bit10 ' start bit
> pulsout 1,padding
> out0=serword.bit9
> pulsout 1,padding
> out0=serword.bit8
> pulsout 1,padding
> out0=serword.bit7
> pulsout 1,padding
> out0=serword.bit6
> pulsout 1,padding
> out0=serword.bit5
> pulsout 1,padding
> out0=serword.bit4
> pulsout 1,padding
> out0=serword.bit3
> pulsout 1,padding
> out0=serword.bit2
> pulsout 1,padding
> out0=serword.bit1
> pulsout 1,padding
> out0=serword.bit0 ' stop bit
> RETURN
>
>A FOR-NEXT loop probably would not work, because the FOR-NEXT logic
>takes about 800 microseconds.
>
>
>
>-- Jon Williams
>-- Applications Engineer, Parallax
>-- Dallas Office
>
>
>
>
>
>
>
Original Message
>From: zy93@h... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cnH88xl9EjoXkNsKXl5shnplkp9Bg8rlDCutT9Yy1qO9tx_YrWEA6K2YFqCO8RGA3gdiD3lLySBosHA]zy93@h...[/url
>Sent: Wednesday, December 17, 2003 8:20 AM
>To: basicstamps@yahoogroups.com
>Subject: [noparse][[/noparse]basicstamps] Re: How to send and receive Long hex string
>(serial communication)
>
>
>Hello:
>
>I use PC to communicate with the control unit before by using VB. The
>string like 020E011001000000000000047C0CCDA5. It works very well. But
>now I am trying to use BS2 replace the PC. So I think the code should
>be the same as before in order to communicate with the control
>unit.The communication protocol requires: 8 databit, 1 stopbit, 2400,
>even.
>What code and baudmode here should be for BS2??
>
>Thanks, ZY