Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
160
Добавлен:
11.10.2020
Размер:
2.81 Mб
Скачать

Debugging, Online Functions...

2.3Debugging, Online Functions...

Sampling Trace

The Sampling Trace allows you to trace the value sequence of variables, depending upon the socalled trigger event. This is the rising edge or falling edge of a previously defined Boolean variable (trigger variable). CoDeSys permits the tracing of up to 20 variables. 500 values can be traced for each variable.

Debugging

The debugging functions of CoDeSys make it easier for you to find errors.

In order to debug, run the command 'Project' 'Options' and in the dialog box that pops up under Build options select activate option Debugging.

Breakpoint

A breakpoint is a place in the program at which the processing is stopped. Thus it is possible to look at the values of variables at specific places within the program.

Breakpoints can be set in all editors. In the text editors breakpoints are set at line numbers, in FBD and LD at network numbers, in CFC at POUs and in SFC at steps. No breakpoints can be set in function block instances.

Single step

Single step means:

In IL: Execute the program until the next CAL, LD or JMP command.

In ST: Execute the next instruction.

In FBD, LD: Execute the next network.

In SFC: Continue the action until the next step.

By proceeding step by step you can check the logical correctness of your program.

Single Cycle

If Single cycle has been chosen, then the execution is stopped after each cycle.

Change values online

During operations variables can be set once at a certain value (write value) or also described again with a certain value after each cycle (force value). In online mode one also can change the variable value by double click on the value. By that boolean variables change from TRUE to FALSE or the other way round, for each other types of variables one gets the dialog Write Variable xy, where the actual value of the variable can be edited.

Monitoring

In Online mode, all displayable variables are read from the controller and displayed in real time. You will find this display in the declarations and program editor; you can also read out current values of variables in the watch and receipt manager and in a visualization. If variables from instances of function blocks are to be monitored, the corresponding instance must first be opened.

In monitoring VAR_IN_OUT variables, the de-referenced value is output.

In monitoring pointers, both the pointer and the de-referenced value are output in the declaration portion. In the program portion, only the pointer is output:

+ --pointervar = '<'pointervalue'>'

POINTERs in the de-referenced value are also displayed accordingly. With a simple click on the cross or a double-click on the line, the display is either expanded or truncated.

2-24

CoDeSys V2.3

2 - What is What in CoDeSys

Example for Monitoring of Pointers

In the implementations, the value of the pointer is displayed. For de-referencing, however, the dereferenced value is displayed.

Monitoring of ARRAY components: In addition to array components indexed by a constant, components are also displayed which are indexed by a variable:

anarray[1] = 5 anarray[i] = 1

If the index consists of an expression (e.g. [i+j] or [i+1]), the component can not be displayed.

Please regard: If the maximum number of variables which can be monitored, has been reached, for each further variable instead of the current value the string "Too many monitoring variables" will be displayed.

Simulation

During the simulation the created PLC program is not processed in the PLC, but rather in the calculator on which CoDeSys is running. All online functions are available. That allows you to test the logical correctness of your program without PLC hardware.

Please regard: POUs of external libraries do not run in simulation mode.

Log

The log chronologically records user actions, internal processes, state changes and exceptions during Online mode processing. It is used for monitoring and for error tracing (see Online Functions).

CoDeSys V2.3

2-25

The Standard...

2.4The Standard...

The standard IEC 61131-3 is an international standard for programming languages of Programmable Logic Controllers.

The programming languages offered in CoDeSys conform to the requirements of the standard. According to this standard, a program consists of the following elements:

Structures (see Data Types)

POUs

Global Variables

The general language elements are described in the sections Identifier, Addresses, Types, Comments, and Constants.

The processing of a CoDeSys program starts with the special POU PLC_PRG. The POU PLC_PRG can call other POUs.

2-26

CoDeSys V2.3

Соседние файлы в папке 759-333