Shop OBEX P1 Docs P2 Docs Learn Events
BSII: Table of Baud rates above 9600bps? — Parallax Forums

BSII: Table of Baud rates above 9600bps?

Vern GranerVern Graner Posts: 337
edited 2005-12-16 18:07 in BASIC Stamp
I recently was going to update one of my BSII programs to use 38.4kbps to talk to a uMP3 player. I went searching for the syntax for setting the BSII to 38.4kbps, but didn't find it. I looked in the online help file and the examples for SEROUT only show 9600 as the top speed. So, I dloaded the new help file attached to the "sticky" post here. It also only shows 9600. hmmm...

I then searched the forums here and did find some example code that includes a 38.4k baud statement, but I still couldn't find a reference with a list of the modes (i.e. 38.4k inverted, 38.4k normal etc.) If someone could direct me to the location of this info, i'd appreciate it. smile.gif

Vern

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
Senior Systems Engineer    | obviously incompetent so why are we
Texas Information Services | paying you? Of course,if the network
http://www.txis.com        | is up, then we obviously don't need
Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-12-16 17:42
    The top speed of the BS2 line is much higher than 9600 baud -- we limit the size of the table just for practical reasons.· In fact, the BASIC Stamp is cable of operating at ANY baud rate within its range.· The base formulas for each of the modules are in the help file and manual.· I've precalculated the baud values that I use frequently and have included them into my template (attached).· By using this template I don't have to worry about getting the baudmode value correct.

    Here's how you can calculate a custom baudmode parameter (taken from the help file):

    Baudmode Calculation:
    1. Determine the bit period (bits 0 - 11)
      • BS2, BS2e, and BS2pe = INT(1,000,000 ÷ baud rate) - 20
      • BS2sx and BS2p = INT(2,500,000 ÷ baud rate) - 20
      • BS2px = INT(4,000,000 ÷ baud rate) - 20

        Note: INT means 'Convert to integer.' -- drop the numbers to the right of the decimal point.
    2. Set data bits and parity (bit 13)
      • 8-bit / No Parity = 0
      • 7-bit / Even Parity = 8192
    3. Select polarity bit (bit 14)
      • True = 0
      • Inverted = 16384
    4. Select driven or open output (bit 15)
      • Driven = 0
      • Open = 32768

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Vern GranerVern Graner Posts: 337
    edited 2005-12-16 18:07
    Thanks Jon! That was just what I was looking for! smile.gif

    Vern

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
    Senior Systems Engineer    | obviously incompetent so why are we
    Texas Information Services | paying you? Of course,if the network
    http://www.txis.com        | is up, then we obviously don't need
    Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG
    
    
Sign In or Register to comment.