GREAT TIP Global control for DEBUG on / off
Nauketec
Posts: 51
I have searched through the manuals and have not found a way to turn all DEBUGs on or off with one· = 1, ·or =0
one example is:
#IF Show_Debugs = 1· #THEN
DEBUG·· 2,0,4, "P0 - P3 ", BIN3 SelectMode
#ENDIF
I have been trying to change:
Show_Debugs = 1··
for Show_Debugs = OnOff
Then set· OnOff to 1 or 0 to have all the debug windows display or not.
It keeps saying that it is illegal or ....
Any Ideas
Daniel
Post Edited (Nauketec) : 8/29/2008 5:19:04 AM GMT
one example is:
#IF Show_Debugs = 1· #THEN
DEBUG·· 2,0,4, "P0 - P3 ", BIN3 SelectMode
#ENDIF
I have been trying to change:
Show_Debugs = 1··
for Show_Debugs = OnOff
Then set· OnOff to 1 or 0 to have all the debug windows display or not.
It keeps saying that it is illegal or ....
Any Ideas
Daniel
Post Edited (Nauketec) : 8/29/2008 5:19:04 AM GMT
Comments
(It's probably simpler just to define Show_Debugs as 0 or 1, though, and skip the OnOff bit.)
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 8/28/2008 6:59:47 PM GMT
#DEFINE showbugs = 1
or
#DEFINE showbugs = 0
"Define" is for setting constants that are only to be used with conditional #IF #THEN compilation statements.
See the Pbasic Manual·-- Advanced Compilation Techniques, and look for·conditional compilation. In my version of the manual it's on page 68.
Or do you want your flag (onoff) to be a VARIABLE that you can change at run-time (with a switch input or whatever) then you use regular if thens:
debugOnOff VAR bit (or a PIN input if you want to literally switch debugging on and off)
On CON 1
Off CON 0
IF debugOn = On THEN
·· DEBUG "Hello world.", CLREOL
ENDIF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
It seems by leaving out the = 0 or = 1 part in the
#IF Show_Debugs = 1 #THEN
'DEBUG 2,0,3, "any debug statement here"
#ENDIF
to read:
#IF Show_Debugs #THEN
'DEBUG 2,0,3, "any debug statement here"
#ENDIF
The single line·at the head of the program:
#DEFINE Show_Debugs = 1
or
#DEFINE Show_Debugs = 0
Will do the trick to turn all the DEBUG comments on or off
Thanks
Daniel
Post Edited (Nauketec) : 8/29/2008 5:38:12 AM GMT
Yup, you're right, of course: #DEFINE it is.
Nauketec,
'Sorry for the misdirection!
-Phil
The culture of sharing and learning here is a real comfort
Daniel
Post Edited (Nauketec) : 8/29/2008 5:39:07 AM GMT