Debugging variables throught the serial port
Bryan K.
Posts: 47
Does anyone know how to debug variables through the serial port using either the pc debug program, or the fullduplex object?
Comments
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
·
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:
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
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
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
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
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