Shop OBEX P1 Docs P2 Docs Learn Events
Debugging variables throught the serial port — Parallax Forums

Debugging variables throught the serial port

Bryan K.Bryan K. Posts: 47
edited 2007-03-20 19:12 in Propeller 1
Does anyone know how to debug variables through the serial port using either the pc debug program, or the fullduplex object?

Comments

  • fred2fred2 Posts: 47
    edited 2007-03-16 08:14
    Have you had any success with the pcdebug program?· How do you configure Hyperterm to
    connect after the program is loaded into the demo board (if that is what you are using?).

    I was trying to execute the program according to Jon Williams article in the Object Exchange
    but no success.

    Fred2
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-16 12:46
    I assume when you say "the serial port" you mean the one set up for programming the Propeller.

    You can easily use the FullDuplexSerial.spin object and, in your initialization routine, call "ser.start(31,30,0,9600)" assuming that you've declared FullDuplexSerial as "ser" in an OBJ section.

    You can then use "ser.hex" to send hex or "ser.dec" to send decimal strings for any expression or variable value. You'll need to send end of line codes as well. For example, to display the address of the variable "x" and its value on a line along with a label do:
    ser.str(string("x @ ")) ' label
    ser.hex(@x,4)  ' address of x
    ser.str(string(" = "))
    ser.dec(x) ' value of x in decimal
    ser.str(string(13,10)) ' end of line
    


    Hyperterm should be configured for 9600 Baud, 8 bits, no parity, 1 stop bit, no handshaking. Other defaults are ok.

    PC_Debug gives you a nice front end for FullDuplexSerial, but Jon is using an older version that uses only 3 parameters for "start". I'm not sure why he uses a high Baud in his demo program. You should stick with something like 9600 Baud.

    Post Edited (Mike Green) : 3/16/2007 12:56:08 PM GMT
  • JamesxJamesx Posts: 132
    edited 2007-03-16 13:29
    I have had very good success using PC_Debug as a front end for FullDuplexSerial. As for the PC end, I generally use a freeware/shareware program called RealTerm. RealTerm presents some challenges as you get used to it, but I run the combo (Propeller<>RealTerm) at 230400 baud without difficulty. Also, it allows for choosing binary/hex/character/decimal data as you set up the view. I couldn't figure out how to do that with Hyperterminal.

    Another thing I like to do for debugging is set up a Prop Clip or something like that on a spare pair of pins. This reduces the fudge around factor of having to make sure a COM port is closed in one program (say RealTerm) before using that same COM port with the Propeller Tool to load the ram or eeprom.

    Jim C
  • Karl SmithKarl Smith Posts: 50
    edited 2007-03-16 15:07
    I am currently using the 3 transistor circuit, but I have no success with Hyper Terminal or Real Term, however debugging works fine with the Basic stamp software using the debug terminal.
  • Steve Hicks (N5AC)Steve Hicks (N5AC) Posts: 20
    edited 2007-03-16 16:06
    I'm using a product called Advanced Serial Port Terminal from Eltima (http://www.eltima.com/products/serial-port-terminal/). I've tried a bunch of programs and like this one the best. It's free to try and $40 to buy (I have no affiliation with these folks).

    One of the "tricks" I employ when debugging is to layout a VT100-style terminal screen (25 lines of 80 characters) and decide where I want to put various kinds of information on the screen. Then I send the escape sequences to clear the screen (ESC [noparse][[/noparse] 2 J) and position the cursor where I want it for a write of a line (ESC [noparse][[/noparse] row ; col H) and then write out my text. I use this do do a real-time status display of what's going on in my application.

    These escape sequences are a standard (defacto maybe) and can be found by searching the web for ANSI escape sequences or VT100 escape sequences and most terminal programs will display them ... I understand it seems like you are having a more fundamental problem at this point, but I'm assuming you will find that one. I have found some of the terminal programs are very persnickety about displaying data when all the control lines are not perfect and this is a real problem with some of them.

    Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Steve, N5AC
  • OzStampOzStamp Posts: 377
    edited 2007-03-17 08:51
    Hi
    Another really good terminal program is RealTerm
    Downlaod it from fro here for free. http://realterm.sourceforge.net/

    Check it out ... HyperTerminal is rubbish..


    Ronald Nollet Australia
  • tatatomtatatom Posts: 16
    edited 2007-03-17 10:45
    I can have the prop send serial out using similar to the above:

    ser.str(string("x @ ")) ' label
    ser.hex(@x,4) ' address of x
    ser.str(string(" = "))
    ser.dec(x) ' value of x in decimal
    ser.str(string(13,10)) ' end of line

    But how about sending to the prop? I've been trying everything I could think of. This Object programming is way different from what I'm used to.

    thanks

    Tom
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-17 13:10
    Look at FullDuplexSerial at routines like "rx", "rxcheck", "rxtime" to receive individual characters. There is also an object in the Propeller Object Exchange called "Extended Full Duplex Serial" which uses FullDuplexSerial and provides different kinds of formatting on receive.
  • Bryan K.Bryan K. Posts: 47
    edited 2007-03-20 19:12
    I have successfully gotten the PC debug to work, and will try to get the hex and decimal working. Thanks everyone.....
Sign In or Register to comment.