beckhoff TwinCAT 2 — 10 General questions regarding PC control

General questions regarding PC control What language can be used for what purposes? There is no clear approach, but recommendations can be made, i.e.:· ST for algorithmic calculations, FBD for program calls, LD for interlocks, SFC for step-by-step sequences, Instruction List for bit-oriented processing ·for example, · The typical applications for language elements depend on the common language element usage patterns. What programming language is the fastest in execution? Test results were:

100,000 times And combination in STL = 76ms 100,000 times And combination in ST = 74ms 1,000 times FOR loop 0 to 99 in STL = 38ms 1,000 times FOR loop 0 to 99 in ST = 40ms ST is slightly (but only negligibly) faster than STL because no additional code needs to be generated here for sequence control. Code generation is very good and it can be expected that no faster code can be generated with C. Moreover, code written in C cannot be analysed in the PLC control. SFC and LAD are not very much slower than ST. Can variables of the PLC be accessed via OCX? What does such an access look like?

The variables can be accessed with a diverse range of mechanisms (synchronous, asynchronous or on change etc.). A collection of examples with TwinCAT can be installed. Here, all functions are shown by way of example (visual basic only). Is every part of the programming system accessible via OCX? OCX provides access to variables and methods of the servers. All variables (local and global) and all types (elementary and structured) are accessed, and all of these can also be accessed symbolically or by an address. Is there a possibility of indexed editing of direct addresses (MW)? Bits of a word or byte can be accessed. For example, %MW1 has the bits %MX1.0 to %MX1.15.

The data trace functions as a ring buffer with pre and post triggers. What can be set? Currently, 500 or more entries are possible for each variable (depending on the variables to be traced). The ring buffer is no longer written when a trigger event has occurred. The buffer can then be read out and can be saved as a binary or ASCII file. During recording, no new variables can be traced, but the display can be changed over at any time (up to 20 variables, including 8 in the display). The shortest sampling time is the cycle time of the task, i.e. recording is cycle-synchronous.

It is possible to define what percentage of the maximum possible data before and after the trigger event is to be in the ring buffer. FB status display: How can an FB (multiply used) be displayed in the status for a special call? You can analyze an instance of an FB under 'Project', 'Open instance'. TO do this, the cursor must be on FB in the object directory (left window). When the instance is selected, the call hierarchy is also displayed. After what program changes is a cold / warm start necessary? When a cold start is run, VAR_RETAIN are deleted. How can setpoints in the PLC nevertheless be saved?

A cold start with new code generation is necessary after modifications in the task configuration or following a modification in the library manager (adding or deletion of libraries). Retain data is not saved until after the TwinCAT system has been stopped and is only loaded again when Twin-CAT is started (when a boot project System Concept 29 Version: 1.0