Shop OBEX P1 Docs P2 Docs Learn Events
'DEBUG' command alternative in SX/B??? — Parallax Forums

'DEBUG' command alternative in SX/B???

DuctapemasterDuctapemaster Posts: 90
edited 2007-05-02 00:32 in General Discussion
I just got my SX lite kit today and I started learning some SX/B, but I noticed that there is no 'DEBUG' command anymore. Is there any way to display data on the computer instead of a display (like SEROUT to the computer)? I would prefer not to have to buy an LCD now that I already bought everything.

Any help is appreciated.

-Dan

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-01 01:45
    Dan,

    You can use SEROUT, just remember that everything is sent byte-by-byte. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-05-01 02:06
    Dan there isn't·a Debug function·like the BS2 on the SX. Debug is possible with the BS2 series, because it·has an eeprom that controls the pic or sx chip on a BS2 and thats also the reason the BS2 is so much slower than the SX.

    We use the SX-Key to to real-time debuging and SX-Sim to measure the time a routine takes and how many cycles it consumes. Unfortunatly the sx-key only allows 1 "BREAK"·statement to be used at a time, so we get around it by calling a subroutine that contains the "BREAK" statement. You declare it like this:

    BREAK_NOW········· Sub···· 0



    When you call the Subroutine, just add the line BREAK_NOW, without a GOSUB.



    (then the sub routine is)

    BREAK_NOW:
    BREAK
    RETURN

    Then use as many WATCH statements you need·to follow any of the variables like this:

    (I add them before the subroutine declerations)

    WATCH Var, #of Bits, UDEC· (unsigned decimal) look under help

    Also, there is more code examples within the SX-Key directory, inside the Examples folder and then under SXB.

    I wasted a lot of time trying to create some sort of BS2 like Debug. Just learn how to use the SX-Key Debug feature and SX-Sim and you will be able to do more than the BS2 Debug can.

    Bill




    Post Edited (Capt. Quirk) : 5/1/2007 2:10:56 AM GMT
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-05-01 02:15
    Keep in mind that WATCH is now an SX/B keyword as well as a compiler directive, so if you want the flexibility to specify the bits and format, you need to precede that command with \ to embed it as an assembly command; when using WATCH in SX/B, the default format is decimal.

    For example, if you have a word variable and you want to see the state of the bits you would do this in SX/B:

    \ WATCH myVar, 16, ubin
    



    If decimal mode is okay, you can simplify to:

    WATCH myVar
    
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-05-01 03:12
    Thanks guys, thats just what I wanted. I am building a thermometer with a DS1620 and I like to test my programming with the computer before I hook it up to displays. It's nice not to have to write extra code to drive them.

    Thanks again,

    Dan
  • Sparks-R-FunSparks-R-Fun Posts: 388
    edited 2007-05-01 23:54
    Although a very minor point, I believe that
    \ WATCH myVar, 16, ubin
    

    and
    WATCH myVar, 16, ubin
    

    are now equivalent statements.

    - Sparks
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-05-02 00:32
    Well, kick me in the teeth, they certainly are. Thanks for pointing that out, Sparks.
Sign In or Register to comment.