Shop OBEX P1 Docs P2 Docs Learn Events
SERIN, DEBUG, and baud rates — Parallax Forums

SERIN, DEBUG, and baud rates

agentileagentile Posts: 101
edited 2005-12-21 15:39 in BASIC Stamp
Hello,
· I am trying to figure out a way to use my computer keyboard as an input to my BS2, and also to have the PC terminal screen be a current output.· In short, I am trying to "build" a simple calculator to demonstrate the concept of overflow and also to point out the idiosyncracies in integer math.· In my manual, it states that the default 9600 baud rate is maybe too fast for the BS2.· So I reset the debug·terminal #1 to have a baud rate of 2400, and then I also set the baud rate of the SERIN command to be 2400.· Yet I get aliasing on the screen.· My guess is that DEBUG, which is actually SEROUT, has a default baud rate of 9600.· Is there a way to decrease the baud rate·of the terminal so that I can successfully·use SERIN with a baud rate of 2400?···

thanks,
Andrew

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-12-21 15:07
    Andrew -

    Take a look at the DEBUGIN command, in the PBASIC Help File or the PBASIC Stamp Manual, as I suspect that may solve your problem. DEBUGIN is basically intended for low volume keyboard input from the normal PBASIC Stamp Debug Terminal.

    Note: If you use the PBASIC Help File to obtain information on DEBUGIN, make sure to use ALL CAPS in the search argument (i.e. "DEBUGIN", not "debugin"). It will recognize the former properly, but not the latter. The powers that be claim that the necessity for CAPS is not a (Microsoft Help File) bug <shrug>, but it certainly then amounts to a rather unusual "feature" of an otherwise very helpful facility, IMHO. Additionally, I have ONLY tested this "problem" on Windows 98 SE so YMMV on other Microsoft Operating Systems.

    Regards,

    Bruce Bates
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-12-21 15:30
    Whoops, there's been a bit of a misunderstanding -- the BS2 can easily handle baud rates up to 50K or so.· I think what you're refering to is that the on-the-fly conversion modifiers (like DEC, which would be handy in your program) don't work well at rates above 9600 baud (the reason is that the Stamp has to work on the character it just received before the next shows up).

    That said, if you're going to be using a terminal for numberic input there will be a TON of time between characters (no matter how fast you type) and the Stamp will have ample time to process the incoming stream.· So, you don't have to reduce the baud rate, but in the event you decide you want to you can start with the little demo I've attached.· To use it with your DEBUG terminal, download the program, manually open a Debug window and set to your comm port, then reset the Stamp.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-12-21 15:34
    Also, you don't mention it, but you do understand that

    SEROUT 16, 2400, [noparse][[/noparse]"hi"]

    doesn't actually send at 2400 baud, right? There's a lookup table in the manual, depending on your BS2 flavor, which will give you the number to plug in for the '2400' above to get 2400 baud.

    And yes, the DEBUG and DEBUGIN statements are 'hard-wired' at 9600 baud.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-12-21 15:36
    To add a point of detail to Allan's comment on DEBUG and DEBUGIN, the BS2px uses 19.2k for programming and Debug-related operations -- all other BS2-family modules use 9600 baud.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • agentileagentile Posts: 101
    edited 2005-12-21 15:39
    Thanks for all the help, especially the program example.·



    Andrew
Sign In or Register to comment.