Shop OBEX P1 Docs P2 Docs Learn Events
Baudrate/hyperterminal Question? — Parallax Forums

Baudrate/hyperterminal Question?

Dodge DakotaDodge Dakota Posts: 5
edited 2005-01-21 19:41 in BASIC Stamp
HI, I have 2 questions: First one is Baudrate (16624), not sure how i got this number but it's the only thing that works with the serial devices I'm playing with. Any Ideal what it is as far as 2400, 9600, or bps? Second one, well guess the firstone will answer that, Been trying to monitor the output of my stamp using hyperterminal at 9600 but have been able to so like i said finding out what 16624 is will fix that. I forgot how i found this value but it's the only on that works for me. Thanks for the help!

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2005-01-19 12:03
    If you are programming your Basic stamp, you are obviously using Pbasic!· Open up the Help file and look for serout/serin and there is a chart that lists the settings.
    They also include the equation for figuring it out!
    It's something like: (1000000/<desired baudrate>)-20

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-19 13:31
    Since serial IO is so common, I've put the following section into my standard template:

    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T1200       CON     813
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
        TMidi       CON     12
        T38K4       CON     6
      #CASE BS2SX, BS2P
        T1200       CON     2063
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
        TMidi       CON     60
        T38K4       CON     45
    #ENDSELECT
     
    SevenBit        CON     $2000
    Inverted        CON     $4000
    Open            CON     $8000
    Baud            CON     Inverted + T9600
    


    I've attached the entire template.· You can get this loaded every time you click on File\New by doing this:

    1. Download the file to your system.
    2. Start the BASIC Stamp IDE
    3. Click on Edit\Preferences...
    4. Click on the Files & Directories tab
    5. Click the Browse button next to the New file template text box
    6. Navigate to the file, click on Open
    7. Click OK to close the Properties dialog


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Dodge DakotaDodge Dakota Posts: 5
    edited 2005-01-19 13:52
    steve,

    Thanks! Looks like that where i found the number 16624.


    John,

    I have try the templete but couldn't get it to work with the device that i am working with. Thats why i'm try to figure out the bps of 16624 (which is 9600, 8-n-inverted) for BS2p24.


    But this does explain why i can monitor it using Hypertermal. Guess i will have to figure that out tonight.

    Thanks again for the help
  • Dodge DakotaDodge Dakota Posts: 5
    edited 2005-01-20 01:56
    ok, I've played around with my stamp, a bs2p24, and still can't monitor the serout through use of hyperterminal or a serial data logger program. I did switch to the templete posted above in Jon msg and got it working. Here a sample section of the code:

    Baud con inverted + T9600

    nul con $00
    soh con $01
    stx con $02
    eot con $04

    Main:
    serout 6, Baud, [noparse][[/noparse]nul, nul, nul, nul, nul, soh,"ZOO", stx,"AAHELLO",eot]
    End


    Pin 6 is connect straight to the device to display a msg on. This is how i know that it is working but i'm try to view the dat being sent to troubleshot another device that's giving me problems. Thanks again for the help.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-20 02:42
    how are you connecting to hyperterminal?

    Are you using the programming port or are you using some I/O pins.

    Using windows no doubt....be sure PBasic isn't using the comm port while you're trying to use hyperterminal.

    You should only have to: serout <pin>, <baud>,·("hello",CR)· and you should see a 'hello' pop up in the connect hyperterm window (of course, hyperterm has to be at the same baud rate!).

    If you are using a 'working' programming cable in to the programming port...then there's nothing you need to do to see anything.

    Try this even:

    temp=1

    debug·"Temp = ", DEC temp, CR
    You should see: Temp = 1 on your debug screen in Pbasic.
    You don't need the framing stuff to test for 'anything' coming on the screen.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Dodge DakotaDodge Dakota Posts: 5
    edited 2005-01-20 04:07
    I am using 2 computers, one to programming and one to monitor the output. The debug command works fine and all, but getting the serout on a pin through hyperterminal doesn't. i've tried taking out the invert and using just the 9600 & 2400 bps with out any luck with hyperterminal and serial port logger.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-20 12:11
    ok...I follow!

    ARe you sure you are going in to the proper pins on the hyperterm computer?
    You should be using an inverted serout to pin 2 on the DB9 and you should be using a true serin from pin 3 of the DB9.· **NOTE, you need a 22kohm resistor inline with the serin pin on your stamp to limit the 12Volt RS232 and prevent destroying your stamp pin!

    do you have a voltmeter?· If you put your meter on one of the serial pins you may not get a nice value to read, but you sure should see the meter jumping around trying to make the reading.· I use that to determine if anything at all is happeningon that pin!

    This is some simple script I'm using to talk to a modem:
    SEROUT 15, 16780,10,· [noparse][[/noparse]"AT", CR]
    SERIN· 14, 396, 2500, Error, [noparse][[/noparse]WAIT ("y")]
    Again, remembering that a 22kohm resistor is in series with the serin I/O line (pin14 in my case).

    AND....due to my luck with 50/50 choices....if you happen to have serout going to serial port pin 2 and serin going to serial port 3 and it still doesn't work....swap the wires!· Overall, the Tx at one end needs to go to the Rx at the other end!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Dodge DakotaDodge Dakota Posts: 5
    edited 2005-01-21 00:45
    ok, got it... had the pins backward but first time i tried it it didn't work... now it's working, with out the resistor... dont understand it but hey it's working now... Thanks again for the help. Now i can workon figureout the differences in serial out of the mpu.
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-21 01:12
    uhm....you'll have other replies wrt the resistor...

    But I'll tell you...the stamp pins aren't designed to take 12Volts....so we put a current limiting resistor inline to help protect the pins.

    The typical value is 22kohm.· I'd suggest you do use it....find whatever combination of resistors you have to make it happen.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • DaveFDaveF Posts: 62
    edited 2005-01-21 16:17
    I was just reading the manual for the SERIN command, and it said:

    NOTE:
    The 22 k resistor is not required if
    connecting to the SIN pin.

    GREAT info starting on page 381 about this.· I highly recommend you read it.

    If you are taking the serial into a regular IO pin, then you do need it.

    Dave
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-21 19:41
    here's what he said in one of his posts:
    Original poster said...
    I am using 2 computers, one to programming and one to monitor the output. The debug command works fine and all, but getting the serout on a pin through hyperterminal doesn't. i've tried taking out the invert and using just the 9600 & 2400 bps with out any luck with hyperterminal and serial port logger.
    So I made the assumption he was leaving the programming port connected (possibly debugging) and using 2 I/O pins for the monitor PC.
    But DaveF is right...read the manual and if you are using the programming port then you don't need the resistors!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
Sign In or Register to comment.