Shop OBEX P1 Docs P2 Docs Learn Events
Code Question — Parallax Forums

Code Question

ToonzakaToonzaka Posts: 10
edited 2008-06-11 21:46 in BASIC Stamp
I was looking at the code that came with the temperature sensor. I was justs curious exactly what this line did, and the purpose of it..

DEBUG SDEC4 TK, DEC5 Interval

Also what the lines...

GOSUB ComputeTemp
GOSUB RetrieveInterval

What does the DEBUG and SDEC4 and DEC5 mean and also teh GOSUB. Can someoen explain them to me. I am very new at programming. Thank you!

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-06-11 19:38
    "SDEC" is what they call a "pseudo-operation". It indicates to the "DEBUG" command that it should output "TK" as a "Signed Decimal" number, using 4 characters.

    Oh, and the "DEBUG" command tells the BS2 to 'print' out this information to the programming PC as "debug" information to the programmer.

    "GOSUB" is a keyword that means "go to this subroutine, and remember where you came from, so when in the subroutine you see the "RETURN" keyword, you come back here."
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-11 21:13
    You might also think of SDEC4 as a formatter for the DEBUG command. It specifies how to format the output. On a GOSUB, see Allan's response, however you should also make sure that there is a RETURN for each GOSUB in the program.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-11 21:46
    These are all documented in the PBasic manual which you can download from Parallax or buy in paper form.· Go to Parallax's main webpage, choose the Resources tab, then Downloads, then Stamp Documentation.
Sign In or Register to comment.