Shop OBEX P1 Docs P2 Docs Learn Events
how to detect if debug terminal available — Parallax Forums

how to detect if debug terminal available

verobelverobel Posts: 81
edited 2006-07-18 18:09 in BASIC Stamp
Fellow Stampers;
Sometimes you might want to run your program while attached to a pc where Debug window is available. Other times the Debug window may not be available (you are running the circuit on its own). How can you detect when no Debug window is available?
Thanks, John

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-17 15:24
    John,

    ·· There is currently no way to detect if the BASIC Stamp is connected to the computer and if a DEBUG window is open.· You could (in an OEM circuit) detect the connection to the computer using a clever circuit on the DB9, but that wouldn't tell you if the DEBUG window was·even open on the PC.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-07-17 17:50
    The typical way people do this is to have a SERIN 16 ... with a time-out early in their program. When the program comes up, it does a SEROUT prompt, then does a SERIN 16 ... waits for the time-out interval for a user to enter something on the debug terminal.

    If nobody enters anything, the time-out occurs and the program runs -- the programmer assuming that there's no debug terminal attached.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-17 18:35
    Allan,

    ·· That is of course if the program even accepts input.· I mean, if you had a program on the PC designed to communicate with the Stamp Module you could also do something.· But if the conversation is one-way there won't be a way.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • verobelverobel Posts: 81
    edited 2006-07-17 19:06
    Thanks for inputs guys..
    I like the idea of a time-out interval at the start of the program.. during which the user must input say 'Y' to activate a debugFlag=1. If he does nothing debugFlag=0.
    In my case I wanted to either accept input from Debug or from a pushbutton (if Debug was not there)

    So, how do you implement a time-out interval.. I thought DEBUG or SERIN just blocked the program until an input was received. Do you have a few lines of sample code?
    Thanks, John
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-07-17 19:25
    You can set the TIMEOUT parameter for the SERIN command.

    From the PBasic IDE help file:

    Timeout is an optional variable/constant/expression* (0 - 65535) that tells SERIN how long to wait for incoming data. If data does not arrive in time, the program will jump to the address specified by Tlabel.
  • verobelverobel Posts: 81
    edited 2006-07-17 19:40
    Ok, thanks..I didn't relize that parameter was there
  • SSteveSSteve Posts: 808
    edited 2006-07-18 18:09
    verobel said...
    Thanks for inputs guys..
    I like the idea of a time-out interval at the start of the program.. during which the user must input say 'Y' to activate a debugFlag=1. If he does nothing debugFlag=0.
    Just in case: If debugFlag is used in compiler directives, that approach won't work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows

    links:
    My band's website
    Our album on the iTunes Music Store
Sign In or Register to comment.