Shop OBEX P1 Docs P2 Docs Learn Events
DEBUGIN - possible to not stop execution — Parallax Forums

DEBUGIN - possible to not stop execution

John KauffmanJohn Kauffman Posts: 653
edited 2011-02-04 20:10 in BASIC Stamp
I want a loop to keep running until a variable goes >100. The variable is filled from DEBUGIN. DEBUGIN is within the loop so that it is checked with every loop.

But the loop should keep running when the user is not entering a value. Since DEBUGIN stops execution until a value is entered, the loop runs once and then stops, witing for a new debugin value.

In other words, is there a way to over-ride the characteristic of DEBUGIN that stops the code until a value comes in?


<code>
' objective: in this SELECTCASE... CASE flash ledRed until user enters a new value for debug.
' New value can be checked through SelectCase (not shown)

CASE >150 ' temp is extremely high
DO WHILE bytTemperature > 150
DEBUGIN DEC bytTemperature
HIGH ledRed
PAUSE 500
LOW ledRed
PAUSE 500
LOOP
</code>

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-03 17:02
    SERIN has a timeout feature that might be put to good use here. But be aware that the BASIC Stamp is a single-thread processor, which means that if something comes in when it's not sitting in a SERIN or DEBUGIN, it will be missed. Since most of your loop is spent in PAUSEs, that could be a problem. What might help is to make the SERIN timeout do double duty for your pausing.

    BTW, the proper tags to use for code blocks are [noparse]
    and
    
    [/noparse].

    -Phil
  • vaclav_salvaclav_sal Posts: 451
    edited 2011-02-04 20:10
    You enter the DO WHILE loop when CASE >150.
    You enter the body of the DO WHILE loop by testing the CASE variable again.
    Now the bytTemparature is set within the DO WHILE loop by DEBUGIN.
    ( Here you have the suggested option of timeout the DEBUIGIN)
    You continue execution of DO WHILE loop.
    If the DEBUGIN set the bytTemparature >150 the DO WHILE loop will be entered again and the DEBUGIN executed again.
Sign In or Register to comment.