Shop OBEX P1 Docs P2 Docs Learn Events
Baud rate conversion — Parallax Forums

Baud rate conversion

ArchiverArchiver Posts: 46,084
edited 2004-01-06 19:20 in General Discussion
Hi y'all,

I need to convert baud from 300 to 9600 before it goes in to a radio
transmitter (internal converter doesn't quite do the job from 300).

SO, no doubt this is easy enough for the BS2.
3007N1 to 96007N1.

I can use the 220ohm resistor to read in the RS232 data and could use
P16(the DB9 jack w/RS232 levels) to spit it out to the radio.

So, the next step beyond this is to just use a couple of MAX232 chips (or
other brand), but my issue, then, is the buffering. Is there an easy way to
buffer (if the chip doesn't do that for you?).

Also, would anyone know if a PC could pick up (at a short distance <6ft)
rs232 TTL levels out of the BS2?

Thanks
Sb

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-01-06 18:32
    Bad news, I'm afraid -- the BS2 does not
    do 7 data bits, no parity. The only options
    it supports are 8 data bits, no parity, or
    7 data bits, even parity.

    In theory, if your radio is not too fussy,
    you could set the BS2 to receive and send
    8 data bits, no parity -- then only send
    7 N 1 to the stamp. The last data bit will always
    be a 1 to the BS2 (as the stop bit is read as a
    data bit), but your radio should read the
    'set' last bit as the stop bit, and still
    be happy.

    Really you should then send 7 N 2, so there
    would be two stop bits -- one to be the last
    data bit, and one to be the 'idle' bit before
    the next byte starts.

    As to using TTL levels to the PC, it depends
    on the PC's 232 port circuit how it would work.

    --- In basicstamps@yahoogroups.com, "Brady,Steven [noparse][[/noparse]PYR]"
    <steven.brady2@e...> wrote:
    > Hi y'all,
    >
    > I need to convert baud from 300 to 9600 before it goes in to a radio
    > transmitter (internal converter doesn't quite do the job from 300).
    >
    > SO, no doubt this is easy enough for the BS2.
    > 3007N1 to 96007N1.
    >
    > I can use the 220ohm resistor to read in the RS232 data and could
    use
    > P16(the DB9 jack w/RS232 levels) to spit it out to the radio.
    >
    > So, the next step beyond this is to just use a couple of MAX232
    chips (or
    > other brand), but my issue, then, is the buffering. Is there an
    easy way to
    > buffer (if the chip doesn't do that for you?).
    >
    > Also, would anyone know if a PC could pick up (at a short distance
    <6ft)
    > rs232 TTL levels out of the BS2?
    >
    > Thanks
    > Sb
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-06 18:36
    My mistake on the baud...it is 300E71.

    I thought I had heard someone on here talk about the issues of newer laptops
    of the day and with the power constraints, how they've got to a 5V RS232
    rather than the 12Vswing.

    sb

    Original Message
    From: Allan Lane [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=jhJPLATCjdIZhawgt0aMooZiAfayLQS_GYGsQUSHAicW-5K15LJ9vB7JU-QuUJ2Sv-TzqyxgzrJI3ou2X1tGzHsP]allan.lane@h...[/url
    Sent: January 6, 2004 10:33
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: Baud rate conversion


    Bad news, I'm afraid -- the BS2 does not
    do 7 data bits, no parity. The only options
    it supports are 8 data bits, no parity, or
    7 data bits, even parity.

    In theory, if your radio is not too fussy,
    you could set the BS2 to receive and send
    8 data bits, no parity -- then only send
    7 N 1 to the stamp. The last data bit will always
    be a 1 to the BS2 (as the stop bit is read as a
    data bit), but your radio should read the
    'set' last bit as the stop bit, and still
    be happy.

    Really you should then send 7 N 2, so there
    would be two stop bits -- one to be the last
    data bit, and one to be the 'idle' bit before
    the next byte starts.

    As to using TTL levels to the PC, it depends
    on the PC's 232 port circuit how it would work.

    --- In basicstamps@yahoogroups.com, "Brady,Steven [noparse][[/noparse]PYR]"
    <steven.brady2@e...> wrote:
    > Hi y'all,
    >
    > I need to convert baud from 300 to 9600 before it goes in to a radio
    > transmitter (internal converter doesn't quite do the job from 300).
    >
    > SO, no doubt this is easy enough for the BS2.
    > 3007N1 to 96007N1.
    >
    > I can use the 220ohm resistor to read in the RS232 data and could
    use
    > P16(the DB9 jack w/RS232 levels) to spit it out to the radio.
    >
    > So, the next step beyond this is to just use a couple of MAX232
    chips (or
    > other brand), but my issue, then, is the buffering. Is there an
    easy way to
    > buffer (if the chip doesn't do that for you?).
    >
    > Also, would anyone know if a PC could pick up (at a short distance
    <6ft)
    > rs232 TTL levels out of the BS2?
    >
    > Thanks
    > Sb


    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/
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-06 18:50
    Baudrates: looks like this will work then.

    Buffering: How long a message are you wanting
    to send? How much time between bytes?

    Note the BS2 can only do one thing at a time.
    When it is recieving bytes, it can't send them.
    It can receive ONE byte, then send ONE byte,
    then recieve ONE MORE byte, etc. But if the
    BS2 is still sending when you want it to
    receive, it will drop the byte you just tried
    to send it.

    The BS2 has 26 bytes of memory. You can do:

    MyBuf VAR BYTE[noparse][[/noparse]26]
    I300_7E CON 27889 ' 300 Baud, 7E1, 'inverted'
    I9600_7E CON 24660 ' 9600 Baud, 7E1, 'inverted'

    MAIN:
    SERIN 16, I300_7E, [noparse][[/noparse]STR MyBuf\26\0]
    'ie -- Get bytes into MyBuf until 26, or CHR(0)
    SEROUT 16, I9600_7E, [noparse][[/noparse]STR MyBuf]
    GOTO MAIN

    'Note the '16' above indicates the built-in
    ' serial port. See the manual under 'SERIN' for
    ' non-inverted values (needed if you're using
    ' just a 22K ohm resistor to recieve)

    Note also the above assumes you're sending
    26 bytes or less packets, then it echos the
    packet. (You may also want a time-out
    parameter in the SERIN)

    --- In basicstamps@yahoogroups.com, "Brady,Steven [noparse][[/noparse]PYR]"
    <steven.brady2@e...> wrote:
    > My mistake on the baud...it is 300E71.
    >
    > I thought I had heard someone on here talk about the issues of
    newer laptops
    > of the day and with the power constraints, how they've got to a 5V
    RS232
    > rather than the 12Vswing.
    >
    > sb
    >
    >
    Original Message
    > From: Allan Lane [noparse][[/noparse]mailto:allan.lane@h...]
    > Sent: January 6, 2004 10:33
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: Baud rate conversion
    >
    >
    > Bad news, I'm afraid -- the BS2 does not
    > do 7 data bits, no parity. The only options
    > it supports are 8 data bits, no parity, or
    > 7 data bits, even parity.
    >
    > In theory, if your radio is not too fussy,
    > you could set the BS2 to receive and send
    > 8 data bits, no parity -- then only send
    > 7 N 1 to the stamp. The last data bit will always
    > be a 1 to the BS2 (as the stop bit is read as a
    > data bit), but your radio should read the
    > 'set' last bit as the stop bit, and still
    > be happy.
    >
    > Really you should then send 7 N 2, so there
    > would be two stop bits -- one to be the last
    > data bit, and one to be the 'idle' bit before
    > the next byte starts.
    >
    > As to using TTL levels to the PC, it depends
    > on the PC's 232 port circuit how it would work.
    >
    > --- In basicstamps@yahoogroups.com, "Brady,Steven [noparse][[/noparse]PYR]"
    > <steven.brady2@e...> wrote:
    > > Hi y'all,
    > >
    > > I need to convert baud from 300 to 9600 before it goes in to a
    radio
    > > transmitter (internal converter doesn't quite do the job from
    300).
    > >
    > > SO, no doubt this is easy enough for the BS2.
    > > 3007N1 to 96007N1.
    > >
    > > I can use the 220ohm resistor to read in the RS232 data and could
    > use
    > > P16(the DB9 jack w/RS232 levels) to spit it out to the radio.
    > >
    > > So, the next step beyond this is to just use a couple of MAX232
    > chips (or
    > > other brand), but my issue, then, is the buffering. Is there an
    > easy way to
    > > buffer (if the chip doesn't do that for you?).
    > >
    > > Also, would anyone know if a PC could pick up (at a short distance
    > <6ft)
    > > rs232 TTL levels out of the BS2?
    > >
    > > Thanks
    > > Sb
    >
    >
    > 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/
  • ArchiverArchiver Posts: 46,084
    edited 2004-01-06 19:20
    Well,

    This is my message format
    (you might remember this from the wind system I was working on some 6months
    ago)

    STX DDDSSS/dddsss/GGGENN ETX BCC EOT CR LF

    STX Star of Text character
    DDD 2Minute average direction
    SSS 2Minute average speed
    Ddd 10Minute average direction
    Sss 10Minute average speed
    GGG 10Minute maximum 5second scalar speed
    ENN Error code (NN for specific error)
    ETX End of transmission character
    BCC Block Check character
    EOT End of Text Character
    CR Carriage return
    LF Line feed

    I can use the STX (02H) with the wait(02H). I'll need all the bits and
    doo-dads up to the LF for the display at the other end.
    The only buffering I require is for the BS2. It has to wait 'a while' at
    300baud for the entire message to come in. As soon as it has a 'GOOD'
    message (complete message -- now losing the odd bit) it will then fire out
    the string at 9600baud.

    So I think that's 36characters in all plus the /'s and that's 38.
    Could I just suck in the entire string and then spit it out. Rather than
    parsing the string and then glueing it back together for outputting.

    All in all....the BS2 is just a 'handler!' Slow up the string and make sure
    all the bits are there and then fire it out again.
    I'm using this 'very basic' project to get my boss to buy on to stamps.

    sb

    Original Message
    From: Allan Lane [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=0VHbxOnNXAZyPalpZz3s8cjejAuUon5VXTuMFiKoDltlz_2ylJsSXj8E8jPvvOdhEiqU4D89WI7ppybeTBkCj_u4_xCT]allan.lane@h...[/url
    Sent: January 6, 2004 10:51
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Re: Baud rate conversion


    Baudrates: looks like this will work then.

    Buffering: How long a message are you wanting
    to send? How much time between bytes?

    Note the BS2 can only do one thing at a time.
    When it is recieving bytes, it can't send them.
    It can receive ONE byte, then send ONE byte,
    then recieve ONE MORE byte, etc. But if the
    BS2 is still sending when you want it to
    receive, it will drop the byte you just tried
    to send it.

    The BS2 has 26 bytes of memory. You can do:

    MyBuf VAR BYTE[noparse][[/noparse]26]
    I300_7E CON 27889 ' 300 Baud, 7E1, 'inverted'
    I9600_7E CON 24660 ' 9600 Baud, 7E1, 'inverted'

    MAIN:
    SERIN 16, I300_7E, [noparse][[/noparse]STR MyBuf\26\0]
    'ie -- Get bytes into MyBuf until 26, or CHR(0)
    SEROUT 16, I9600_7E, [noparse][[/noparse]STR MyBuf]
    GOTO MAIN

    'Note the '16' above indicates the built-in
    ' serial port. See the manual under 'SERIN' for
    ' non-inverted values (needed if you're using
    ' just a 22K ohm resistor to recieve)

    Note also the above assumes you're sending
    26 bytes or less packets, then it echos the
    packet. (You may also want a time-out
    parameter in the SERIN)

    --- In basicstamps@yahoogroups.com, "Brady,Steven [noparse][[/noparse]PYR]"
    <steven.brady2@e...> wrote:
    > My mistake on the baud...it is 300E71.
    >
    > I thought I had heard someone on here talk about the issues of
    newer laptops
    > of the day and with the power constraints, how they've got to a 5V
    RS232
    > rather than the 12Vswing.
    >
    > sb
    >
    >
    Original Message
    > From: Allan Lane [noparse][[/noparse]mailto:allan.lane@h...]
    > Sent: January 6, 2004 10:33
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Re: Baud rate conversion
    >
    >
    > Bad news, I'm afraid -- the BS2 does not
    > do 7 data bits, no parity. The only options
    > it supports are 8 data bits, no parity, or
    > 7 data bits, even parity.
    >
    > In theory, if your radio is not too fussy,
    > you could set the BS2 to receive and send
    > 8 data bits, no parity -- then only send
    > 7 N 1 to the stamp. The last data bit will always
    > be a 1 to the BS2 (as the stop bit is read as a
    > data bit), but your radio should read the
    > 'set' last bit as the stop bit, and still
    > be happy.
    >
    > Really you should then send 7 N 2, so there
    > would be two stop bits -- one to be the last
    > data bit, and one to be the 'idle' bit before
    > the next byte starts.
    >
    > As to using TTL levels to the PC, it depends
    > on the PC's 232 port circuit how it would work.
    >
    > --- In basicstamps@yahoogroups.com, "Brady,Steven [noparse][[/noparse]PYR]"
    > <steven.brady2@e...> wrote:
    > > Hi y'all,
    > >
    > > I need to convert baud from 300 to 9600 before it goes in to a
    radio
    > > transmitter (internal converter doesn't quite do the job from
    300).
    > >
    > > SO, no doubt this is easy enough for the BS2.
    > > 3007N1 to 96007N1.
    > >
    > > I can use the 220ohm resistor to read in the RS232 data and could
    > use
    > > P16(the DB9 jack w/RS232 levels) to spit it out to the radio.
    > >
    > > So, the next step beyond this is to just use a couple of MAX232
    > chips (or
    > > other brand), but my issue, then, is the buffering. Is there an
    > easy way to
    > > buffer (if the chip doesn't do that for you?).
    > >
    > > Also, would anyone know if a PC could pick up (at a short distance
    > <6ft)
    > > rs232 TTL levels out of the BS2?
    > >
    > > Thanks
    > > Sb
    >
    >
    > 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/


    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/
Sign In or Register to comment.