Overview
Not all those function blocks and functions that are often needed in PLC applications are standardized in IEC61131-3. The 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.
Function blocks
ADS function blocks
Name | Description |
---|---|
Reading data via ADS. | |
Writing data via ADS. | |
Reading and writing data via ADS. | |
Read the state of a device via ADS. | |
Write control words to a device via ADS. | |
Read device information via ADS. | |
Reading data via ADS and returning the number of read data bytes. | |
Writing data via ADS and reaturning the number of read data bytes |
Extended ADS function blocks
Name | Description |
---|---|
ADSREAD-Indication. | |
ADSWRITE-Indication | |
ADSRDWRT-Indication | |
ADSREAD-Response | |
ADSWRITE-Response | |
ADSRDWRT-Response |
General function blocks
Name | Description |
---|---|
Random number generator. | |
Determines the index of the current task. |
Time function blocks
Name | Description |
---|---|
Read the operating system time stamp. | |
Read the target start time of the task. | |
Read the CPU cycle counter. | |
Read the PLC task cycle counter. |
Watchdog function blocks
Name | Description |
---|---|
Activate or Deactivate the PC Watchdog. |
F unction 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 |
---|---|
Open a file. | |
Close a file. | |
Write to a file. | |
Read from a file. | |
Move the file pointer. | |
Get the file pointer position. | |
Put string to a file. | |
Get string from a file. | |
Check the end of file. | |
Delete a file. | |
Rename a file. | |
Create new directory. | |
Remove directory. |
TwinCAT 2.7 function blocks for data access
These function blocks are contained only for compatibility reasons in the library and should not not be used in new projects.
Name | Description |
---|---|
Open a file. | |
Close a file. | |
Write to a file. | |
Read from a file. | |
Move the file pointer. |
IEC SFC functions
These functions / function blocks are required to use IEC steps or SFC flags in SFC programs /projects.
Name | Description |
---|---|
Enables the using of IEC steps. | |
Is required for using SFC flags. | |
Is required for using SFC flags, to format strings with error description. |
Event logger function blocks
The TwinCAT Eventlogger manages all occurring messages (events) in the TwinCAT System. It transfers the data and writes them into the TwinCAT log file.
Name | Description |
---|---|
Sending and acknowledgement of messages to the TwinCAT Eventlogger. | |
Sending and acknowledgement of messages to the TwinCAT Eventlogger. |
For further information see the TwinCAT Event Logger documentation.
Functions
General functions
Name | Description |
---|---|
Splits a path name into components. | |
Converts address bytes to IPv4 address string. | |
Converts IPv4 address string to address bytes.. | |
Sets a bit in a DWORD. | |
Sets/resets a bit in a DWORD. | |
Reads a bit from a DWORD. | |
Clears a bit in a DWORD. | |
Outputs a signal on one of the parallel port pins. | |
Reads data struct member alignment information. | |
Returns the library version info |
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 |
MEMORY functions
Number of functions which provide direct access to memory areas in the PLC runtime system.
Comment
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 | |
Sets the variables in a memory area to a particular value | |
Copies the values from overlapping memory areas |