Overview
Not all those function blocks and functions that are often needed in PLC applications are standardized in IEC61131-3. The Tc2_System library contains such functions and function blocks for the TwinCAT system which do not belong to the standard scope of IEC61131-3, and which are therefore manufacturer-specific.
General function blocks
Name | Description |
---|---|
Random number generator | |
Critical sections should be made mutually exclusive | |
Switches the user LED to PCs and Émbedded PCs with BIOS API support | |
Determines the index of the current task |
ADS function blocks
Name | Description |
---|---|
Reading data via ADS | |
Reading data via ADS and returning the number of read data bytes | |
Writing data via ADS | |
Reading and writing data via ADS | |
Writing data via ADS and returning the number of read data bytes | |
Read the state of a device via ADS | |
Write control words to a device via ADS | |
Read device information via ADS |
Expanded ADS function blocks
Name | Description |
---|---|
ADSREAD Indication | |
ADSWRITE Indication | |
ADSRDWRT Indication | |
ADSREAD Response | |
ADSWRITE Response | |
ADSRDWRT Response |
Function blocks for data access
The function blocks can be used to process files from the PLC locally on the PC. The TwinCAT target system is identified by the AMS network address. This mechanism makes it possible, amongst other things, to store or to edit files on other TwinCAT systems in the network. Access to files consists of three sequential phases:
- Opening the file.
- Read or write access to the opened file.
- Closing the file.
Opening the file has the purpose of establishing a temporary connection between the external file, whose name is all that initially is known, and the running program. Closing the file has the purpose of indicating the end of the processing and placing it in a defined output state for processing by other programs.
Name | Description |
---|---|
Check the end of file | |
Open a file | |
Close a file | |
Get string from a file | |
Put string to a file | |
Read from a file | |
Write to a file | |
Move the file pointer | |
Get the file pointer position | |
Delete a file | |
Rename a file | |
Create new directory | |
Remove directory |
EventLogger function blocks
The TwinCAT EventLogger has the task of managing all messages (events) appearing in the TwinCAT system; to forward them and where necessary to write them into the TwinCAT log file.
Name | Description |
---|---|
Sending and acknowledging TwinCAT EventLogger messages. | |
Sending and acknowledging TwinCAT EventLogger messages. | |
Sending and acknowledging TwinCAT EventLogger messages. |
![]() | TwinCAT EventLogger vs. TwinCAT 3 EventLogger The TwinCAT EventLogger was replaced by the successor TwinCAT 3 EventLogger. The older TwinCAT EventLogger is supported by TwinCAT 3 up to version 3.1.4024. Newer TwinCAT versions (>= 3.1.4026.0) only support the newer TwinCAT 3 EventLogger. PLC function blocks for this can be found in the PLC library Tc3_EventLogger. |
IEC steps / SFC flags function blocks
These functions / function blocks are required if IEC steps or SFC flags are used in SFC programs/projects.
Name | Description |
---|---|
Required if SFC flags are used | |
Required if SFC flags are used | |
Required if SFC flags are used | |
Required if SFC flags are used in order to format strings with error description | |
Enables the use of IEC steps |
Watchdog function blocks
Name | Description |
---|---|
Activates or deactivates the PC watchdog Only available on IPCs with the following mainboards: IP-4GVI63, CB1050, CB2050, CB3050, CB1051, CB2051, CB3051 | |
Activates or deactivates the PC watchdog Only available on IPCs with the following mainboards: CBxx63 with a BIOS version >=0.44 |
Time function blocks
Name | Description |
---|---|
Read the CPU cycle counter | |
Read the PLC task cycle counter |
General functions
Name | Description |
---|---|
Returns information about the memory area in which the requested variable with the specified size is located | |
Compares an existing library with the required version | |
Converts individual IPv4 address bytes to a string | |
Converts an IPv4 address string to individual address bytes | |
Returns the object ID of the partner side of the mapping | |
Returns the current mapping status of a PLC variable | |
Reads information about the memory alignment used | |
Splits the path name into four individual components | |
Sets a bit in a DWORD | |
Setting/resetting of a bit in a DWORD | |
Reads a bit from a DWORD | |
Clears a bit in a DWORD | |
Determining the task index | |
Outputs a signal on one of the parallel port pins | |
Setting and checking a flag without option to interrupt it |
ADS functions
Functions are described below which, with the aid of the ADS interface makes some of the functions of the Windows-NT operating system (such as the output of message boxes) accessible through PLC calls.
Name | Description |
---|---|
Log a DINT variable into NT Eventlog and/or Messagebox | |
Log a (L)REAL variable into NT Eventlog and/or Messagebox | |
Log a STRING variable into NT Eventlog and/or Messagebox | |
Creates AmsNetId string | |
Converts AmsNetId string to array of address bytes |
Character functions
Name |
Description |
---|---|
Converts string character to ASCII number | |
Converts ASCII number to string character |
Memory functions
Number of functions, which provide direct access to memory areas in the PLC runtime system.
Notice | |
System crash or access to forbidden memory areas The fact that these functions allow direct access to the physical memory means that special care is called for in applying them! Incorrect parameter values can result in a system crash, or in access to forbidden memory areas. |
Name | Description |
---|---|
Compares the values of variables in two memory areas | |
Copies the values of variables from one memory area to another | |
Copies the values from overlapping memory areas | |
Sets the variables in a memory area to a particular value |
Time functions
Name | Description |
---|---|
Read the operating system time stamp | |
Read the target start time of the task |