24.01.2015 Views

PLC Programming

  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Graphic Editors...<br />

'Extras' 'Expand macro'<br />

With this command, the selected macro is re-expanded and the elements contained in it are inserted<br />

in the POU at the macro's location. The connections to the pins of the macro are again displayed as<br />

connections to the in- or outputs of the elements. If the expansion of the macro can not occur at the<br />

location of the macro box for lack of space, the macro is displaced to the right and down until enough<br />

space is available.<br />

Note:<br />

If the project is saved under project version number 2.1, the macros will likewise all be expanded. All<br />

macros will also be expanded before conversion into other languages.<br />

'Extras' 'One macro level back', 'Extras' 'All macro levels back'<br />

Symbols:<br />

These commands are also available in the toolbar, as soon as a macro is opened for editing. If<br />

macros are nested within one another, it is possible to switch to the next higher or to the highest<br />

display level.<br />

Feedback paths in CFC<br />

Feedback paths can only be displayed directly in the continuous function chart editor and not in the<br />

usual function block diagram editor. Here it should be observed that the output of a block always<br />

carries an internal intermediate variable. The data type of the intermediate variable results, for<br />

operators, from the largest data type of the inputs.<br />

The data type of a constant is obtained from the smallest possible data type, that is the constant '1'<br />

adopts the data type SINT. If now an addition with feedback and the constant '1' is executed, the first<br />

input gives the data type SINT and the second is undefined because of the feedback. Thus the<br />

intermediate variable is also of the type SINT. The value of the intermediate variable is only then<br />

allocated to the output variable.<br />

The diagram below shows an addition with feedback and an addition with a variable. The variables x<br />

and y should be of the type INT here.<br />

There are differences between the two additions:<br />

The variable y can be initialised with a value which is not equal to zero but this is not the case for<br />

intermediate variable for the left addition.<br />

The intermediate variable for the left addition has the data type SINT while that on the right has the<br />

data type INT. The variables x and y have different values after the 129 th call up. The variable x,<br />

although it is of the type INT, contains the value 127 because the intermediate variable has gone into<br />

overflow. The variable y contains the value 129, on the other hand.<br />

CFC in Online mode<br />

Monitoring:<br />

The values for inputs and outputs are displayed within the input or output boxes. Constants are not<br />

monitored. For non-boolean variables, the boxes are expanded to accommodated the values<br />

displayed. For boolean connections, the variable name as well as the connection are displayed in blue<br />

if the value is TRUE, otherwise they remain black.<br />

Internal boolean connections are also displayed Online in blue in the TRUE state, otherwise black.<br />

The value of internal non-boolean connections is displayed in a small box with rounded corners on the<br />

output pin of the connection.<br />

5-46 CoDeSys V2.3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!