Shop OBEX P1 Docs P2 Docs Learn Events
2 to 2p serial — Parallax Forums

2 to 2p serial

ArchiverArchiver Posts: 46,084
edited 2004-05-17 02:36 in General Discussion
Hello. I am having trouble getting the BS2p24 recieve serial commands from a BS2. I am attempting to do this at 9600 baud. I am not using flow control as it is not needed for this application. I previously used 2 BS2s, but would like the 2p to replace one for some other processing, and larger code space.
BS2 subroutine:

sendf:
Serout 1,16468, [noparse][[/noparse]"F"]
return

BS2p code:
SERIN 1, 16624, [noparse][[/noparse]my_var]
debug my_var

my_var is a byte-sized variable. Is this (16624) the right number to use for 9600 baud on the 2p? Is 16468 on the 2 not "true" 9600 baud, but a little faster, or slower? According the the basic stamp manual, these are the right numbers. Would it be more safe to communicate slower? The only wiring is P1 to P1, a common ground, and 5v from a regulator (7805). The same wiring works when I replace the 2p with a 2, and change the code accordingly. Thank you for any help.

John Baker
http://www.geocities.com/johnsrobotics/



Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-05-16 15:11
    An easy way to solve baud compatibility issues between different BASIC
    Stamp modules is to take advantage of the compiler's conditional
    compilation capabilities. This structure is built right into my
    template program so I never have to look-up baud rates.

    #SELECT $STAMP
    #CASE BS2, BS2E, BS2PE
    T1200 CON 813
    T2400 CON 396
    T4800 CON 188
    T9600 CON 84
    T19K2 CON 32
    T38K4 CON 6
    #CASE BS2SX, BS2P
    T1200 CON 2063
    T2400 CON 1021
    T4800 CON 500
    T9600 CON 240
    T19K2 CON 110
    T38K4 CON 45
    #ENDSELECT

    Inverted CON $4000
    Open CON $8000
    Baud CON T9600


    I have posted my template and other files that take advantage of
    conditional compilation in the File section on Yahoo Groups.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office





    Original Message
    From: John Baker [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=CVoG4wSUUdtq1LXRroasITUUYe1Uos7nOESXaq0x-1pyljEWd-67XC9iG_EnvttCRiKCCk4-YLej7qLV7LFiAJAD]johnbaker_erie_pa@y...[/url
    Sent: Saturday, May 15, 2004 12:39 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] 2 to 2p serial


    Hello. I am having trouble getting the BS2p24 recieve serial commands
    from a BS2. I am attempting to do this at 9600 baud. I am not using flow
    control as it is not needed for this application. I previously used 2
    BS2s, but would like the 2p to replace one for some other processing,
    and larger code space. BS2 subroutine:

    sendf:
    Serout 1,16468, [noparse][[/noparse]"F"]
    return

    BS2p code:
    SERIN 1, 16624, [noparse][[/noparse]my_var]
    debug my_var

    my_var is a byte-sized variable. Is this (16624) the right number to use
    for 9600 baud on the 2p? Is 16468 on the 2 not "true" 9600 baud, but a
    little faster, or slower? According the the basic stamp manual, these
    are the right numbers. Would it be more safe to communicate slower? The
    only wiring is P1 to P1, a common ground, and 5v from a regulator
    (7805). The same wiring works when I replace the 2p with a 2, and change
    the code accordingly. Thank you for any help.

    John Baker
    http://www.geocities.com/johnsrobotics/
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-16 23:20
    That saves a lot of time. Thanks.

    John Baker
    http://www.geocities.com/johnsrobotics/

    Jon Williams <jwilliams@p...> wrote:
    An easy way to solve baud compatibility issues between different BASIC
    Stamp modules is to take advantage of the compiler's conditional
    compilation capabilities. This structure is built right into my
    template program so I never have to look-up baud rates.

    #SELECT $STAMP
    #CASE BS2, BS2E, BS2PE
    T1200 CON 813
    T2400 CON 396
    T4800 CON 188
    T9600 CON 84
    T19K2 CON 32
    T38K4 CON 6
    #CASE BS2SX, BS2P
    T1200 CON 2063
    T2400 CON 1021
    T4800 CON 500
    T9600 CON 240
    T19K2 CON 110
    T38K4 CON 45
    #ENDSELECT

    Inverted CON $4000
    Open CON $8000
    Baud CON T9600


    I have posted my template and other files that take advantage of
    conditional compilation in the File section on Yahoo Groups.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office





    Original Message
    From: John Baker [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=fFnmX8PBm7JfljH1twyCAG_jgllJB79lt1TbhaXP8A_CGz73ZLQTXVdA3wJ-4xOojDnrf4bRSI4RzLSshDRV3Duz4ns]johnbaker_erie_pa@y...[/url
    Sent: Saturday, May 15, 2004 12:39 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] 2 to 2p serial


    Hello. I am having trouble getting the BS2p24 recieve serial commands
    from a BS2. I am attempting to do this at 9600 baud. I am not using flow
    control as it is not needed for this application. I previously used 2
    BS2s, but would like the 2p to replace one for some other processing,
    and larger code space. BS2 subroutine:

    sendf:
    Serout 1,16468, [noparse][[/noparse]"F"]
    return

    BS2p code:
    SERIN 1, 16624, [noparse][[/noparse]my_var]
    debug my_var

    my_var is a byte-sized variable. Is this (16624) the right number to use
    for 9600 baud on the 2p? Is 16468 on the 2 not "true" 9600 baud, but a
    little faster, or slower? According the the basic stamp manual, these
    are the right numbers. Would it be more safe to communicate slower? The
    only wiring is P1 to P1, a common ground, and 5v from a regulator
    (7805). The same wiring works when I replace the 2p with a 2, and change
    the code accordingly. Thank you for any help.

    John Baker
    http://www.geocities.com/johnsrobotics/



    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






    Do you Yahoo!?
    SBC Yahoo! - Internet access at a great low price.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-05-17 02:36
    Yahoo screws up the formatting -- us proper indenting to keep things
    nice, neat, and easy to read.

    Jon Williams


    Original Message
    From: John Baker [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=YNRRzyLjrVQZQac_e0E4x0gVIpnhxy13Ve1Lfaz1gZOtaGVgG6iL_59ZGTYXKBEmR3MPRohpCmhY6lRx4hgJYxhVPE4]johnbaker_erie_pa@y...[/url
    Sent: Sunday, May 16, 2004 5:21 PM
    To: basicstamps@yahoogroups.com
    Subject: RE: [noparse][[/noparse]basicstamps] 2 to 2p serial


    That saves a lot of time. Thanks.

    John Baker
    http://www.geocities.com/johnsrobotics/

    Jon Williams <jwilliams@p...> wrote:
    An easy way to solve baud compatibility issues between different BASIC
    Stamp modules is to take advantage of the compiler's conditional
    compilation capabilities. This structure is built right into my template
    program so I never have to look-up baud rates.

    #SELECT $STAMP
    #CASE BS2, BS2E, BS2PE
    T1200 CON 813
    T2400 CON 396
    T4800 CON 188
    T9600 CON 84
    T19K2 CON 32
    T38K4 CON 6
    #CASE BS2SX, BS2P
    T1200 CON 2063
    T2400 CON 1021
    T4800 CON 500
    T9600 CON 240
    T19K2 CON 110
    T38K4 CON 45
    #ENDSELECT

    Inverted CON $4000
    Open CON $8000
    Baud CON T9600


    I have posted my template and other files that take advantage of
    conditional compilation in the File section on Yahoo Groups.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office





    Original Message
    From: John Baker [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=YNRRzyLjrVQZQac_e0E4x0gVIpnhxy13Ve1Lfaz1gZOtaGVgG6iL_59ZGTYXKBEmR3MPRohpCmhY6lRx4hgJYxhVPE4]johnbaker_erie_pa@y...[/url
    Sent: Saturday, May 15, 2004 12:39 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] 2 to 2p serial


    Hello. I am having trouble getting the BS2p24 recieve serial commands
    from a BS2. I am attempting to do this at 9600 baud. I am not using flow
    control as it is not needed for this application. I previously used 2
    BS2s, but would like the 2p to replace one for some other processing,
    and larger code space. BS2 subroutine:

    sendf:
    Serout 1,16468, [noparse][[/noparse]"F"]
    return

    BS2p code:
    SERIN 1, 16624, [noparse][[/noparse]my_var]
    debug my_var

    my_var is a byte-sized variable. Is this (16624) the right number to use
    for 9600 baud on the 2p? Is 16468 on the 2 not "true" 9600 baud, but a
    little faster, or slower? According the the basic stamp manual, these
    are the right numbers. Would it be more safe to communicate slower? The
    only wiring is P1 to P1, a common ground, and 5v from a regulator
    (7805). The same wiring works when I replace the 2p with a 2, and change
    the code accordingly. Thank you for any help.

    John Baker
    http://www.geocities.com/johnsrobotics/
Sign In or Register to comment.