Shop OBEX P1 Docs P2 Docs Learn Events
Debug Command — Parallax Forums

Debug Command

wstaffordwstafford Posts: 2
edited 2012-11-28 17:10 in General Discussion
Can you plave more than variable on a debug command line?

Comments

  • davejamesdavejames Posts: 4,047
    edited 2012-11-26 11:54
    Hi wstafford - welcome to the Forum.

    I'm not too clear on your question. I would suggest going here:

    http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf

    on page 159, and read up on the DEBUG command. It does support various forms of output formatting.
  • wstaffordwstafford Posts: 2
    edited 2012-11-27 19:01
    I'm thinking about placeing two or more variables on the DEGUGode line.
    Example: DEBUG DEC? X, DEC? Y, BIN? Z
    I know that doesn't work and I've tried other punctuation. Nothing seem to work so I'm guessing you can't. Was just a thought being lazy.
  • davejamesdavejames Posts: 4,047
    edited 2012-11-27 19:30
    wstafford wrote: »
    I'm thinking about placeing two or more variables on the DEGUGode line.
    Example: DEBUG DEC? X, DEC? Y, BIN? Z
    I know that doesn't work and I've tried other punctuation. Nothing seem to work so I'm guessing you can't. Was just a thought being lazy.

    Sure you can:
    DEBUG "x = ", DEC x, "   y = ", DEC y, CR
    

    The above is a case where text and formatted numbers are output, and as you can see, there are 5 items on that line.

    Multiple items work just fine in my projects.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-11-28 14:26
    Welcome to the forums, wstafford. It is possible if you're still having issues that the PBASIC 2.5 directive is missing or malformed. Be sure to click the 2.5 icon in the editor toolbar to be sure you're using the PBASIC 2.5 syntax.
  • davejamesdavejames Posts: 4,047
    edited 2012-11-28 14:37
    Mr. Savage - I'm guessing by your comment that mulit-item DEBUG statements are v2.5 specific?

    Would not the Stamp IDE catch that if the OP had selected v2.0?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-11-28 16:07
    Sorry, by the way the question was written I couldn't tell if the code was meant for a BS1 or BS2 and usually ignore the 2.0 syntax altogether. In PBASIC 1.0 the formatters would be rejected, and in 2.5 they would not. Sometimes new programmers malform the syntax directive and some stuff doesn't compile right. It's just one of those heads up things. I think the editor defaults to 2.0 syntax if one isn't specified. In such cases perfectly formed code won't compile as expected or in some cases at all.

    The following code should work perfectly fine and doesn't generate an error in the IDE, yet it will not run as expected. Just something I try to keep customers on their toes about.
    ' {$STAMP BS2}
    ' ($PBASIC 2.5)
    DO
      HIGH 1
      PAUSE 100
      LOW 1
    LOOP
    

    This can leave new programmers frustrated and I have had many tech calls with something similar. Simply clicking the 2.5 icon fixes this code example.
  • davejamesdavejames Posts: 4,047
    edited 2012-11-28 16:39
    ...errrrrr, I'm a bit surprised that the IDE wouldn't pick up the parens as an error. Or is it because the apostrophe marks the line as a comment? But if it's considered a comment, then how can it be a directive? But....and how.....and....aarrrRRGGHHH - my head's imploding!!!!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-11-28 17:10
    Well, consider the DO and LOOP also being ignored in 2.0 even though they're valid syntax in 2.5. So it's just good to always use those buttons on the toolbar when possible.
Sign In or Register to comment.