Testing in single step mode

Một phần của tài liệu Automating with SIMATIC s7 400 inside TIA portal publicis (2013) (Trang 619 - 622)

15.5 Testing the user program

15.5.4 Testing in single step mode

In the programming languages STL and SCL, you can test the program statement by statement in single step mode. The CPU is in the HOLD state in this case; the peripheral outputs should be switched off as a precaution. You can use breakpoints to stop the program at any desired position and test step-by-step.

Set breakpoints

You set the breakpoints for testing in single step mode in the program of the offline block. Click with the right mouse button at the beginning of the line in the gray ar- ea in front of the line number in which you wish to set a breakpoint and then select the Set breakpoint (STL) or Breakpoints > Set (SCL) command from the shortcut menu. Alternatively, double-click on the gray area. The breakpoint is then set and displayed on the Testing task card in the Breakpoints pallet.

You can set any number of breakpoints, but only activate one of the quantity which depends on the CPU for testing.

Breakpoints are not saved. If the project is closed, the breakpoints are lost.

Fig. 15.10 Program status in SCL representation

Moving to a breakpoint

In order to move to a breakpoint, double-click in the Breakpoints pallet on the breakpoint you wish to move to, or click on it with the right mouse button and select the Go to breakpoint command from the shortcut menu.

In order to move from one breakpoint to another, select (with the block open) the Online > Breakpoints > Next command in the main menu if the next breakpoint is to be jumped to, or Online > Breakpoints > Previous if the previous breakpoint is to be jumped to.

Activate breakpoints

The breakpoints must be activated to enable testing. Note that the single step func- tions “Step over”, “Step into” and “Run to cursor” also count as breakpoints. These functions can no longer be executed if the maximum number of breakpoints is acti- vated.

When activated, the breakpoint is transferred to the CPU. Program execution is car- ried out in RUN mode up to the first active breakpoint and then stops in HOLD mode. The STOP LED lights up permanently and the RUN LED flashes.

Caution! When testing in single step mode, the CPU if switched to HOLD mode during ongoing operation on the process. Make sure that no damage to property or injury to persons can occur!

You activate a specific breakpoint by selecting it in the program code or in the Breakpoints pallet and then the Enable breakpoint command from the shortcut menu. Alternatively; you can activate all breakpoints together in the Breakpoints pallet with the drop-down list under the Actions for all breakpoints icon.

Switching-on of test mode mode must be confirmed in a dialog window if it is not already switched on.

Status display

In the task window on the Testing task card in the PLC register pallet, you can mon- itor the values of the status bits and the CPU registers for the statement line at which program execution has stopped. All status bits, the accumulators, the ad- dress registers, and the data block registers are displayed.

Testing in single step mode

You can select the functions for testing in single step mode in the shortcut menu which you call up in the gray area in front of the line number or by clicking the cor- responding icons in the Breakpoints pallet (Fig. 15.11).

You can continue program testing in the following ways:

b Run

Continue program execution at normal processing rate up to next active break- point.

b Run to cursor

Continue program execution at normal processing rate up to the statement selected by the mouse pointer.

b Step over

The currently selected statement is executed, a switch is made to the next state- ment and then stopped.

b Step into

Call of a subordinate block and continuation of program execution in the called block.

b Step out

Continuation of program execution in the called block if the program execution in the called block was interrupted at a breakpoint.

Upon each stop, the PLC register pallet shows the current assignment of the status bits and the CPU registers.

If the online connection is canceled, all breakpoints are deactivated. You will be informed in this case that the CPU then returns to RUN mode.

Exit single step mode

To exit single step mode, you disable and remove the breakpoints – for example in the Breakpoints pallet using the Actions for all breakpoints icon – and deactivate the Test mode checkbox. The Enable output in RUN checkbox must be activated.

Subsequently click with the right mouse button in the gray column in front of the line number and select the Run command from the shortcut menu. The CPU then goes to RUN mode.

The icons from left to right:

Actions for all breakpoints

(Remove/Enable/Disable breakpoints) Set/delete breakpoint

Enable/disable breakpoint Run

Run to cursor Step over Step into Step out Fig. 15.11 Icons in the Breakpoints pallet

Một phần của tài liệu Automating with SIMATIC s7 400 inside TIA portal publicis (2013) (Trang 619 - 622)

Tải bản đầy đủ (PDF)

(747 trang)