Set Debug On|Off
Set Debug is set to On by default.
You can use this command to control debugging functions in BASIC.
When you don’t need any debugging features, you can use this command to turn off all Debug commands instead of modifying every instance of of the Debug command. When this command is used, no Debug command will be compiled; they are simply discarded from the program.
When used correctly, the Debug command can help the user identify and fix bugs in a program. During a program's execution, variables can be monitored and verified, an LCD can be simulated, and do other tasks can be performed to increase development productivity.
Sometimes, do to programming errors, a program can be automatically reset. This condition can be verified using Debug.
Simply put a Debug statement at the beginning of your program, such as 'Debug “=========Reset=========” ' as shown below:
Const Device = CB280 Debug "==========Reset=========" Do High 0 Delay 200 Low 0 Delay 200 Loop
If the program is being reset, the “=========Reset=========” line will be printed more than once.
Simply insert a Debug command at the point in question, as shown below:
Const Device = CB280 Do High 0 Delay 200 Low 0 Delay 200 Loop Debug "This Part!"
The debug statement above will never execute, as the program will execute the Do…Loop indefinitely.
You can simulate an LCD using the Debug terminal. Simply use GoXY, XX, YY to access a particular location on the terminal as shown below:
Use the command Debug Clr to clear the debug window. At any time during development, you can remove all Debug statements from the program's compilation by using the Command Set Debug Off.