10 - 1 10 - 1
MELSEC-Q
10 Program Debugging
10
10 PROGRAM DEBUGGING
Program debugging refers to the operation of checking whether an edited program will run
correctly and revise the program so that it runs correctly. (Debug = removing the bugs)
This section shows the sequence of program debugging and the instructions used in
debugging.
10.1 Sequence of Debugging Programs Executed Simultaneously in Multitasking
When executing multiple programs simultaneously (parallel operation in multitasking),
program debugging is generally performed in the following sequence.
1) Single debugging
• • • •
Execute the programs one at a time, and check each
program to see if it runs properly while specifying
various conditions that change the flow of execution.
2) Combination
debugging
• • • •
Group the programs together in several groups,
each consisting of multiple programs related to the
execution of one process.
Next, execute multiple programs in one group at a
time according to the specifications and check to
see if each program runs properly.
3) Overall debugging
• • • •
Execute all the programs according to the
specifications and check to see if each program
runs properly.
If each program runs according to the
specifications in an overall debugging, then the
debugging is complete.
10.2 Instructions Used when Debugging Programs
The following are typical instructions used when debugging BASIC programs.
See Chapter 11 for details on each instruction.
(1) TRON and TROFF instructions
The TRON instruction is used to follow the program flow. When the TRON
instruction is executed, the line numbers of lines that have been executed are
shown enclosed in square brackets. This makes it easy to see how the flow
branches due to the IF~GOTO instruction and how the instructions are repeated
due to the FOR~NEXT instruction.
Execute the TROFF instruction to stop the line number display.
10 C=10
RUN
20 FOR I=1 TO 3
[60][70][80] 1 14
30 C=C+1
[90][70][80] 2 15
40 NEXT I
[90][70][80] 3 16
50 TRON
[90][100] 17
60 FOR I=1 TO 3
OK
70 C=C+1
80 PRINT I;C
90 NEXT I
100 TROFF
110 C=C+1
120 PRINT C
130 END
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...