Debug function in programming?

Posted by Eric Reed at 2/9/2001 9:10 PM EST

Coach on team #481, NASA Ames / De Anza High School, from De Anza High School and It could be you!.

Howdy,

Can somebody tell me how to get the debug function to spit out a decimal (rather than ascii). Let’s say we want to know the value of sensor1. I have tried:

debug sensor1 ’ I get ascii
debug #sensor1 ’ I get unrecognized character
debug "Sensor 1 = " sensor1 ’ yup, ascii
debug “#sensor1” 'I get #sensor1

Help!

Thanks,

Eric
Team 481

Posted by Matt Leese at 2/9/2001 9:42 PM EST

Other on team #73, Tigerbolt, from Edison Technical HS and Alstom & Fiber Technologies & RIT.

In Reply to: Debug function in programming?
Posted by Eric Reed on 2/9/2001 9:10 PM EST:

This is off the top of my head and with the disclaimer that I haven’t touched any of the control system this year but I believe what you want is:
debug ? sensor1

Then again, I could be totally out of it. Check the PBasic manual.

Matt

Posted by Joe Johnson at 2/9/2001 9:53 PM EST

Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.

In Reply to: Debug function in programming?
Posted by Eric Reed on 2/9/2001 9:10 PM EST:

By decimal I assume you mean the ascii for the
characters that display the value of the variable in
decimal.

variablename var byte

variablename = 0

Main:

debug hex2 variablename, " ", bin8 variablename, "
",dec variablename, " ",cr

variablename = variablename + 1

Goto Main

The above code would pin
00 00000000 0
01 00000001 1
02 00000010 2
03 00000011 3
04 00000100 4
05 00000101 5
06 00000110 6
07 00000111 7
08 00001000 8
09 00001001 9
0A 00001010 10
.
.
.
FE 11111110 254
FF 11111111 255
00 00000000 0
01 00000001 1
02 00000010 2
.
.
.

If you don’t have the PBASIC manual, buy one. I bought
Version 2.0 of the manual (new this year) and I am very
happy with it. It is a pretty big improvement over
Version 1.9 in my opinion. Worth the price.

Good luck.

Joe J.

Posted by Stephen at 2/9/2001 9:57 PM EST

Other on team #122, NASA Knights, from Grafton High School (Robotics team is at NHGS) and NASA.

In Reply to: Debug function in programming?
Posted by Eric Reed on 2/9/2001 9:10 PM EST:

here’s how you do it:

debug “var”, dec var, cr

where dec means decimal, hex would mean hexadecimal, etc.

Posted by Eric Reed at 2/11/2001 3:24 AM EST

Coach on team #481, NASA Ames / De Anza High School, from De Anza High School and It could be you!.

In Reply to: Debug function in programming?
Posted by Eric Reed on 2/9/2001 9:10 PM EST:

Thanks, all. That is exactly what I needed. For some reason the manual that comes with the kit does not properly address this (and many other things)

Eric.