Continuous Function Chart Editor (CFC)

It looks like a block which has been produced using the continuous function chart editor (CFC):

Continuous Function Chart Editor (CFC) 1:

Editor for continuous function charts

No snap grid is used for the continuous function chart editor so the elements can be placed anywhere. Elements of the sequential processing list include blocks, input, output, jump, label, return and comments. The inputs and outputs of these elements can be connected by dragging a connection with the mouse. The connecting line will be drawn automatically. The shortest possible connection line is drawn taking into account existing connections. The connecting lines are automatically adjusted when the elements are moved. If the case arises where a connecting line cannot be drawn simply because of lack of space, a red line will be shown between the input and the associated output instead. This line will be converted into a connecting line just as soon as space is available.
One advantage of the continuous function chart as opposed to the usual function block diagram FBD editor is the fact that feedback paths can be inserted directly.
The most important commands can be found in the context menu

Cursor positions in the continuous function chart editor CFC

Each text is a possible cursor position. The selected text is shaded in blue and can be modified.
In all other cases the current cursor position is shown by a rectangle made up of points. The following is a list of all possible cursor positions with examples:
1. Trunks of the elements blocks, input, output, jump, label, return and comments.

Continuous Function Chart Editor (CFC) 2:

2. Text fields for the elements blocks, input, output, jump, label, return and comments as well as text fields for connection markers:

Continuous Function Chart Editor (CFC) 3:

3. Inputs for the elements block, input, output, jump and return:

Continuous Function Chart Editor (CFC) 4:

4. Outputs for the elements block and input:

Continuous Function Chart Editor (CFC) 5:

'Insert' 'Block' Shortcut: <Ctrl>+<B>

This command can be used to paste in operators, functions, function blocks and programs. First of all, it is always pasted in as an "AND" operator. This can be converted by Selection and Overwrite of the text into every other operator, into every function, into every function block and every program. The input assistance serves to select the desired block from the list of supported blocks. If the new block has another minimum number of inputs, these will be attached. If the new block has a smaller highest number of inputs, the last inputs will be deleted.

'Insert' 'Input' Shortcut: <Ctrl>+<E>

This command is used to insert an input. The text offered "???" can be selected and replaced by a variable or constant. The input assistance can also be used here.

'Insert' 'Output' Shortcut: <Ctrl>+<A>

This command is used to insert an output. The text offered "???" can be selected and replaced by a variable. The input assistance can also be used here. The value which is associated with the input of the output is allocated to this variable.

'Insert' 'Jump' Shortcut: <Ctrl>+<J>

This command is used to insert a jump. The text offered "???" can be selected and replaced by the jump label to which the program should jump.
The jump label is inserted using the command 'Insert 'Label'

'Insert' 'Label' Shortcut: <Ctrl>+<L>

This command is used to insert a label. The text offered "???" can be selected and replaced by the jump label. In Online mode a RETURN label for marking the end of POU is automatically inserted.
The jump is inserted using the command 'Insert 'Jump'

'Insert' 'Return' Shortcut: <Ctrl>+<R>

This command is used to insert a RETURN command.

Note that in Online mode a jump label with the name RETURN is automatically inserted in the first column and after the last element in the editor; in stepping, it is automatically jumped to before execution leaves the POU.

'Insert' 'Comment' Shortcut: <Ctrl>+<K>

This command is used to insert a comment.
You obtain a new line within the comment with <Ctrl> + <Enter>.

'Insert' 'Block Input' Shortcut: <Ctrl>+<U>

This command is used to insert a block input. The number of inputs is variable for many operators (e.g. ADD can have two or more inputs).
To increase the number of inputs for such an operator by one, the operator itself must be selected (Cursor position 1).

Insert’ ‘In-Pin’, ‘Insert’ ‘Out- Pin’

These commands are available as soon as a macro is opened for editing. They are used for inserting in- or out-pins as in- and outputs of the macro. They differ from the normal in- and outputs of POUs by the way they are displayed and in that they have no position index.

'Extras' 'Negate' Shortcut: <Ctrl>+<N>

This command is used to negate inputs, outputs, jumps or RETURN commands. The symbol for the negation is a small cross on the connection.
The input of the element block, output, jump or return is negated when it is selected (Cursor position 3)
The output of the element block or input is negated when it is selected (Cursor position 4).
A negation can be deleted by negating again.

'Extras' 'Set/Reset'

This command can only be used for selected inputs of the element output (Cursor position 3).
The symbol for Set is S and for Reset is R.

Continuous Function Chart Editor (CFC) 6:

VarOut1 is set to TRUE, if VarIn1 delivers TRUE. VarOut1 retains this value, even when VarIn1 springs back to FALSE.
VarOut2 is set to FALSE, if VarIn2 delivers TRUE. VarOut2 retains this value, even when VarIn2 springs back to FALSE.
Multiple activation of this command causes the output to change between Set, Reset and the normal condition.

'Extras' 'EN/ENO' Shortcut: <Ctrl>+<O>

This command is used to give a selected block (Cursor position 3) an additional Boolean enable input EN (Enable In) and a Boolean output ENO (Enable Out).

Continuous Function Chart Editor (CFC) 7:

ADD is only executed in this example when the Boolean variable "Bedingung" (condition) is TRUE. VarOut is also set to TRUE after ADD has been executed. ADD will not be executed when the variable "Bedingung" (condition) is FALSE and VarOut retains its value FALSE. The example below shows how the value ENO can be used for further blocks.

Continuous Function Chart Editor (CFC) 8:

x should initialized to 1 and y initialized to 0. The numbers in the right corner of the block indicate the order in which the commands are executed.
x will be increased by one until it reaches the value 10. This causes the output of the block LT(0) to deliver the value FALSE and SUB(3) and ADD(5) will be executed. x is set back to the value 1 and y is increased by 1. LT(0) is executed again as long as x is smaller than 10. y thus count the number of times x passes though the value range 1 to 10.

'Extras' 'Properties...'

Constant input parameters (VAR_INPUT CONSTANT) from functions and function blocks are not shown directly in the continuous function chart editor. These can be shown and their value can be changed when one selects the trunk of the block in question (Cursor position 1) and then selects the command ‚Extras' ‚Properties' or simply double clicks on the trunk. The dialog edit parameter opens:

Continuous Function Chart Editor (CFC) 9:

The values of the constant input parameter (VAR_INPUT CONSTANT) can be changed. Here it is necessary to mark the parameter value in the column Value. Another mouse click or pressing on the space bar allows this to be edited. Confirmation of the change to the value is made by pressing the <Enter> key or pressing <Escape> rejects the changes. The button OK stores all of the changes which were made.

Selecting Elements

One clicks on the trunk of the element (Cursor position 1) to select it.
To mark more elements one presses the <Shift> key and clicks in the elements required, one after the other, or one drags the mouse with the left hand mousekey depressed over the elements to be marked.
The command 'Extras' 'Select all' marks all elements at once.

Moving elements

One or more selected elements can be moved with the arrow keys as one is pressing on the <Shift> key. Another possibility is to move elements using a depressed left mousekey. These elements are placed by releasing the left mousekey in as far as they do not cover other elements or exceed the foreseen size of the editor. The marked element jumps back to its initial position in such cases and a warning tone sounds.

Copying elements

One or more selected elements can be copied with the command 'Edit' 'Copy' and inserted with the command 'Edit' 'Paste'.

Creating connections

An input of an element can be precisely connected to the output of another element. An output of an element can be connected to the inputs of a number of other elements.
There are a number of possibilities to connect the input of an element E2 with the output of an element E1.

Continuous Function Chart Editor (CFC) 10:

Place the mouse on the output of element E1 (Cursor position 4), click with the left mousekey, hold the left mousekey down and drag the mouse cursor onto the input of element E2 (Cursor position 3) and let the left mousekey go. A connection is made from the output of element E1 to the mouse cursor during this dragging operation with the mouse.
Place the mouse on the input of element E2, click with the left mousekey, hold the left mousekey down and drag the mouse cursor onto the output of element E1 and let the left mousekey go.
Move one of the elements E1 or E2 (Cursor position 1) and place it in such a way by letting go of the left mousekey that the output of element E2 and the input of element E1 touch.
Where element E2 is a block with a free input, a connection can also be made by dragging the mouse from an output from E1 to the trunk of E2. A connection with the free input at the highest position on E2 will be created when the mousekey is released. In the case where block E2 does not have a free input but is an operator which can have an input added to it, a new input will be automatically generated.
The output and input of a block can be connected together (feedback path) by using this method. To establish a connection between two pins, click with the left mouse button on one pin, hold the button down and thus drag the connection to the desired pin, where you then release the button. If during the dragging of the connection extends outside working area of the editor, scrolling occurs automatically. For simple data types, type testing is carried out during the connection. If the types of the two pins are not compatible, the cursor changes to „Forbidden“. For complex data types, no testing takes place.

Deleting connections

There are a number of possibilities for removing the connection between the output of an element E1 and the input of an element E2:
Select the output of element E1 (Cursor position 4) and press the <Delete> key or execute the command 'Edit' 'Delete'. Several connections will be removed at the same if the output of E1 is connected to more than one of inputs.
Select the input of element E2 (Cursor position 4) and press the <Delete> key or execute the command 'Edit' 'Delete'.
Select the input of E2 with the mouse, hold the left mousekey depressed and drag the connection from the input to E2 away. The connection is removed when the left mousekey is released in a free area of the screen.

Changing connections

A connection between the output of an element E1 and the input of an element E2 can easily be changed into a connection between the output of element E1 and the input of element E3. The mouse is clicked on the input of E2 (Cursor position 3), the left mousekey is kept depressed, the mouse cursor is moved to the input of E3 and then released.

'Extras' 'Connection marker'

Connections can also be represented by a connector (connection marker) instead of a connecting line. Here the output and the associated input have a connector added to them which is given a unique name.
Where a connection already exists between the two elements which should now be represented by connectors, the output of the connecting line is marked (Cursor position 3) and the menu point ‚Extras' ‚Connection marker' is selected. The following diagram shows a connection before and after the selection of this menu point.

Continuous Function Chart Editor (CFC) 11:

A unique name is given as standard by the program which begins with M, but which can be changed. The connector name is stored as an output parameter, but can be edited both at the input and at the output.

1. Edit the connectorname at the output: Continuous Function Chart Editor (CFC) 12:
If the text in the connector is replaced, the new connector name is adopted by all associated connectors at the inputs. One cannot, however, select a name which already belongs to another connection marker since the uniqueness of the connector name would be violated.

2. Edit the connectorname at the input: Continuous Function Chart Editor (CFC) 13:
If the text in the connector is replaced, the connection to the old connection marker will be deleted and a new connection will be created, or in other words only the name of another existing connection marker can be given.
Connections in connector representations can be converted to normal connections in that one marks the output of the connections (Cursor position 4) and again selects the menu point 'Extras' 'Connection marker'.

Insert inputs/outputs “on the fly”

If exactly one input or output pin of an element is selected, then the corresponding input- or output- element can be directly inserted and its editor field filled with a string by entering the string at the keyboard.

Order of execution

The elements block, output, jump, return and label each possess a number indicating the order in which they are executed. In this sequential order the individual elements are evaluated at run time.
When pasting in an element the number is automatically given according to the topological sequence (from left to right and from above to below). The new element receives the number of its topological successor if the sequence has already been changed and all higher numbers are increased by one.
The number of an element remains constant when it is moved.
The sequence influences the result and must be changed in certain cases.
If the sequence is displayed, the corresponding sequential execution number is shown in the upper right hand corner of the element.

'Extras' 'Order' 'Display'

This command switches the display of the order of execution on and off. The default setting is to show it (recognized by a tick in front of the menu point).
The relevant order of execution number appears in the upper right hand corner for the elements block, output, jump, return and label.

'Extras' 'Order' 'Order topologically'

Elements are ordered in a topological sequence when the execution takes place from left to right and from above to below, that is the number increases from left to right and from above to below for topologically arranged elements. The connections are not relevant, only the location of the elements is important.
All selected elements are topologically arranged when the command 'Extras' 'Order' 'Order topologically' is executed. All elements in the selection are taken out of the sequential processing list by this process. The elements are then entered into the remaining sequential processing list individually from bottom right through to upper left. Each marked element is entered into the sequential processing list before its topological successor, i.e. it is inserted before the element that in a topological sequencing would be executed after it, when all elements in the editor were sequenced according to a topological sequencing system. This will be clarified by an example.

Continuous Function Chart Editor (CFC) 14:

The elements with numbers 1, 2 and 3 are selected. If the command 'Order topologically' is selected the elements are first taken out of the sequential processing list. Var3, the jump and the AND-operator are then inserted again one after the other. Var3 is placed before the label and receives the number 2. The jump is then ordered and receives the number 4 at first but this then becomes 5 after the AND is inserted. The new order of execution which arises is:

Continuous Function Chart Editor (CFC) 15:

When a newly generated block is introduced it will be placed by default in front of its topological successor in the sequential processing list.

'Extras' 'Order' 'One forwards'

With this command all selected elements with the exception of the element which is at the beginning of the sequential processing list are moved one place forwards in the sequential processing list.

'Extras' 'Order' 'One backwards'

With this command all selected elements with the exception of the element which is at the end of the sequential processing list are moved one place backwards in the sequential processing list.

'Extras' 'Order' 'To the beginning'

With this command all selected elements will be moved to the front of the sequential processing list whereby the order within the group of selected elements is maintained. The order within the group of unselected elements also remains the same.

'Extras' 'Order' 'To the end'

With this command all selected elements will be moved to the end of the sequential processing list whereby the order within the group of selected elements is maintained. The order within the group of unselected elements also remains the same.

'Extras' 'Order' 'Order everything according to data flow'

This command effects all elements. The order of execution is determined by the data flow of the elements and not by their position.
The diagram below shows elements which have been ordered topographically.

Continuous Function Chart Editor (CFC) 16:

The following arrangement exists after selecting the command:

Continuous Function Chart Editor (CFC) 17:

When this command is selected the first thing to happen is that the elements are ordered topographically. A new sequential processing list is then created. Based on the known values of the inputs, the computer calculates which of the as yet not numbered elements can be processed next. In the above "network" the block AND, for example, could be processed immediately since the values at its inputs (1 and 2) are known. Block SUB can only then be processed since the result from ADD must be known first, etc.
Feedback paths are inserted last.
The advantage of the data flow sequencing is that an output box which is connected to the output of a block comes immediately after it in the data flow sequencing system which by topological ordering would not always be the case. The topological ordering can deliver another result in some cases than ordering by data flow, a point which one can recognise from the above example.

'Extras' 'Create macro'‘

With this command, several POUs that are selected at the same time can be assembled into a block, which can named as a macro. Macros only can be reproduced by Copy/Paste, whereby each copy becomes a separate macro whose name can be chosen independently. Macros are thus not references. All connections that are cut by the creation of a macro generate in- or out-pins on the macro. Connections to inputs generate an in-pin. The default name appears next to the pin in the form In<n>. For connections to outputs, Out<n> appears. Affected connections which had connection markers prior to the creation of the macro, retain the connection marker on the PIN of the macro.

At first, a macro has the default name "MACRO". This can be changed in the Name field of the macro use. If the macro is edited, the name of the macro will be displayed in the title bar of the editor window appended to the POU name.
Example:
Selection:

Continuous Function Chart Editor (CFC) 18:

Macro:

Continuous Function Chart Editor (CFC) 19:

In the editor:

Continuous Function Chart Editor (CFC) 20:

'Extras' 'Edit Macro’

By this command, or by double clicking on the body of the macro, the macro is opened for editing in the editor window of the associated POU. The name of the macro is displayed appended to the POU name in the title bar.
The pin boxes generated for the in- and outputs of the macro during creation can be handled like normal POU in- and outputs. They can also be moved, deleted, added, etc. They differ only in how they are displayed and have no position index. Pin boxes have rounded corners. The text in the pin-box matches the name of the pin in the macro display.
The order of the pins in the macro box follows the order of execution of the elements of the macro. A lower order index before a higher one, higher pin before lower. The processing order within the macro is closed, in other words the macro is processed as a block, at the position of the macro in the primary POU. Commands for manipulating the order of execution therefore operate only within the macro.

'Extras' 'Expand macro’

With this command, the selected macro is re-expanded and the elements contained in it are inserted in the POU at the macro’s location. The connections to the pins of the macro are again displayed as connections to the in- or outputs of the elements. If the expansion of the macro can not occur at the location of the macro box for lack of space, the macro is displaced to the right and down until enough space is available.

'Extras' 'Back one macro level', 'Extras' 'Back all macro level'

These commands are also available in the toolbar, as soon as a macro is opened for editing. If macros are nested within one another, it is possible to switch to the next higher or to the highest display level.

Feedback paths

Feedback paths can only be displayed directly in the continuous function chart editor and not in the usual function block diagram editor. Here it should be observed that the output of a block always carries an internal intermediate variable. The data type of the intermediate variable results, for operators, from the largest data type of the inputs.
The data type of a constant is obtained from the smallest possible data type, that is the constant '1' adopts the data type SINT. If now an addition with feedback and the constant '1' is executed, the first input gives the data type SINT and the second is undefined because of the feedback. Thus the intermediate variable is also of the type SINT. The value of the intermediate variable is only then allocated to the output variable.
The diagram below shows an addition with feedback and an addition with a variable. The variables x and y should be of the type INT here.

Continuous Function Chart Editor (CFC) 21:

There are differences between the two additions:
The variable y can be initialized with a value which is not equal to zero but this is not the case for intermediate variable for the left addition.
The intermediate variable for the left addition has the data type SINT while that on the right has the data type INT. The variables x and y have different values after the 129th call up. The variable x, although it is of the type INT, contains the value ?127 because the intermediate variable has gone into overflow. The variable y contains the value 129, on the other hand.

‘Extras’ ‘Open instance’

This command corresponds to the 'Project' 'Open instance' command.

CFC in Online mode

Monitoring:

The values for inputs and outputs are displayed within the input or output boxes. Constants are not monitored. For non-boolean variables, the boxes are expanded to accommodated the values displayed. For boolean connections, the variable name as well as the connection are displayed in blue if the value is TRUE, otherwise they remain black. Internal boolean connections are also displayed Online in blue in the TRUE state, otherwise black. The value of internal non-boolean connections is displayed in a small box with rounded corners on the output pin of the connection.

Continuous Function Chart Editor (CFC) 22:

PINs in macros are monitored like in- or output boxes.

Continuous Function Chart Editor (CFC) 23:

Non-boolean connections with connection markers display their value within the connection marker. For boolean connections, the lines as well as the marker names are displayed in blue if the line is carrying the value TRUE, otherwise black.

Flow control:

When flow control is switched on, the connections that have been traversed are marked with the color selected in the project options.

Breakpoints:

Breakpoints can be set on all elements that also have a processing sequence order index. The processing of the program will be halted prior to execution of the respective element, that is for POUs and outputs before the assignment of inputs, for jump labels before execution of the element with the next index. The processing sequence index of the element is used as the breakpoint position in the Breakpoint dialog.

The setting of breakpoints on a selected element is accomplished with the F9 key or via the menu item 'Breakpoint on/off' in the 'Online' or 'Extras' menu or in the editor’s context menu. If a breakpoint is set on an element, then this will be erased and reversed the next time the command 'Breakpoint on/off' is executed. In addition, the breakpoint on an element can be toggled by double-clicking on it.
Breakpoints are displayed in the colors entered in the project options.

RETURN label:

In Online mode, a jump label with the name „RETURN“ is automatically generated in the first column and after the last element in the editor. This label marks the end of the POU and is jumped to when stepping just before execution leaves the POU. No RETURN marks are inserted in macros.

Stepping:

When using 'Step over' the element with the next-higher order index will always be jumped to. If the current element is a macro or a POU, then its implement branches when 'Step in' is in effect. If a 'Step over' is executed from there, the element whose order index follows that of the macro is jumped to.

'Extras' 'Zoom' Shortcut: <Alt> + <Enter>

With this command, the implementation of a POU can be opened if the POU is selected.