|data||data to send to PC|
Cubloc supports RS-232 debugging with the Debug command. The user can insert Debug commands as desired within a program. The result of the Debug command is displayed on the Debug Terminal, which will automatically appear after the program is downloaded from Cubloc Studio.
Dim A AS Integer A = 123 Debug Dec A
Use Dec or Hex to convert numbers to strings for the Debug command. If you do not use Dec or Hex, numbers will be printed as raw ASCII, usually providing no useful output.If you insert a question mark (?) before Dec or Hex, the variable’s name will be printed before the value.
Debug Dec? A,Cr Debug Hex? A,Cr
You can also specify the number of characters to print.
Debug Hex8 A
The HEX command will accept 1 through 8. HEX8 will print as an 8 digit hexadecimal number. The DEC command will accept 1 through 10.
You are free to mix strings and numbers:
Debug "CHECK VALUE " Hex? A, Cr
The Debug command is useful for printing strings and numbers in a userfriendly format. During the execution of a Cubloc BASIC program, when the Debug command is encountered, the resulting values are immediately displayed on the debug terminal.
If you insert a Debug statement into a program and the debug terminal displays output, it verifies that the program has executed to that point. By using Debug commands, you will be able to detect the location of bugs in your program, and monitor variables changes in real time. You can send data to the download port of Cubloc by entering text in the upper text box of the debug terminal. This is useful for interactive communication with the Cubloc.
The Debug command may not be used while monitoring in Ladder Logic. Likewise, Ladder Logic monitoring can not be used while debugging using Debug statements.
The following is a chart of commands that can be used with the Debug command. You can control the debug terminal's output like an output screen or LCD.
|CLR||0||Clear Debug screen||Debug CLR|
|HOME||1||Move cursor to the upper left corner of the Debug screen||Debug HOME|
|GOXY||2||Move cursor to X, Y||Debug GOXY, 4, 3|
|CSLE||3||Move cursor one to the left|
|CSRI||4||Move cursor one to the right|
|CSUP||5||Move cursor one up|
|CSDN||6||Move cursor one down|
|BELL||7||Make beeping sound|
|LF||10||LINE FEED||Debug “ABC”,LF|
|CLRRI||11||Erase all characters on the right of cursor to the end of line.|
|CLRDN||12||Erase all characters on the bottom of cursor|
|CR||13, 10||Carriage Return (go to next line)||Debug “ABC”,CR|
Debug Goxy,5,5,Dec I Debug Clr,"TEST PROGRAM"