Shop OBEX P1 Docs P2 Docs Learn Events
Debug TERM window question - number format? — Parallax Forums

Debug TERM window question - number format?

bob_g4bbybob_g4bby Posts: 571
edited 2026-03-08 13:14 in PASM2/Spin2 (P2)

Does the debug TERM window only support the display of signed integer variables or what syntax do you use to display other forms like floating point?
Cheers, bob

Comments

  • evanhevanh Posts: 17,122

    The top three Web docs, written by Chip Gracey are the definitive documentation - https://www.parallax.com/propeller-2/documentation/
    Look in Chip's "Spin2 Language Documentation" Google Doc under section titled "Commands for use within DEBUG() statements."
    FDEC_(value) is what you're looking for to handle floats. Note the underscore. That tells the debugger to only print the value stored in the variable and not both the variable name and value.

    PS: I've exported the docs to PDFs for much faster perusing than trying to weld all that bloated Javascript in a web browser.

  • bob_g4bbybob_g4bby Posts: 571
    edited 2026-03-08 14:00

    @evanh , "I've exported the docs to PDFs for much faster perusing" - yes, so did I

    I had fdec in the wrong place and this then produces the right result:-

        debug(`Offsets 1   'Iaverage = `fdec(iaverage) ')
        debug(`Offsets 13  'Qaverage = `fdec(qaverage) ')
    

    The underscore seems to be optional - both produce this:-

    Thanks for the tip, bob

  • evanhevanh Posts: 17,122
    edited 2026-03-08 14:16

    Ah, I have it all landing in the terminal. No fancy pop-ups. I can then review the history at leisure.
    Formatting is debug("some text ",fdec_(value)," some more text ",udec_(value))
    Of course, I'm using it for code troubleshooting rather than a machine display.

  • I use the debug terminal a lot too, but like you say, you have to review the log offline because things are often flashing past in the terminal. I've started using the TERM window to view the variables in real time - in this case to monitor how Iaverage and Qaverage were iterating to a stable point. Spin Tools is the greatest for (a) very fast recompile (b) fast debug windows. We're so fortunate to have all these very useful 3rd party compilers.

  • evanhevanh Posts: 17,122

    I was trying to highlight the formatting. What I first said about use of underscore matters when formatted that way.

  • JonnyMacJonnyMac Posts: 9,723

    A while back Ray Allen expressed an interest in a DEBUG Terminal object and I needed one for a work project. It took a while to get PNut and Spin Tools synced, but now they are and the DEBUG Terminal window allows arbiraty color changes (as well as the original four sets) , which is something I wanted for my project. The demo looks like this.

    Since it's a P2 DEBUG window the app can call the window directly, but I think you'll find most output needs covered with the object methods.

  • That's gone straight into the toolbox, Jon, thank you.

Sign In or Register to comment.