Creating a Target Visualization

1. Create a visualization in TwinCAT PLC.

In order to optimize the performance of the visualization, put as many elements, which are static (no movement, no dynamic texts, no dynamic color changes), to the back.
Hint: Using 'Extras' 'Elementlist' several or all elements can be "Sent to back" or "Sent to front" in a single blow. (Explanation: All static elements only once will be drawn to a background bitmap. Thus the cyclic repaint time will be reduced. This will be profitable especially for complex polygons or bitmaps.

If there is a visualization object TC_VISU, the Target-Visualization later will be started with this object. Otherwise it will start with that object which is the first one in the list of visualization objects in the Object Organizer.

Consider whether implicit visualization variables in the current project should be handled as remanent variables and add the appropriate declarations in the Global Variables list.

Creating a Target Visualization 1:

The bitmaps of the visualization will be transferred as files.

2. Deactivate the option 'Target-Visualization'

For each visualization object, which should not be part of the Target-Visualization, deactivate the option 'Target-Visualization' in the Object Properties dialog ('Project' 'Object' 'Properties') in category 'Visualization

Creating a Target Visualization 2:

3. Configure...

In the Target Settings in tab 'Visualization' (it depends on the target system, whether the particular options are available in this dialog!) configure that the project should be prepared for use in the Target Visualization: Activate option ‘Target visualization’


Additionally here you can define whether the user inputs and the re-painting of the visualization elements....
... should be controlled via VISU-tasks which are generated automatically or via individual programming: Activate option 'Deactivate task generation'.
... should be processed by one or by two POUs resp. tasks:
Activate option 'Use VISU_INPUT_TASK'. (Don't get irritated by the term "..._TASK" in this case; this option is also of effect if no VISU_INPUT_TASK is generated.)


Thus, besides the possibility of deactivating the keyboard usage for table, the following configurations are possible:

The Target visualization is controlled by VISU-tasks
which are generated automatically and which call the POUs MAINTARGETVISU_PAINT_CODE and MAINTTARGETVISU_INPUT_CODE:

Case A:

Deactivate task generation is switched off:

Use VISU_INPUT_TASK is activated:

Creating a Target Visualization 3:
Automatically two tasks will be generated, each calling a program:
VISU_TASK calls the implicitly available POU MAINTARGETVISU_PAINT_CODE, which does the repainting of the visualization elements.
VISU_INPUT_TASK calls the implicitly available POU MAINTARGETVISU_INPUT_CODE, which does the processing of the user inputs.

The default settings of the tasks:
- VISU_INPUT_TASK: cyclic, priority 2, interval t#50ms.
- VISU_TASK: cyclic, priority 3, interval t#200ms.

Creating a Target Visualization 4:

Of course the parameters can be modified. But: VISU_INPUT_TASK always should be processed before VISU_TASK in order to guarantee a useful interaction of user inputs and update of the visualization. The task calling the main program (e.g. PLC_PRG), should at least be processed as often as VISU_INPUT_TASK, ideally even with a higher priority, but it also could be added directly to VISU_INPUT_TASK

Case B:

Deactivate task generation is switched off:

Use VISU_INPUT_TASK is switched off:

Creating a Target Visualization 5:

Only task VISU_TASK will be generated automatically, but in this case will include the functionality of VISU_INPUT_TASK.
The implicit program POU MAINTARGETVISU_ PAINT_CODE in this case additionally will include the functionality of program MAINTTARGETVISU_INPUT_CODE.

This configuration is intended for systems which do not allow multi-tasking. Disadvantageously no differentiated cycle times can be configured for the processing of user inputs and the repainting of the visualization elements, see above.

The Target visualization is not controlled by automatically created tasks;
The implicitly available POUs MAINTARGETVISU_PAINT_CODE and MAINTTARGETVISU_INPUT_CODE can be called by the application program resp. can be appended to any task:

Case C:

Deactivate task generation is activated:

Use VISU_INPUT_TASK is activated:

Creating a Target Visualization 6:

Both implicit POUs are available and can be called individually resp. can be appended to any task. (Referring to this regard the hints in (Case A).

Example for calls of the Target-Visulization POUs in the application program:

PROGRAM visu_control
VAR
    n: INT;
END_VAR

n:=n+1;
IF (n MOD 4) =0 THEN
   MAINTARGETVISU_PAINT_CODE();
END_IF;
MAINTARGETVISU_INPUT_CODE();

Here in program visu_control the POU which processes the user inputs is only called after each fourth call of the repainting POU - thus reducing the danger of getting disturbed the repainting by another user input.

Creating a Target Visualization 7:

When creating the application program, absolutely pay attention to reduce this danger of incorrect display !

Case D:

Deactivate task generation is activated:

Use VISU_INPUT_TASK is switched off:

Creating a Target Visualization 8:

Only the implicitly available program POU MAINTARGET VISU_PAINT_CODE can be used, but in this case it will additionally include the functionality of MAINTARGET VISU _INPUT_CODE.
This POU can be called in the application program resp. can be appended to any task.

4. Load the project

into the controller ('Online' 'Login').