Overview
The utilities library contains a number of useful function blocks and functions with which TwinCAT PLC or operating system functions can be called. The function blocks are based, internally, on the system library.
By adding TcUtilities.Lib the following libraries are included automatically: Standard.Lib; TcBase.Lib; TcSystem.Lib;
Operating system functions
Name | Description |
---|---|
Shuts down the operating system | |
Aborts operating system shutdown command | |
Restarts the operating system | |
Reads the local Windows system time | |
Sets the local Windows system time | |
Starts a Windows application from the PLC | |
Synchronize the local Windows system time to the real-time clock of the PC | |
Reads system registry | |
Writes system registry | |
This function block searches a directory for a file or subdirectory whose name matches the specified file name. | |
This function block searches a directory for a file or subdirectory whose name matches the specified file name. Found entries are read block by block. | |
The function block retrieves adapter information for the local or remote computer. | |
The function block returns the standard host name for the local or remote machine. | |
Converts the host name to the (IPv4) Internet Protocol network address. | |
Reads operating system time zone settings. | |
Writes operating system time zone settings. | |
Reads local Windows System Time and Daylight-/Standard-time information. |
TwinCAT PLC functions
Name | Description |
---|---|
Resets the PLC | |
Starts the PLC | |
Stops the PLC | |
Reads the PLC symbol information | |
Reads the additional symbol information knowing the symbol name | |
Reads the additional symbol information knowing the symbol name and cuts comment string if the string exceeds the available buffer length. | |
Reads the execution time of PLC program | |
Writes persistent data | |
Writes persistent data (Extendedversion) |
Checksum/CRC functions
Name | Description |
---|---|
Calculates the 16 Bit CheckSum | |
Calculates the CRC16-CCITT (cyclic redundancy check) of any data type | |
Calculates the CRC16-CCITT (cyclic redundancy check) of single data byte |
TwinCAT system functions
Name | Description |
---|---|
Restarts the TwinCAT system | |
Stops the TwinCAT system | |
Starts the TwinCAT system in Config mode. | |
Reads the CPU usage of the TwinCAT system | |
Reads the TwinCAT System latency time | |
Reads the TwinCAT Router information about configured remote PCs | |
Reads the local AmsNetId ( TwinCAT PC network address ) | |
Reads TwinCAT Router status information | |
Enumerates TwinCAT Router connections | |
Adds one TwinCAT Router connection | |
Removes one TwinCAT Router connection |
TwinCAT Scope View functions
Some functions can be used if only one View in the TwinCAT Scope View application is activated.
Name | Description |
---|---|
Loads Scope View Configuration Project (*.scp) | |
Switches Scope View in Online state | |
Switches Scope View in Offline state | |
Reads Scope View current state | |
Performs manual trigger | |
Sets the record time | |
Reads the record time | |
Exports Scope View in ASCII file | |
Exports Scope View in binary file | |
Saves Scope View Project file | |
Terminates Scope View instance (exe) |
TwinCAT Scope Server
since library version 2.0.52
Name | Description |
---|---|
FB_ScopeServerControl | Controls (start/save..) the Scope Server for data logging |
Converting functions
Name | Description |
---|---|
Converts DATE_AND_TIME to the Windows system time structure | |
Converts DATE_AND_TIME to file time | |
Converts Windows system time structure to DATE_AND_TIME | |
Converts Windows system time structure to file time. | |
Converts Windows system time structure to string. | |
Converts string to Windows system time structure. | |
Converts Windows file time to DATE_AND_TIME. | |
Converts Windows file time to Windows system time structure. | |
Converts decimal numbers to BCD numbers | |
Converts BCD numbers to decimal numbers | |
Converts degrees to radiants | |
Converts radiants to degrees | |
Converts TIME variable to structure with milliseconds, seconds, minutes, hours, days and weeks | |
Converts structure with milliseconds, seconds, minutes, hours, days and weeks to TIME variable | |
Converts bus controller REAL number to Intel PC REAL number format | |
Converts byte array to string | |
Converts string to byte array | |
Converts UTC time to local time and vice versa (using bias value) | |
Converts local time (file time format) to UTC time | |
Converts local time (structured system time format) to UTC time | |
Converts UTC time (file time format) to local time | |
Converts UTC time (structured system time format) to local time |
String format functions
Name | Description |
---|---|
Converts floating point numbers to string | |
Converts decimal numbers to decimal string | |
Converts decimal numbers to hexadecimal string | |
Converts decimal number to octal string | |
Converts decimal number to binary string | |
Converts signed decimal number to decimal string | |
Converts one argument (plc variable) to string | |
Converts (formats) up to 10 arguments (plc variables) to string | |
Search for numbers in string | |
Converts a specified string to uppercase | |
Converts a specified string to lowercase | |
Removes spaces on the left side of a string | |
Removes spaces on the right side of a string | |
Converts binary data to hex string |
64 bit functions (unsigned)
Name | Description |
---|---|
Initializes/sets 64 bit number value | |
Adds two 64 bit numbers | |
Adds two 64 bit numbers (with overflow check) | |
Subtracts two 64 bit numbers | |
Compares two 64 bit numbers | |
Multiplies two 32 bit numbers. Result is 64 bit number. | |
Multiplies two 64 bit numbers. Result is 64 bit number. | |
Multiplies two 64 bit numbers. Result is 64 bit number (with overflow check). | |
Division of one variable by another | |
Division of one variable by another (including remainder) | |
Modulo division of one variable by another | |
Bitwise AND of operands | |
Bitwise OR of operands | |
Bitwise NOT of operand | |
Bitwise XOR of operands | |
Bitwise rotation of an operand to the left | |
Bitwise rotation of an operand to the right | |
Bitwise left-shift of an operand | |
Bitwise right-shift of an operand | |
Minimum function | |
Maximum function | |
Limiting function | |
Checks if value of 64 bit integer is zero | |
Converts 64 bit number to STRING | |
Converts 64 bit number to LREAL | |
Converts STRING to 64 bit number | |
Converts LREAL to 64 bit number |
64 bit functions (signed)
Name | Description |
---|---|
Initializes/sets 64 bit number value | |
Adds two 64 bit numbers | |
Adds two 64 bit numbers (with overflow check) | |
Subtracts two 64 bit numbers | |
Compares two 64 bit numbers | |
Division of one variable by another (including remainder) | |
Bitwise NOT of operand | |
Checks if value of 64 bit integer is zero | |
Negates 64 bit number | |
Converts 64 bit number to LREAL | |
Converts LREAL to 64 bit number | |
Converts signed 64 bit number to unsigned 64 bit number | |
Converts unsigned 64 bit number to signed 64 bit number |
16 bit fixed point (signed)
Name | Description |
---|---|
Adds two fixed point numbers | |
Changes the resolution of fixed point number | |
Subtracts two fixed point numbers | |
Division of two fixed point numbers | |
Multiplies two fixed point numbers | |
Converts LREAL to fixed point number | |
Converts WORD to fixed point number | |
Converts fixed point number to LREAL | |
Converts fixed point number to WORD |
Byte order converting functions
Name | Description |
---|---|
Host-to-network converting (16 bit number) | |
Host-to-network converting (32 bit number) | |
Host-to-network converting (64 bit number) | |
Host-to-network converting (128 bit number) | |
Network-to-host converting (16 bit number) | |
Network-to-host converting (32 bit number) | |
Network-to-host converting (64 bit number) | |
Network-to-host converting (128 bit number) |
Other functions
Name | Description |
---|---|
Simple PID controller | |
Returns library version info | |
Checks if REAL or LREAL variable can be represented in Institute of Electrical and Electronics Engineers (IEEE) format. | |
Determines whether the given year is a leap year. | |
Returns the number of days in a month. | |
Calculates the day number of the year | |
Calculates the month from day number of the year | |
Returns the day number of a week. | |
Returns the week number of the year. | |
Calculates the day of month of specific month, month's week and year | |
RTC (Real Time Clock) | |
RTC (Real Time Clock) | |
RTC (Real Time Clock) | |
Writes/reads datasets to/from file (FIFO). | |
Writes/reads datasets to/from memory buffer (FIFO). | |
Writes/reads datasets to/from memory buffer (FIFO). | |
Writes/reads strings to/from memory buffer (FIFO). | |
Writes/reads datasets to/from memory buffer (LIFO). | |
Simple hash table. | |
Simple linked list (doubly-linked). | |
Simple DCF77 decoder. | |
DCF77 decoder with plausibility check of two telegrams and time zone information. |
CSV format helper
Name | Description |
---|---|
Converts string containing data field in CSV format to PLC string value | |
Converts PLC string value to string containing data field in CSV format | |
Converts buffer containing data field in CSV format to any PLC variable value | |
Converts any PLC variable value to buffer containing data field in CSV format | |
Splits memory buffer containing data records in CSV format to single data fields | |
Creates data records in CSV format in memory buffer using single data fields |