Manual. PLC Lib: Tc2_DataExchange. TwinCAT 3. Version: Date:

Similar documents
Manual. PLC Lib: Tc2_DataExchange. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_Coupler. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_DMX. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_Drive. TwinCAT 3. Version: Date:

TC3 Interface for Matlab /Simulink

Manual. TwinCAT MC Flying Saw. TwinCAT 3. Version: Date: Order No.: TF5055

Manual. TC3 Power Monitoring. TwinCAT 3. Version: Date: Order No.: TF3650

Manual. PLC Lib: Tc2_EtherCAT. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_SMI. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_Standard. TwinCAT 3. Version: Date:

Manual. PLC Lib: Tc2_NcDrive. TwinCAT. Version: Date:

PLC Lib: Tc3_MC2_AdvancedHoming

Manual. TC3 EtherCAT Simulation. TwinCAT 3. Version: Date: Order No.: TE1111

Manual. PLC Lib: Tc2_DALI. TwinCAT 3. Version: Date:

Documentation EM2042. Sixteen Channel Digital Output Module with D-Sub Connector. Version: Date:

Manual. TC3 Virtual Serial COM. TwinCAT 3. Version: Date: Order No.: TF 6360

Documentation. Mains filter AX2090-NF50. Version: Date:

Documentation KM2042. Sixteen channel digital output module with D-Sub Connector. Version: Date:

Documentation for. TwinSAFE User. Tool to modify the User Administration of a TwinSAFE Logic. Version: Date:

Manual. Software Protection. TwinCAT 3. Version: Date:

Documentation ZB8610. Fan cartridge for EtherCAT and Bus Terminals. Version: Date:

Manual. TwinCAT MC Camming. TwinCAT. Version: Date: Order No.: TS5050

Documentation. KM2604 and KM2614. Four channel relay module. Version: Date:

Manual. MATLAB /Simulink. TwinCAT 3. Version: Date:

Description AX5805. List of permissible motors. Version: Date:

TwinCAT KinematicTransformation

Documentation. CU20xx, CU22xx. Ethernet Switch. Version: Date:

Documentation. KM10xx. Terminal Modules with Digital Inputs. Version: Date:

Operating instructions for AX5801. TwinSAFE drive option card for the AX5000 servo drive. Version: Date:

Installation- and Operating instructions for CU Ethernet Controller with USB Input. Version: 1.4 Date:

Documentation. FC2001 and FC2002. Lightbus PCI Interface Cards. Version: Date:

Manual TC3 UML. TwinCAT 3. Version: Date: Order No.: TF1910

Description AX5805. Default values for the permissible motors. Version: Date:

Documentation KM2002, KM2004, KM2008. Terminal modules with digital outputs, 24 V, 0.5 A. Version: Date:

C9900-P223 and C9900-P224

Documentation. FC7501 and FC7502. SERCOS interface PCI Cards. Version: Date:

Installation- and Operating instructions for CU Port USB 2.0 Hub. Version: 1.3 Date:

Documentation. AL225x Connector-Box. Accessory for servo drives of the series AX5000 and AX2000. Version: Date:

Manual. PLC Lib: Tc2_EnOcean. TwinCAT 3. Version: Date:

Documentation KL channel Digital Output Terminal, 24 V DC, 2 x 4 A/1 x 8 A. Version: Date:

C9900-P208 and C9900-P209

Installation- and Operating instructions for CU Port USB 3.0 Hub. Version: 1.1 Date:

Manual. TC3 Filter. TwinCAT 3. Version: Date: Order No.: TF3680

Manual TC3 TCP/IP. TwinCAT 3. Version: Date: Order No.: TF6310

Manual. TC3 EthernetIP Scanner. TwinCAT 3. Version: Date: Order No.: TF6281

Application Note FC1100/FC1121 (EtherCAT Slave Card)

Application Note FC1100/FC1121 (EtherCAT Slave Card)

Manual. TC3 ADS-over-MQTT. TwinCAT. Version: Date:

Manual. NC PTP: Quick Starting Guide. TwinCAT 3. Version: Date: Order No.: TF5000

Operation Manual BK5000. Bus Coupler for CAN-CAL Version: 1.12

Manual. TC3 Database Server. TwinCAT 3. Version: Date: Order No.: TF6420

Manual. TC3 Robotics unival PLC. TwinCAT 3. Version: Date: Order No.: TF5130

Manual. PLC Lib: Tc3 BA Common. TwinCAT. Version: Date:

EL9820/EL9821 Evaluation Kit. Version: 1.3 Date:

Documentation. KL85xx und KL9309. Manual operating modules with K-Bus interface. Version: Date:

Manual. TC3 S5/S7 Communication. TwinCAT. Version: Date: Order No.: V TF6610

Installation- and Operating instructions for CU CP-Link 4 transmitter box The Two Cable Display Link. Version: 1.

Manual. PLC Lib: Tc2_MPBus. TwinCAT 3. Version: Date:

Installation- and Operating instructions for CU CFast card adapter with USB connector. Version: 1.1 Date:

Manual. PLC Lib: Tc3_JsonXml. TwinCAT 3. Version: Date:

SIMATIC. Communications processor CP 340 first commissioning steps. Getting Started 04/2005 A5E

Documentation. KL2784 und KL2794. Four channel digital output terminals with MOSFET transistors. Version: Date:

CU port USB 2.0 hub. Version: 1.1 Date:

Manual CX Audio interface for CX20x0. Version: Date:

Documentation. KM3701, KM3702 and KM3712. Pressure Measuring Module. Version: Date:

S7-300 Programmable Controller

DeviceNet ILxxxx-B520. IO Data Mapping DeviceNet Objects Indicators and Switches

KL5151/KS5151, KL5152/KS5152

Polymer Electric. Operating Instructions. Control Unit SG-EFS 1X4 ZK2/1 8k2. Version 3

The HART Module on the WAGO ETHERNET Controller Application Note

Control unit SG-EFS 104/2W. EN Operating instructions. Innovative by tradition. Version SG-EFS 104/2W 24 V=/~

Library for Building Automation. Module Descriptions for KNX IP Master

CU USB-Extender-Rx (USB and DVI Extender) Version: 0.3 Date:

Control unit SG-EFS 104/4L. EN Operating instructions. Innovative by tradition. Version SG-EFS 104/4L AC/DC 24 V

User Manual Connection to BRC-Symbolic

CU Compact-Flash card adapter for USB. Version: 1.0 Date:

Manual EAP. TwinCAT 3. Version: Date:

Siemens Drives & PLCs

Library Description. DALI_647_SpecialSensor_02.lib Specific Sensor Solutions. Version 1.0.1

Installation and Operating instructions for C / Fanless Control Cabinet Industrial PC. Version: 1.0 Date:

Fieldbus Independent I/O Modules Bluetooth RF Transceiver Quick Start

Operating Instructions

Using PROFIsafe modules in combination with PROFIBUS-DP and PROFINET Application note

Libraries for Building Automation. Module Descriptions for the WINSTA Sunblind Box /

Manual. TC3 Solar Position Algorithm. TwinCAT 3. Version Date Order No TF3900

Manual. TC3 Scope View. TwinCAT 3. Version: Date: Order No.: TE13xx

Hardware Documentation. CX xx. Embedded-PC. Version: Date:

Beckhoff Embedded PC Product overview

Aotewell SIMATIC S7-PDIAG for S7-300 and S Configuring Process Diagnostic Getting St

SIMATIC. Automation system BRAUMAT/SISTARClassic V5.3 Block library basic. Preface, Content. Blocks in SIS_USR. Appendix. Manual

Using WAGO Series 750 EtherCAT coupler with CoDeSys SP Win V3 Application note

Polymer Electric. Operating Instructions. Control Unit SG-RST 153. Version 0.3

Documentation KL2602, KL2622. Two-channel Relay Output Terminals. Version: Date:

Installation and Operating instructions for C Ultra compact Industrial PC. Version: 1.3 Date:

Documentation KL2791. Single channel speed controller terminals for AC motors. Version: Date:

Documentation. EL28xx. Digital HD output Terminals. Version: Date:

Installation and Operating instructions for Control Cabinet PC C6915

Operation Manual for. EJ19xx and EJ29xx. TwinSAFE EJ Modules with digital fail-safe in and outputs. Version: Date: 1.2.

SIMOTION. SIMOTION SCOUT Reading and Writing Drive Data. Preface. Fundamental safety instructions 1. Description 2.

Safety module SY6 Manual

Transcription:

Manual TwinCAT 3 Version: Date: 1.0 2015-11-05

Table of Contents Table of Contents 1 Foreword... 4 1.1 Notes on the documentation... 4 1.2 Safety instructions... 5 2 Introduction... 6 3 Event driven data exchange... 7 3.1 FB_ReadAdsSymByName... 7 3.2 FB_WriteAdsSymByName... 8 3.3 FB_WriteBoolOnDelta... 10 3.4 FB_WriteByteOnDelta... 11 3.5 FB_WriteWordOnDelta... 12 3.6 FB_WriteDWordOnDelta... 14 3.7 FB_WriteRealOnDelta... 15 3.8 FB_WriteLRealOnDelta... 17 4 Watchdog function blocks... 19 4.1 FB_CheckWatchdog... 19 4.2 FB_WriteWatchdog... 20 5 Data Types... 22 5.1 E_AdsComMode... 22 6 Global constants... 23 6.1 Library version... 23 Version: 1.0 3

Foreword 1 Foreword 1.1 Notes on the documentation This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards. It is essential that the following notes and explanations are followed when installing and commissioning these components. The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards. Disclaimer The documentation has been prepared with care. The products described are, however, constantly under development. For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics. In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning. No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation. Trademarks Beckhoff, TwinCAT, EtherCAT, Safety over EtherCAT, TwinSAFE, XFC and XTS are registered trademarks of and licensed by Beckhoff Automation GmbH. Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners. Patent Pending The EtherCAT Technology is covered, including but not limited to the following patent applications and patents: EP1590927, EP1789857, DE102004044764, DE102007017835 with corresponding applications or registrations in various other countries. The TwinCAT Technology is covered, including but not limited to the following patent applications and patents: EP0851348, US6167425 with corresponding applications or registrations in various other countries. EtherCAT is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany Copyright Beckhoff Automation GmbH & Co. KG, Germany. The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited. Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design. 4 Version: 1.0

Foreword 1.2 Safety instructions Safety regulations Please note the following safety instructions and explanations! Product-specific safety instructions can be found on following pages or in the areas mounting, wiring, commissioning etc. Exclusion of liability All the components are supplied in particular hardware and software configurations appropriate for the application. Modifications to hardware or software configurations other than those described in the documentation are not permitted, and nullify the liability of Beckhoff Automation GmbH & Co. KG. Personnel qualification This description is only intended for trained specialists in control, automation and drive engineering who are familiar with the applicable national standards. of symbols In this documentation the following symbols are used with an accompanying safety instruction or note. The safety instructions must be read carefully and followed without fail! Serious risk of injury! Failure to follow the safety instructions associated with this symbol directly endangers the life and health of persons. DANGER Risk of injury! Failure to follow the safety instructions associated with this symbol endangers the life and health of persons. WARNING Personal injuries! Failure to follow the safety instructions associated with this symbol can lead to injuries to persons. CAUTION Damage to the environment or devices Failure to follow the instructions associated with this symbol can lead to damage to the environment or equipment. Attention Tip or pointer This symbol indicates information that contributes to better understanding. Note Version: 1.0 5

Introduction 2 Introduction The present function blocks simplify event-driven data exchange between the TwinCAT PLC runtime system and/or other ADS devices (TwinCAT NC, Bus Terminal Controller,...). The FB_WriteXXXOnDelta() function block implements a write procedure when the input signal rises above or falls below a specified limit value. The frequency with which the input signal is examined can be set. Event-driven data writing minimizes the loading on the fieldbus. If an error occurs during transmission, the process is repeated until the connection is established once more. All data types supported in the TwinCAT PLC are permitted as source and destination variables. Symbol names are also supported. Watchdog blocks are available to monitor individual communication partners. The device that is to be monitored cyclically transmits an incrementing counter. A check is made at the receiver to see that the counter state changes within a specific time. 6 Version: 1.0

3 Event driven data exchange Write/Read Blocks Name FB_ReadAdsSymByName [} 7] FB_WriteAdsSymByName [} 8] FB_WriteBoolOnDelta [} 10] FB_WriteByteOnDelta [} 11] FB_WriteWordOnDelta [} 12] FB_WriteDWordOnDelta [} 14] FB_WriteRealOnDelta [} 15] FB_WriteLRealOnDelta [} 17] Reads a variable of any desired data type by variable name Writes a variable of any desired data type by variable name Writes a variable of type BOOLEAN in response to an event. Writes a variable of type BYTE in response to an event. Writes a variable of type WORD in response to an event. Writes a variable of type DWORD in response to an event. Writes a variable of type REAL in response to an event. Writes a variable of type LREAL in response to an event. 3.1 FB_ReadAdsSymByName The block enables the reading of any value from another controller with the aid of the symbol name. Interface VAR_INPUT bread : BOOL; snetid : T_AmsNetId; : T_AmsPort := 851; svarname : STRING; ndestaddr : PVOID; nlen : UDINT; ttimeout : TIME := DEFAULT_ADS_TIMEOUT; ecommode : E_AdsComMode := eadscommodesecurecom; VAR_OUTPUT : BOOL; berror : BOOL; nerrorid : UDINT; Version: 1.0 7

Input parameters bread snetid svarname ndestaddr nlen ttimeout ecommode This block reads the contents of the svarname variable of the selected ADS device and writes it into the variable to which pointer ndestaddr points. AMS-NetId of the ADS device from which the value is to be read. AMS Port number of the ADS device from which the value is to be read. Symbol name of the variable to be read on the selected ADS device. Address of the variable into which the read value is written. Length of the variable to be read in bytes. Time until processing is aborted. Enum used to specify whether the handle of the PLC variable is released again after each read procedure. Output parameters berror nerrorid Transmission is active. An error occurred during the transmission. ADS error number if an error has occurred. On a rising edge at the bread input the block reads the value of the variable svarname from the selected ADS device (e.g. PLC). The ADS device is indicated by the AMS-NetId (snetid) and the AMS Port number (). The value is written into the variable to which ndestaddr points. The internal mode of operation of the block can be changed with the aid of the ecommode input: ecommode := eadscommodesecurecom: Following each read procedure the handle of the PLC variable is released again. This mode should be used when values are exchanged very slowly. ecommode := eadscommodefastcom: As long as the svarname, snetid and inputs do not change, the handle of the PLC variable will not be released after each read procedure. This mode should be used when values are exchanged very frequently. Prerequisites Development environment Target platform PLC libraries to include TwinCAT v3.1.4020 PC or CX (x86) Tc2_DataExchange 3.2 FB_WriteAdsSymByName Writing any desired value to another controller with the aid of the symbol name. Interface VAR_INPUT bwrite : BOOL; snetid : T_AmsNetId; : T_AmsPort := 851; svarname : STRING; 8 Version: 1.0

nsrcaddr nlen ttimeout ecommode VAR_OUTPUT berror nerrorid : PVOID; : UDINT; : TIME := DEFAULT_ADS_TIMEOUT; : E_AdsComMode := eadscommodesecurecom; : BOOL; : BOOL; : UDINT; Input parameters bwrite snetid svarname nsrcaddr nlen ttimeout ecommode This block writes the contents of the variable to which pointer nsrcaddr points into the variable svarname of the selected ADS device. AMS-NetId of the ADS device to which the value is to be transmitted. AMS Port number of the ADS device to which the value is to be transmitted. Symbol name of the variable to be written on the selected ADS device. Address of the variable in which the value to written is located. Length in bytes of the variable to be written. Time until processing is aborted. Enum used to specify whether the handle of the PLC variable is released again after each write procedure. Output parameters berror nerrorid Transmission is active. An error occurred during the transmission. ADS error number if an error has occurred. On a rising edge at the bwrite input the block writes the value to which the pointer nsrcaddr points into the variable svarname of the selected ADS device (e.g. PLC). The ADS device is indicated by the AMS-NetId (snetid) and the AMS Port number (). The internal mode of operation of the block can be changed with the aid of the ecommode input: ecommode := eadscommodesecurecom: Following each write procedure the handle of the PLC variable is released again. This mode should be used when values are exchanged very slowly. ecommode := eadscommodefastcom: As long as the svarname, snetid and inputs do not change, the handle of the PLC variable will not be released after each write procedure. This mode should be used when values are exchanged very frequently. Prerequisites Development environment Target platform PLC libraries to include TwinCAT v3.1.4020 PC or CX (x86) Tc2_DataExchange Version: 1.0 9

3.3 FB_WriteBoolOnDelta Event-driven writing of a variable of type BOOLEAN. Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; bsignal : BOOL; tcycletime : TIME := t#0s; bsendnow : BOOL; END_VA VAR_OUTPUT : BOOL := FALSE; blastsignal : BOOL; berror : BOOL := FALSE; nerrorid : UDINT := 0; nerrorcnt : UDINT := 0; Input parameters benable snetid nidxgrp nidxoffs svarname bsignal tcycletime bsendnow Enable block AMS-NetId of the ADS device to which the value is to be transmitted AMS- port number of the ADS device to which the value is to be transmitted Index group within the ADS device into which the value is to be transmitted Index offset within the ADS device into which the value is to be transmitted Symbol name within the ADS device into which the value is to be transmitted Variable whose value is to be transmitted Cycle period in which the input signal is examined to see that it has changed The value is transmitted immediately in response to a rising edge Output parameters blastsignal berror nerrorid nerrorcnt Transmission is active Most recently transmitted value An error occurred during the transmission Error number if an error has occurred Number of transmission attempts that have returned faults 10 Version: 1.0

The FB_WriteBoolOnDelta() function block checks cyclically whether the value at the bsignal input has changed. The cycle time within which the check is carried out is specified by the parameter tcycletime. If 0 seconds is given for tcycletime, the input signal is examined during every PLC cycle. If a change is detected, the value of the signal is sent to the ADS device that is to be specified. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the flags area. If the benable input is set to FALSE, no further signal transmission is carried out. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange 3.4 FB_WriteByteOnDelta Event-driven writing of a variable of type BYTE. Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; nsignal : BYTE; nlowerlimit : BYTE; nupperlimit : BYTE; tcycletime : TIME := t#0s; bsendnow : BOOL; VAR_OUTPUT : BOOL := FALSE; nlastsignal : BYTE; berror : BOOL := FALSE; nerrorid : UDINT := 0; nerrorcnt : UDINT := 0; Version: 1.0 11

Input parameters benable snetid nidxgrp nidxoffs svarname nsignal nlowerlimit nupperlimit tcycletime bsendnow Enable block. AMS-NetId of the ADS device to which the value is to be transmitted. AMS- port number of the ADS device to which the value is to be transmitted. Index group within the ADS device into which the value is to be transmitted. Index offset within the ADS device into which the value is to be transmitted. Symbol name within the ADS device into which the value is to be transmitted. Variable whose value is to be transmitted. Lower limit value. Upper limit value. Cycle period in which the input signal is examined to see whether it has exceeded the limit values. The value is transmitted immediately in response to a rising edge. Output parameters nlastsignal berror nerrorid nerrorcnt Transmission is active. Most recently transmitted value. An error occurred during the transmission. Error number if an error has occurred. Number of transmission attempts that have returned faults. The FB_WriteByteOnDelta() function block checks cyclically whether the value at the nsignal input has changed. The cycle time within which the check is carried out is specified by the parameter tcycletime. If 0 seconds is given for tcycletime, the input signal is examined during every PLC cycle. If the comparison establishes that the current value is greater than nupperlimit or lower than the value nlowerlimit, then the value is sent to the ADS device that is to be specified. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the flags area. If the benable input is set to FALSE, no further signal transmission is carried out. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange 3.5 FB_WriteWordOnDelta Event-driven writing of a variable of type WORD. 12 Version: 1.0

Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; nsignal : WORD; nlowerlimit : WORD; nupperlimit : WORD; tcycletime : TIME := t#0s; bsendnow : BOOL; VAR_OUTPUT : BOOL := FALSE; nlastsignal : WORD; berror : BOOL := FALSE; nerrorid : UDINT := 0; nerrorcnt : UDINT := 0; Input parameters benable snetid nidxgrp nidxoffs svarname nsignal nlowerlimit nupperlimit tcycletime bsendnow Enable block. AMS-NetId of the ADS device to which the value is to be transmitted. AMS- port number of the ADS device to which the value is to be transmitted. Index group within the ADS device into which the value is to be transmitted. Index offset within the ADS device into which the value is to be transmitted. Symbol name within the ADS device into which the value is to be transmitted. Variable whose value is to be transmitted. Lower limit value. Upper limit value. Cycle period in which the input signal is examined to see whether it has exceeded the limit values. The value is transmitted immediately in response to a rising edge. Output parameters nlastsignal berror nerrorid nerrorcnt Transmission is active. Most recently transmitted value. An error occurred during the transmission. Error number if an error has occurred. Number of transmission attempts that have returned faults. The FB_WriteWordOnDelta() function block checks cyclically whether the value at the nsignal input has changed. The cycle time within which the check is carried out is specified by the parameter tcycletime. If 0 seconds is given for tcycletime, the input signal is examined during every PLC cycle. If the comparison establishes that the current value is greater than nupperlimit or lower than the value nlowerlimit, then the value is sent to the ADS device that is to be specified. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the flags area. If the benable input is set to FALSE, no further signal transmission is carried out. Version: 1.0 13

Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange 3.6 FB_WriteDWordOnDelta Event-driven writing of a variable of type DWORD. Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; nsignal : DWORD; nlowerlimit : DWORD; nupperlimit : DWORD; tcycletime : TIME := t#0s; bsendnow : BOOL; VAR_OUTPUT : BOOL := FALSE; nlastsignal : DWORD; berror : BOOL := FALSE; nerrorid : UDINT := 0; nerrorcnt : UDINT := 0; 14 Version: 1.0

Input parameters benable snetid nidxgrp nidxoffs svarname nsignal nlowerlimit nupperlimit tcycletime bsendnow Enable block. AMS-NetId of the ADS device to which the value is to be transmitted. AMS- port number of the ADS device to which the value is to be transmitted. Index group within the ADS device into which the value is to be transmitted. Index offset within the ADS device into which the value is to be transmitted. Symbol name within the ADS device into which the value is to be transmitted. Variable whose value is to be transmitted. Lower limit value. Upper limit value. Cycle period in which the input signal is examined to see whether it has exceeded the limit values. The value is transmitted immediately in response to a rising edge. Output parameters nlastsignal berror nerrorid nerrorcnt Transmission is active. Most recently transmitted value. An error occurred during the transmission. Error number if an error has occurred. Number of transmission attempts that have returned faults. The FB_WriteDWordOnDelta() function block checks cyclically whether the value at the nsignal input has changed. The cycle time within which the check is carried out is specified by the parameter tcycletime. If 0 seconds is given for tcycletime, the input signal is examined during every PLC cycle. If the comparison establishes that the current value is greater than nupperlimit or lower than the value nlowerlimit, then the value is sent to the ADS device that is to be specified. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the flags area. If the benable input is set to FALSE, no further signal transmission is carried out. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange 3.7 FB_WriteRealOnDelta Version: 1.0 15

Event-driven writing of a variable of type REAL. Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; fsignal : REAL; flowerlimit : REAL; fupperlimit : REAL; tcycletime : TIME := t#0s; bsendnow : BOOL; bswaplowhighword : BOOL := FALSE; VAR_OUTPUT : BOOL := FALSE; flastsignal : REAL; berror : BOOL := FALSE; nerrorid : UDINT := 0; nerrorcnt : UDINT := 0; Input parameters benable snetid nidxgrp nidxoffs svarname fsignal flowerlimit fupperlimit tcycletime bsendnow bswaplowhigh Word Enable block. AMS-NetId of the ADS device to which the value is to be transmitted. AMS- port number of the ADS device to which the value is to be transmitted. Index group within the ADS device into which the value is to be transmitted. Index offset within the ADS device into which the value is to be transmitted. Symbol name within the ADS device into which the value is to be transmitted. Variable whose value is to be transmitted. Lower limit value. Upper limit value. Cycle period in which the input signal is examined to see whether it has exceeded the limit values. The value is transmitted immediately in response to a rising edge. The least significant WORD and the most significant WORD are swapped. Output parameters flastsignal berror nerrorid nerrorcnt Transmission is active. Most recently transmitted value. An error occurred during the transmission. Error number if an error has occurred. Number of transmission attempts that have returned faults. The FB_WriteRealOnDelta() function block checks cyclically whether the value at the fsignal input has changed. The cycle time within which the check is carried out is specified by the parameter tcycletime. If 0 seconds is given for tcycletime, the input signal is examined during every PLC cycle. If the comparison establishes that the current value is greater than fupperlimit or lower than the value flowerlimit, then the value is sent to the ADS device that is to be specified. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the 16 Version: 1.0

index group/index offset or by the symbol name. Usually this is the input image or the flags area. The internal representation of floating point numbers differs according to the hardware being used. Whereas Intel use the "little-endian" format, Motorola-based hardware employs the "big-endian" format. The input variable bswaplowhighword can be used to make the necessary adjustment in order to be able to exchange floating point numbers. This is necessary, for instance, if floating point numbers need to be exchanged between the TwinCAT PLC running on a PC and a BC9000. If the benable input is set to FALSE, no further signal transmission is carried out. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange 3.8 FB_WriteLRealOnDelta Event-driven writing of a variable of type LREAL. Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; fsignal : LREAL; flowerlimit : LREAL; fupperlimit : LREAL; tcycletime : TIME := t#0s; bsendnow : BOOL; VAR_OUTPUT : BOOL := FALSE; flastsignal : LREAL; berror : BOOL := FALSE; nerrorid : UDINT := 0; nerrorcnt : UDINT := 0; Version: 1.0 17

Input parameters benable snetid nidxgrp nidxoffs svarname fsignal flowerlimit fupperlimit tcycletime bsendnow Enable block. AMS-NetId of the ADS device to which the value is to be transmitted. AMS- port number of the ADS device to which the value is to be transmitted. Index group within the ADS device into which the value is to be transmitted. Index offset within the ADS device into which the value is to be transmitted. Symbol name within the ADS device into which the value is to be transmitted. Variable whose value is to be transmitted. Lower limit value. Upper limit value. Cycle period in which the input signal is examined to see whether it has exceeded the limit values. The value is transmitted immediately in response to a rising edge. Output parameters flastsignal berror nerrorid nerrorcnt Transmission is active. Most recently transmitted value. An error occurred during the transmission. Error number if an error has occurred. Number of transmission attempts that have returned faults. The FB_WriteLRealOnDelta() function block checks cyclically whether the value at the fsignal input has changed. The cycle time within which the check is carried out is specified by the parameter tcycletime. If 0 seconds is given for tcycletime, the input signal is examined during every PLC cycle. If the comparison establishes that the current value is greater than fupperlimit or lower than the value flowerlimit, then the value is sent to the ADS device that is to be specified. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the flags area. If the benable input is set to FALSE, no further signal transmission is carried out. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange 18 Version: 1.0

Watchdog function blocks 4 Watchdog function blocks Name FB_WriteWatchdog [} 20] FB_CheckWatchdog [} 19] Writes a watchdog signal (an incrementing counter) cyclically Monitors the received watchdog signal 4.1 FB_CheckWatchdog Monitoring a watchdog signal transmitted by the FB_WriteWatchdog() [} 20] block. Interface VAR_INPUT benable : BOOL := FALSE; twatchdogtime : TIME := t#0s; ncnt : UDINT; VAR_OUTPUT bwatchdog nlastcnt : BOOL := FALSE; : UDINT; Input parameters benable Enable block. twatchdogtime Period of time within which ncnt should change. ncnt Current counter state of the watchdog signal Output parameters bwatchdog nlastcnt FALSE indicates a valid monitoring signal. The output will become TRUE if no change is detected in ncnt during the period of time specified by twatchdogtime. Most recent successfully transmitted counter state of the monitoring signal. The device to be monitored regularly transmits a changing counter state to the device that is to check the transmission. The function block FB_CheckWatchdog() is used there to monitor the state of the counter. If this does not change within a specific period, the bwatchdog output is set to TRUE. If a value of 0 seconds is specified for twatchdogtime, the bwatchdog signal is set to FALSE. The period specified by twachtdogtime should be a multiple (5-10 times) of the time in which the monitoring signal is transmitted. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange Version: 1.0 19

Watchdog function blocks 4.2 FB_WriteWatchdog Writing a watchdog signal to another ADS device (TwinCAT PLC, Bus Terminal Controller,...). Interface VAR_INPUT benable : BOOL := FALSE; snetid : T_AmsNetId; : T_AmsPort; nidxgrp : UDINT; nidxoffs : UDINT; svarname : STRING; twatchdogtime : TIME := t#0s; bsendnow : BOOL; VAR_OUTPUT : BOOL := FALSE; nlastcnt : UDINT := 0; berror : BOOL := FALSE; nerrorid : UDINT := 0; Input parameters benable Enable block. snetid AMS-NetId of the ADS device to which the watchdog signal is to be transmitted. AMS port number of the ADS device to which the watchdog signal is to be transmitted. nidxgrp Index group within the ADS device into which the watchdog signal is to be transmitted. nidxoffs Index offset within the ADS device into which the watchdog signal is to be transmitted. svarname Symbol name within the ADS device into which the watchdog signal is to be transmitted. twatchdogtime Cycle time with which the watchdog signal is to be transmitted. bsendnow The watchdog signal is transmitted immediately in response to a rising edge. Output parameters nlastcnt berror nerrorid Transmission is active. Most recently transmitted counter state. An error occurred during the transmission. Error number if an error has occurred. The FB_WriteWatchdog() function block cyclically writes the contents of a 32-bit counter into another ADS device. The counter is incremented every time the transmission is successful. The FB_CheckWatchdog() [} 19] function block can be used at the receiver to evaluate this signal. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the 20 Version: 1.0

Watchdog function blocks flags area. The period for twachtdogtime should not be shorter than 1 second, to avoid transmitting the counter state too frequently. If 0 seconds is given for twatchdogtime, the signal is not transmitted. Please also note the description of the FB_CheckWatchdog() [} 19] block. If the benable input is set to FALSE, no further transmission of the watchdog signal is carried out. Requirements Development environment Target system type PLC libraries to include TwinCAT v3.0.0 PC or CX (x86) Tc2_DataExchange Version: 1.0 21

Data Types 5 Data Types 5.1 E_AdsComMode TYPE E_AdsComMode : ( eadscommodesecurecom := 0, eadscommodefastcom := 1 ); END_TYPE Prerequisites Development environment Target platform PLC libraries to include TwinCAT v3.1.4020 PC or CX (x86) Tc2_DataExchange 22 Version: 1.0

Global constants 6 Global constants 6.1 Library version All libraries have a specific version. This version is shown in the PLC library repository too. A global constant contains the library version information: Global_Version VAR_GLOBAL CONSTANT stlibversion_tc2_dataexchange : ST_LibVersion; To compare the existing version to a required version the function F_CmpLibVersion (defined in Tc2_System library) is offered. Hint: All other possibilities known from TwinCAT2 libraries to query a library version are obsolete! Version: 1.0 23