Shop OBEX P1 Docs P2 Docs Learn Events
Serial debug with positioning ability — Parallax Forums

Serial debug with positioning ability

MightorMightor Posts: 338
edited 2007-08-11 20:30 in Propeller 1
Hey there,

I am looking for a way to allow for my Debug output to be positioned the way you can with the PBASIC language. Has anyone implemented this for the serial port?
For example, I'd like to display a string like "PING Value: " at position 0,0 and then reprint the value at the end of that as it changes, rather than having it scroll line after line as new input arrives. I have no idea how something like that could even be implemented. Does anyone have something like this already? If so, great, I'd love a copy of it, if that's possible. If no one has this, does anyone know what I should look for to get started? I don't mind programming something like this, but I have no idea how to bootstrap myself [noparse]:)[/noparse]

I know this would be easier with an LCD or TV screen, but unfortunately this month's play money was spent getting my 2 Prop protoboards and some other Parallax toys.

Gr,
Mightor

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
| Any sufficiently advanced technology is indistinguishable from magic.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-11 18:02
    The control of positioning is usually on the PC end. If you're using a terminal emulator, you can probably use standard ANSI control character sequences embedded in your debug output strings to control the screen positioning. The specific characters depend on what kind of terminal your emulator is emulating (VT52, VT100, ANSI, etc.) Have a look at the w_text.spin windowed display driver for the Propeller. It uses similar control sequences for display positioning. For a terminal emulator, the control codes and what has to follow them is different, but the concept is the same.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-11 18:03
    You could just output to the PBASIC DEBUG screen and send the cursor controls that it recognizes. You don't have to be running a BASIC Stamp to do that.

    -Phil
  • MightorMightor Posts: 338
    edited 2007-08-11 18:09
    Phil Pilgrim (PhiPi) said...
    You could just output to the PBASIC DEBUG screen and send the cursor controls that it recognizes. You don't have to be running a BASIC Stamp to do that.

    -Phil
    I would if I knew what the codes were [noparse]:)[/noparse] The debug terminal I'd like to use is just a normal terminal window like Hyperterm.

    Mike,
    I cannot find this w_text.spin file you speak. I search the Object Exchange and my computer to no avail. Am I missing something?

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-11 18:20
    Look in the "sticky thread" called "Propeller Announcement and Thread Index stickies"
    under "Graham Stabler's Good Thread Index" in the section "Visual:" and you'll see
    a link to it.
  • MightorMightor Posts: 338
    edited 2007-08-11 18:26
    Thank you kind sir!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-08-11 18:57
    Mightor,

    The cursor control codes are in the help file for the PBASIC Editor. Search "CRSRX", and you should find them all. The PBASIC DEBUG terminal is very friendly and intuitive to use — much more so than HyperTerm. You do have to have the PBASIC editor running to launch it, though.

    -Phil
  • MightorMightor Posts: 338
    edited 2007-08-11 19:24
    Phil,

    I'm already starting to figure out the ANSI codes for controlling a terminal, it's actually a lot simpler than I had thought. I will need to write a wrapper for one of the FullDuplexSerial derivatives (not sure which one I'll end up picking, we'll see).
    It's really as simple as this:

    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    OBJ
      Debug: "FullDuplexSerial"
    
    PUB TestMessages
      '' send test messages
    
      Debug.start(31, 30, 0, 57600)
      Debug.str(string("I just got started", 10, 13))
      waitcnt(clkfreq + cnt)                                
      Debug.str(string(27, 91, "2J"))                       ' Clear the screen ESC[noparse][[/noparse]2J
      waitcnt(clkfreq + cnt)
      Debug.str(string(27, 91, "0;0H"))                     ' Move the cursor to 0,0 ESC[noparse][[/noparse]0;0H
    
    



    I Googled for the ANSI codes and a complete ASCII table. The w_text module made me realise that I actually don't need very much intelligence in my code, the terminal application does that for me. I just need to supply it with the positions I want to draw my text at.
    I prefer to use something like HyperTerm (or PuTTY in my case) instead of the (much easier to use) Basic Stamp debug window because it'd like it to be something that doesn't end up depending on one particular application to be able work. As long as the terminal can do ANSI, it'll be able to grok the output of my Object [noparse]:)[/noparse] (in theory, at least) This should be an interesting project for me to learn SPIN as well.

    Btw, there is no such thing as a VARARG function in SPIN, is there? Or is this as achievable as my previous question regarding returning references to an object instance? [noparse]:)[/noparse]

    Gr,
    Xander

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • deSilvadeSilva Posts: 2,967
    edited 2007-08-11 20:14
    Have you considered Aribas PropTerminal? Extremely easy and very powerful..
  • MightorMightor Posts: 338
    edited 2007-08-11 20:30
    deSilva said...
    Have you considered Aribas PropTerminal? Extremely easy and very powerful..
    I had not but it looks great [noparse]:)[/noparse] Thanks for that link [noparse]:)[/noparse]

    I will still continue to tinker with my ANSI terminal output object, if for no other reason than to learn SPIN [noparse]:)[/noparse]

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
Sign In or Register to comment.