WagoLib_CAN_Gateway_02.lib

Similar documents
Library for Building Automation. Module Descriptions for KNX IP Master

Redundant ethernet communication with WAGO Ethernet-Controller Application note

Libraries for Building Automation. Function Blocks and Data Types for the BACnet Controller

WAGO Remote IO with Fanuc Robot using EtherNet/IP Protocol Application note

Application note. WAGO-I/O-SYSTEM 750 DALI Multi-Master Module Configuration of a DALI Lighting System via WAGO- I/O-PRO V2.

Application Note. WAGO-I/O-SYSTEM 750 Connecting energy meters with M-Bus interface to the WAGO-I/O-SYSTEM

Application Note. Building. Automation WAGO-I/O-PRO V2.3. openvpn with Linux based Devices A500880_en. Version 1.1.1

The HART Module on the WAGO ETHERNET Controller Application Note

WAGO-I/O-SYSTEM 750 CODESYS-2-Library WagoLibWakeOnLan.lib Wake on lan Remote wake up of network devices

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

Library for Building Automation. Library Description for for the WAGO BACnet Library BACnet_02.lib

Configuring National Instruments Lab View with WAGO I/O Application note

Fieldbus Independent I/O Modules Bluetooth RF Transceiver Quick Start

Using the WagoAppEtherNetIP_Adapter library with a CompactLogix Controller A500930

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

Using WAGO Series 750 DeviceNet IO with an A-B SLC SDN Scanner Application note

Application Note. Enable port forwarding for PFC. A500840, English Version 1.0.0

Using the WAGO as Remote I/O with an Omron SYSMAC CJ2 Series PLC. Application note. A116700, English Version 1.1.0

Using WAGO Series 750 DeviceNet IO with an A-B ControlLogix 1756-DNB Scanner Application note

Application Note. a HART Tool-routing with Emerson AMS HART over TH LINK PROFIBUS for Asset Management 1.0.0

Libraries for Building Automation. Function Block Description for DALI Multi-Master Module

Fieldbus Independent I/O Modules 8 DI DC 24 V 3.0 ms, Manual

Using the WAGO as Remote I/O with a ControlLogix Ethernet/IP Bridge Module Application note

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

Application Note. Connection of an WAGO ETHERNET Coupler/Controller to a S controller

Fieldbus Independent I/O Modules SSI Transmitter Interface Manual

Library Description. MBUS_649_01.lib WAGO M-Bus Library. Version 1.0.1

Fieldbus Independent I/O Modules End Module (/xxx-xxx) Manual

Library Description. KNX_02.lib. CODESYS V2.3 Function Block for the KNX/EIB/TP1 Module

Library for Building Automation. Function block descriptions for time- switching functions

Fieldbus Independent I/O Modules Field Side Connection Manual

Fieldbus Independent I/O Modules 4 AI Pt100/ RTD , (/xxx-xxx) Manual

Library for Building Automation

Fieldbus Independent I/O Modules 4 AI DC 0-10 V, Single-Ended Manual

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

Fieldbus Independent I/O Modules 2 DI DC 24 V 3.0 ms, High-Side Switching (/xxx-xxx) Manual

Fieldbus Independent I/O Modules 24 V DC Power Supply/Fuse/Diagn Manual

Fieldbus Independent I/O Modules 4 DO DC 24 V 0.5 A, High-Side Switching (/xxx-xxx)

Fieldbus Independent I/O Modules 1 AI DMS Manual

Fieldbus Independent I/O Modules 2 AI 4-20 ma, Single-Ended Manual

Using power measurement module with TIA A500671

PROFIsafe modules V2 ipar 75x-66x/ WAGO Safety-Editor-75x Quickstart

Fieldbus Independent I/O Modules 2 AO 4-20 ma Manual

Library Description. ColourConverter_01.lib Library for Converting Color Formats. Version 1.0.2

Libraries for Building Automation

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

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

User Manual Connection to CAN

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

Connection Procedure of WAGO CANopen Bus Coupler and Pro-face AGP-3****-CA1M/LT. Instruction Manual. Version1.1 (

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

Manual Version WAGO TO-PASS 761. Telecontrol Modules. 761-xxx. System Description

Fieldbus Independent I/O Modules Serial Interface RS 232 C (/xxx-xxx) Manual

Servo Press Kit YJKP - Description of host function blocks in Allen Bradley (Studio 5000 Logix Designer V26.01)

Library Description. Enocean_06.lib WAGO EnOcean Profile Library. Version 1.0.1

Modbus/TCP OPC Server

Servo press kit YJKP - Host interface

Library Description. Building WAGO-I/O- PRO V2.3. Automation. MpBus_03.lib CODESYS V2.3 Module for MP-Bus. Version 1.0.1

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

CANopen User Manual IE25, IWN

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

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

Technical Note. WDGA Setting the CANopen Node-ID and baudrate. Stand:

Library for Building Automation. Function Block Description for M-Bus

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

AN1203 Automatic start of CANopen slave devices

WAGO-I/O-SYSTEM 750 IO-Link Master

Dynamic Object Dictionary

Manual. CAN 300 PRO CANopen Slave. CAN Communication Modules for S7-300 as CANopen Slave. Edition 3 /

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

User Manual. R Series Encoders with CANopen Interface RNX HE 11 / 2005

Ingenieurbüro für Echtzeitprogrammierung CAN-LIB

Contents. Additional Instructions P-3X CANopen

Manual / Electronic Circuit Breaker DC 24 V, A. Version 1.0.0

Communications Manual MC 5010 MC 5005 MC 5004 MCS RS232 / WE CREATE MOTION

User Manual. K Series Encoders with CANopen Interface KXN FE 09 / 2005

CAN 300 / CAN 400 Application Example DS402 ERL

WAGO-I/O-SYSTEM 750 IO-Link Master

Quickstart reference for the software e!cockpit

Linear-Encoders CANopen Profile

CANopen Slave. Protocol API V Hilscher Gesellschaft für Systemautomation mbh

Manual. Global Drive. PLC Developer Studio. Global Drive. LenzeIOSystem.lib. Function library

User Manual Connection to BRC-Symbolic

ECN module MGC-PRO MicroDrive

NOVOtechnik. Content. TIM CANopen Gebrauchsanleitung TIM CANopen user manual SIEDLE GRUPPE

NOVOtechnik SIEDLE GRUPPE

efesotomasyon.com - Klockner Moeller - inverter User Manual CAN-Monitor

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

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

The Next Level of Energy Data Management Fast Data Acquisition via Parameterization No Programming

CANopen Manager. Software Manual. CANopen Manager Manual Doc.-No.: C / Rev esd gmbh Page 1 of 44

AN1204 Configuration of CANopen devices via LSS

PISO-CAN200/400. Linux SocketCAN CANopen Manual

VIPA SPEED7 Library. OPL_SP7-LIB SW90HS0MA V Manual. HB00 OPL_SP7-LIB SW90HS0MA V en Block library - EtherCAT Communication

PLC2 Board Communication Manual CANopen Slave

Application Note. Modbus on CMMP-AS- -M3/M0. Connection and configuration of the motor controller CMMP-AS- -M3/M0 within a Modbus/TCP network.

Linear-Encoder Multi-Sensor CANopen Profile

I-7565-CPM Intelligent USB/CANopen Master Module

User Manual. Connection to Allen Bradley DF1. Part Number: Version: 2. Date: Valid for: TSwin.net 4.1x

YJKP with Mitsubishi Q series PLC control via Modbus TCP

Transcription:

Library description 750-658.lib CoDeSys V2.3 function blocks Version 1.2.0

Copyright 2012 by WAGO Kontakttechnik GmbH & Co. KG All rights reserved. WAGO Kontakttechnik GmbH & Co. KG Hansastraße 27 D-32423 Minden Phone: +49 (0) 571/8 87 0 Fax: +49 (0) 571/8 87 1 69 E-Mail: info@wago.com Web: http://www.wago.com Technical Support Phone: +49 (0) 571/8 87 5 55 Fax: +49 (0) 571/8 87 85 55 E-mail: support@wago.com Every conceivable measure has been taken to ensure the accuracy and completeness of this documentation. However, as errors can never be fully excluded, we always appreciate any information or suggestions for improving the documentation. We wish to point out that the software and hardware terms, as well as the trademarks of companies used and/or mentioned in the present manual, are generally protected by trademark or patent.

Table of Contents: 1 Important Notes... 1 1.1 Legal Principles... 1 1.1.1 Copyright... 1 1.1.2 Personnel Qualification... 1 1.1.3 Intended use... 1 1.2 Scope of Validity... 2 2 Library.lib... 3 2.1 Module 750-658... 3 2.2 Library overview... 3 3 Function blocks... 4 3.1 CAN_Communication... 4 3.2 CAN_Diagnosis... 6 3.3 CAN_L2_RX_11Bit_Frame... 8 3.4 CAN_L2_RX_29Bit_Frame... 10 3.5 CAN_L2_TX_11Bit_Frame... 12 3.6 CAN_L2_TX_29Bit_Frame... 14 3.7 CAN_CIA405_NMT... 16 3.8 CAN_CIA405_NMT_GUARDING... 18 3.9 CAN_CIA405_EMY... 20 3.10 CAN_CIA405_SDO_WRITE4... 22 3.11 CAN_CIA405_SDO_READ4... 24 3.12 CAN_FullConfig... 26 3.13 CAN_FullConfigCheck... 30 3.14 CAN_SLAVE_SDO... 31 3.15 CAN_SLAVE_NMT_GUARDING... 32 4 Data structures... 33 4.1 CAN_FullConfiguration... 33 4.2 CAN_eErrorCode... 33 4.3 CAN_TemplateDiagnosis... 34

Important Notes 1 1 Important Notes 1.1 Legal Principles 1.1.1 Copyright To ensure fast installation and start-up of the units, we strongly recommend that the following information and explanations are carefully read and adhered to. This document, including all figures and illustrations contained therein, is subject to copyright. Any use of this document that infringes upon the copyright provisions stipulated herein is prohibited. Reproduction, translation, electronic and phototechnical filing/archiving (e.g., photocopying), as well as any amendments require the written consent of WAGO Kontakttechnik GmbH & Co. KG, Minden, Germany. Non-observance will entail the right of claims for damages. WAGO Kontakttechnik GmbH & Co. KG reserves the right to make any alterations or modifications that serve to increase the efficiency of technical progress. WAGO Kontakttechnik GmbH & Co. KG owns all rights arising from granting patents or from the legal protection of utility patents. Third-party products are always mentioned without any reference to patent rights. Thus, the existence of such rights cannot be excluded. 1.1.2 Personnel Qualification 1.1.3 Intended use The use of the product described in this document is exclusively geared to specialists having qualifications in SPS programming, electrical specialists or persons instructed by electrical specialists who are also familiar with the appropriate current standards. WAGO Kontakttechnik GmbH & Co. KG assumes no liability resulting from improper action and damage to WAGO products and third-party products due to non-observance of the information contained in this document. For each individual application, the components are supplied from the factory with a dedicated hardware and software configuration. Modifications are only admitted within the framework of the possibilities documented in this document. All other changes to the hardware and/or software and the nonconforming use of the components entail the exclusion of liability on part of WAGO Kontakttechnik GmbH & Co. KG. Please send your requests for modified and new hardware or software configurations directly to WAGO Kontakttechnik GmbH & Co. KG.

2 Important Notes 1.2 Scope of Validity This application note is based on the stated hardware and software from the specific manufacturer, as well as the associated documentation. This application note is therefore only valid for the described installation. New hardware and software versions may need to be handled differently. Please note the detailed description in the specific manuals.

Library.lib 3 2 Library.lib 2.1 Module 750-658 These function blocks are designed to be used with module 750-658 and Wago CoDeSys V2.3 programmable devices. 2.2 Library overview The following drawing shows the content of the library.

4 Function blocks 3 Function blocks 3.1 CAN_Communication Category: CAN Name: CAN_Communication Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable IO accesss to the module ptinmodule ptoutmodule POINTER TO ARRAY[0..47] OF BYTE POINTER TO ARRAY[0..47] OF BYTE Pointer to input area of module 750-658 Pointer to output area of module 750-658 bsizeacyclicchannel BYTE Size of acyclic channel bsizemodule750_658 BYTE Module size Input/Output parameters Data type Comment: xresetacyclicchannel BOOL Reset acyclic channel xresetcanchannel BOOL Reset CAN channel Output parameter Data type Comment: bactualsizemodule_750_632 BYTE Modul size sstatus CAN_eStatus Status xacyclicchannelerror BOOL Acyclic channel error eacyclicchannelerror tmbx2errorcode Error codes acyclic channel xcanchannelerror BOOL CAN channel error ecanchannelerror tmbx2errorcode Error codes CAN channel Graphical illustration:

Function blocks 5 Function Description Each can module must use exactly one communication block. This block must be called before any other CAN function block. All CAN blocks must be used within the same task. After start up, it takes several plc cycles to finish initialization. The other function blocks from this library will only work it the communication block indicates xacyclicchannelerror=false and xcanchannel- Error=False. The module settings according to the size of the acyclic channel and the general module size must match to the function block inputs. This function block will not configure the module. CAN_eStatus : CAN_Module_size_matches := 0, CAN_Error_module_size := 1, CAN_Error_acyclic_channel_size := 2, CAN_Comm_Disabled := 3 tmbx2errorcode : MBX_OK := 0, (* all is well *) MBXERR_NOT_READY := 1, (* service not (yet) available *) MBXERR_PRM_INVALID := 2, (* invalid input parameter(s) *) MBXERR_CFG_INVALID := 3, (* configuration invalid *) MBXERR_DENIED := 4, (* service denied (check operation mode) *) MBXERR_FULL := 5, (* buffer full *) MBXERR_REMOTE := 6, (* unexpected behaviour of remote end *) MBXERR_GENERAL := 7 (* general error *)

6 Function blocks 3.2 CAN_Diagnosis Category: CAN Name: CAN_Diagnosis Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable diagnosis handling dttime DT Time for timestamp within the diagnosis buffer Input/Output parameters Data type Comment: xreset BOOL Clear Buffer fbcan_communication CAN_Communic ation Access to instance of communication block for this module Output parameter Data type Comment: eerrorcode CAN_eErrorCode Error code ediagqualmode MBX_eDiagQual Diagnosis qualifier Mode ediagqualtype MBX_eDiagQual Diagnosis type Type werrorcnt WORD Error count wwarningcnt WORD Warning count wtotalcnt WORD Total diagnosis count Graphical illustration:

Function blocks 7 TYPE MBX_eDiagQualMode : ( MBX_NoDiag := 0, MBX_DiagSingleShot := 1, MBX_DiagDisappears := 2, MBX_DiagAppears := 3 ); END_TYPE TYPE MBX_eDiagQualType : ( MBX_DiagType_OK := 0, MBX_DiagNotification := 1, MBX_DiagWarning := 2, MBX_DiagError := 3 ); END_TYPE Function Description This function block needs an instance of a communication block. The actual diagnosis will be displayed at the outputs of the function block. An additional visualization shows data from the internal diagnosis buffer. This buffer is a ring buffer. The size of the ringbuffer is determined by gccan_diagbuffer. TYPE CAN_eErrorCode : ( _No_Error := 0, CAN_Stuff_Error := 1000, CAN_Form_Error := 1001, CAN_Acknowledgement_Error := 1002, CAN_Bit_Error_recessive := 1003, CAN_Bit_Error_dominant := 1004, CAN_CRC_Error := 1005, CAN_SW_Error := 1006, CAN_Hardware_In_Bus_Off_State := 1007, CAN_RxCounter_Bigger_Than_127 := 1008, CAN_RxCounter_Bigger_Than_96 := 1009, CAN_TxCounter_Bigger_Than_127 := 1010, CAN_TxCounter_Bigger_Than_96 := 1011, CAN_Transmit_Error := 1012, CAN_Arbitration_Lost := 1013, CAN_RxBuffer0_Overrun := 1014, CAN_RxBuffer1_Overrun := 1015, CAN_TxBuffer_Overrun := 1016, CAN_Bus_Off_State := 1017, CAN_HAL_Internal_Buffer_Overrun := 1018, CAN_DRV_Internal_Upstrm_Buf_Overrun := 1019, CAN_DRV_Internal_Dnstrm_Buf_Overrun := 1020, General_Error := 1021, _24V_Unpowered := 1022 ); END_TYPE

8 Function blocks 3.3 CAN_L2_RX_11Bit_Frame Category: CAN Name: CAN_RX_11Bit_Fame Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable function block wcanid WORD COB ID of message to be received xcanbuffer BOOL Use internal buffer x29bitmodeconfigured BOOL If the module is configured to allow 29 bit CAN IDs this input must be set to true Input/Output parameters Data type Comment: xreadframe BOOL Start reading, will be reset after data could be read fbcan_communication CAN_Communic ation Instance of communication block for this module Output parameter Data type Comment: xconfirm BOOL wcounter WORD Each time data could be read, this counter will be increased xrtr_frame BOOL Indicates a RTR frame bdatalength BYTE Length of received can telegramm adata ARRAY [1..8] OF Data in can telegramm BYTE eerror CAN_eL2_FRAM E_ERROR Error codes CAN channel Graphical illustration:

Function blocks 9 Function Description This function block needs an instance of a communication block. This function block allows to receive data from a CAN telegrams identified by wcanid. Listening will be started if the variable xreadframe is set. If data was received this variable will be reset by the function block. With the falling edge of xreadframe the outputs will be set. The input x29bitmodeconfigured must match the module configuration. TYPE CAN_eL2_FRAME_ERROR : ( CAN_L2_OK :=0, CAN_L2_BUS_IDLE :=1, CAN_L2_PORT_WRONG :=2, CAN_L2_PORT_BUSY :=3, CAN_L2_SEND_OK :=4, CAN_L2_RECEIVE_OK :=5, CAN_L2_SEND_ERROR :=6, CAN_L2_ID_ERROR :=7, CAN_L2_DATALENGTH_ERROR :=8, CAN_L2_RECEIVE_BUFFER_ERROR :=9, CAN_L2_REGISTER_ERROR :=10, CAN_L2_TIMEOUT :=99 ); END_TYPE

10 Function blocks 3.4 CAN_L2_RX_29Bit_Frame Category: CAN Name: CAN_RX_29Bit_Frame Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable function block dwcanid DWORD COB ID of message to be received xcanbuffer BOOL Use internal buffer Input/Output parameters Data type Comment: xreadframe BOOL Start reading, will be reset after data could be read fbcan_communication CAN_Communic ation Instance of communication block for this module Output parameter Data type Comment: xconfirm BOOL wcounter WORD Each time data could be read, this counter will be increased xrtr_frame BOOL Indicates a RTR frame bdatalength BYTE Length of received can telegramm adata ARRAY [1..8] OF Data in can telegramm BYTE eerror CAN_eL2_FRAM E_ERROR Error codes CAN channel Graphical illustration:

Function blocks 11 Function Description This function block needs an instance of a communication block. This function block allows to receive data from a CAN telegram identified by wcanid. Listening will be started if the variable xreadframe is set. If data was received this variable will be reset by the function block. With the falling edge of xreadframe the outputs will be set. The modul must be configured to 29 bit mode. TYPE CAN_eL2_FRAME_ERROR : ( CAN_L2_OK :=0, CAN_L2_BUS_IDLE :=1, CAN_L2_PORT_WRONG :=2, CAN_L2_PORT_BUSY :=3, CAN_L2_SEND_OK :=4, CAN_L2_RECEIVE_OK :=5, CAN_L2_SEND_ERROR :=6, CAN_L2_ID_ERROR :=7, CAN_L2_DATALENGTH_ERROR :=8, CAN_L2_RECEIVE_BUFFER_ERROR :=9, CAN_L2_REGISTER_ERROR :=10, CAN_L2_TIMEOUT :=99 ); END_TYPE

12 Function blocks 3.5 CAN_L2_TX_11Bit_Frame Category: CAN Name: CAN_TX_11Bit_Frame Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable function block wcanid WORD CAN ID of message to be transmitted xrtr_frame BOOL Send RTR frame adata ARRAY [1..8] OF Data to be transmitted BYTE bdatalength BYTE Number of byte in can telegramm x29bitmodeconfigured BOOL If the module is configured to allow 29 bit CAN IDs this input must be set to true Input/Output parameters Data type Comment: xwriteframe BOOL Start writing, will be reset after data could be transmitted fbcan_communication CAN_Communic ation Instance of communication block for this module Output parameter Data type Comment: xconfirm BOOL eerror CAN_eL2_FRAM E_ERROR Error codes CAN channel Graphical illustration:

Function blocks 13 Function Description This function block needs an instance of a communication block. This function block allows to transmit data. The COB ID is defined by wcanid. The amount of byte is set by bdatalength while the data is put to the variable adata. The fuction will be executed if the variable xwriteframe is set. The variable will be reset by the function block if the telegram was transmitted. TYPE CAN_eL2_FRAME_ERROR : ( CAN_L2_OK :=0, CAN_L2_BUS_IDLE :=1, CAN_L2_PORT_WRONG :=2, CAN_L2_PORT_BUSY :=3, CAN_L2_SEND_OK :=4, CAN_L2_RECEIVE_OK :=5, CAN_L2_SEND_ERROR :=6, CAN_L2_ID_ERROR :=7, CAN_L2_DATALENGTH_ERROR :=8, CAN_L2_RECEIVE_BUFFER_ERROR :=9, CAN_L2_REGISTER_ERROR :=10, CAN_L2_TIMEOUT :=99 ); END_TYPE

14 Function blocks 3.6 CAN_L2_TX_29Bit_Frame Category: CAN Name: CAN_TX_29Bit_Frame Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable function block dwcanid DWORD COB ID of message to be transmitted xrtr_frame BOOL Send RTR frame adata ARRAY [1..8] OF Data to be transmitted BYTE bdatalength BYTE Number of byte in can telegramm Input/Output parameters Data type Comment: xwriteframe BOOL Start writing, will be reset after data could be transmitted fbcan_communication CAN_Communic ation Instance of communication block Output parameter Data type Comment: xconfirm BOOL eerror CAN_eL2_FRAM E_ERROR Error codes CAN channel Graphical illustration:

Function blocks 15 Function Description This function block needs an instance of a communication block. This function block allows to transmit data. The COB ID is defined by dwcanid. The amount of byte is set by bdatalength while the data is put to the variable adata. The fuction will be executed if the variable xwriteframe is set. TYPE CAN_eL2_FRAME_ERROR : ( CAN_L2_OK :=0, CAN_L2_BUS_IDLE :=1, CAN_L2_PORT_WRONG :=2, CAN_L2_PORT_BUSY :=3, CAN_L2_SEND_OK :=4, CAN_L2_RECEIVE_OK :=5, CAN_L2_SEND_ERROR :=6, CAN_L2_ID_ERROR :=7, CAN_L2_DATALENGTH_ERROR :=8, CAN_L2_RECEIVE_BUFFER_ERROR :=9, CAN_L2_REGISTER_ERROR :=10, CAN_L2_TIMEOUT :=99 ); END_TYPE

16 Function blocks 3.7 CAN_CIA405_NMT Category: CAN Name: CAN_CIA405_NMT Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: bdevice BYTE CANopen device address estate CAN_CIA405_T State RANSITION_ST ATE xenable BOOL Transmit telegramm ttimeout TIME Timeout Input/Output parameters Data type Comment: fbcan_communication CAN_Communic Instance of communication block ation Output parameter Data type Comment: xconfirm BOOL eerror CAN_CIA405_C ANOPEN_KERN EL_ERROR Error codes CAN channel Graphical illustration:

Function blocks 17 Function Description This function block needs an instance of a communication block. This function block allows to transmit a NMT command. TYPE CAN_CIA405_TRANSITION_STATE: ( CAN_START_REMOTE_NODE, CAN_STOP_REMOTE_NODE, CAN_ENTER_PRE_OPERATIONAL, CAN_RESET_NODE, CAN_RESET_COMMUNICATION ); END_TYPE TYPE CAN_CIA405_CANOPEN_KERNEL_ERROR: (CAN_NoError :=0, CAN_AnyError :=16#1, CAN_DataOverflow :=16#2, CAN_Timeout :=16#3, CAN_SDO_Abort :=16#4, CAN_BUS_OFF :=16#10, CAN_ErrorPassive :=16#11, CAN_UnknownDataAmount :=16#21, CAN_WrongIndex :=16#22 );

18 Function blocks 3.8 CAN_CIA405_NMT_GUARDING Category: CAN Name: CAN_CIA405_NMT_GUARDING Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: bdevice BYTE CANopen device address xenable BOOL Transmit telegramm ttimeout TIME Timeout Input/Output parameters Data type Comment: fbcan_communication CAN_Communic Instance of communication block ation Output parameter Data type Comment: xconfirm BOOL True after the guarding response of the slave was received eerror CAN_CIA405_C ANOPEN_KERN EL_ERROR Error codes CAN channel estatus CAN_CIA405_ST ATE 0:CAN_INIT, 1:CAN_RESET_COMM, 2:CAN_RESET_APP, 3:CAN_PRE_OPERATIONAL, 4:CAN_STOPPED, 5:CAN_OPERATIONAL, 6:CAN_UNKNOWN, 7:CAN_NOT_AVAIL Graphical illustration:

Function blocks 19 Function Description This function block needs an instance of a communication block. This function block allows to transmit a node guarding command. The output estatus shows the actual status of the slave. TYPE CAN_CIA405_CANOPEN_KERNEL_ERROR: (CAN_NoError :=0, CAN_AnyError :=16#1, CAN_DataOverflow :=16#2, CAN_Timeout :=16#3, CAN_SDO_Abort :=16#4, CAN_BUS_OFF :=16#10, CAN_ErrorPassive :=16#11, CAN_UnknownDataAmount :=16#21, CAN_WrongIndex :=16#22 );

20 Function blocks 3.9 CAN_CIA405_EMY Category: CAN Name: CAN_CIA405_EMC Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable function block bdevice BYTE CANopen device address xcanbuffer BOOL Use buffered mode xreadframe BOOL Activate reading of emergency messages Input/Output parameters Data type Comment: fbcan_communication CAN_Communic Instance of communication block ation Output parameter Data type Comment: xconfirm BOOL True if a emergency message was received wcounter WORD Message counter typemcy_error CAN_CIA405_E MCY_ERROR Error coding according to CIA Graphical illustration:

Function blocks 21 Function Description This function block needs an instance of a communication block. This function block allows to receive emergency messages. The output typemcy_error displays the information as: EMCY_ERROR_CODE: WORD; ERROR_REGISTER: BYTE; ERROR_FIELD: ARRAY [1..5] OF BYTE; Details are listed in the coupler manual.

22 Function blocks 3.10 CAN_CIA405_SDO_WRITE4 Category: CAN Name: CAN_CIA405_SDO_WRITE4 Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: bdevice BYTE CANopen device address windex WORD Index bsubindex BYTE Subindex xenable BOOL Transmit data adata ARRAY [1..4] OF Data to be written BYTE bdatalength BYTE Amount of byte to write ttimeout TIME Timeout Input/Output parameters Data type Comment: fbcan_communication CAN_Communic ation Instance of communication block Output parameter Data type Comment: xconfirm BOOL True after the write command was performed. eerror typerrorinfo CAN_CIA405_C ANOPEN_KERN EL_ERROR CAN_CIA405_S DO_ERROR 16#3: Timeout 16#4: SDO abort error 16#22: Wrong index in response Error coding according to CIA Graphical illustration:

Function blocks 23 Function Description This function block needs an instance of a communication block. This function block allows to write up to four byte in the object dictionary of a slave by using SDO communication. The write command will be started by setting xenable to True. After the execution the output xconfirm becomes True as well. The outputs eerror and typerrorinfo give detailed error information. To execute a new write command the variable xenable needs to be set to zero by the application programm. xconfirm will acknowledge this by becoming false as well. Now a new command may be written.

24 Function blocks 3.11 CAN_CIA405_SDO_READ4 Category: CAN Name: CAN_CIA405_SDO_READ4 Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: bdevice BYTE CANopen device address windex WORD Index bsubindex BYTE Subindex xenable BOOL Start reading ttimeout TIME Timeout Input/Output parameters Data type Comment: fbcan_communication CAN_Communic ation Instance of communication block Output parameter Data type Comment: xconfirm BOOL True after the read command was performed. adata ARRAY [1..4] OF Data read BYTE bdatalength BYTE Amount of byte valid in adata eerror typerrorinfo CAN_CIA405_C ANOPEN_KERN EL_ERROR CAN_CIA405_S DO_ERROR 16#3: Timeout 16#4: SDO abort error 16#21: output bdatalength invalid 16#22: Wrong index in response Error coding according to CIA Graphical illustration:

Function blocks 25 Function Description This function block needs an instance of a communication block. This function block allows to read up to four bytes in the object dictionary of a slave by using SDO communication. The read command will be started by setting xenable to True. After the execution the output xconfirm becomes True as well. The outputs eerror and typerrorinfo give detailed error information. To execute a new write command the variable xenable needs to be set to zero by the application programm. xconfirm will acknowledge this by becoming false as well. Now a new object may be read.

26 Function blocks 3.12 CAN_FullConfig Category: CAN Name: CAN_FullConfig Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xexecute BOOL Start reading or writing of configuration xwriteread BOOL 0:Read, 1:Write xsavevalues BOOL Store data after writing in the eeprom Input/Output parameters Data type Comment: ebitrate CAN_eBitrate CAN_10kBits := 0, CAN_20kBits := 1, CAN_50kBits := 2, CAN_125kBits := 3, CAN_250kBits := 4, CAN_500kBits := 5, CAN_800kBits := 6, CAN_1000kBits := 7, CAN_Auto := 8 emode CAN_eMode CAN_Sniffer := 0, CAN_Transparent := 1, CAN_Mapped := 2 x29bitenabled BOOL Module allows 29 Bit CAN IDs xsdo_enabled BOOL Enable SDO transfer over the acyclic channel typconfigdata fbcan_communication CAN_typFullConf iguration CAN_Communic ation A structure with all user values of the can module Instance of communication block Output parameter Data type Comment: xdone BOOL Job finished xbusy BOOL Job running xerror BOOL Job finished with error

Function blocks 27 eerrorcode MBX_eRegCom Status MBX_AccessDenied := 2, MBX_TableReadOnly := 3, MBX_DataLengthError := 4, MBX_UnknownTable := 5, MBX_UnknownRegister := 6, MBX_Busy := 7, MBX_Timeout := 9, Graphical illustration:

28 Function blocks Function Description This function block needs an instance of a communication block. The actual modul configuration may be read. The modul may be configured with this function block either by writing the user data to the ram area or to the eeprom area. If this block writes to the eeprom, please keep in mind, that the eeprom may be destroyed after app. 100.000 write cycles. If the input values emode or x29bitenabled are changed, it is necessary to disable and afterwords enable the communication block again. This block will handle all filter tables (50..55), the mapping tables (100.144,200..244) and the register 32,35,36,37,38 and 50. If the error code MBX_Timeout occurs, it may be necessary to change the global constant gccan_configtimeout : TIME:=t#500ms; TYPE CAN_typFullConfiguration : STRUCT aregister : ARRAY[0..gcCAN_MaxBufferClassicRegister] OF WORD; (*module register*) COB_ID_Filter : ARRAY[0..5] OF CAN_typFilterSettings; mytx_mapping : ARRAY[0..44] OF CAN_typMappingTxSettings; myrx_mapping : ARRAY[0..44] OF CAN_typMappingRxSettings; END_STRUCT END_TYPE TYPE CAN_typFilterSettings : STRUCT LowHigh_ID :WORD; (*Filter ID low ->high word from dword *) LowLow_ID :WORD; (*Filter ID low ->low word from dword *) HighHigh_ID :WORD; (*Filter ID high ->high word from dword *) HighLow_ID :WORD; (*Filter ID high ->low word from dword *) Feature1 :WORD; (*1:Enable *) Feature2 :WORD; (*1:override *) END_STRUCT END_TYPE TYPE CAN_typMappingRxSettings : STRUCT COB_ID_MSW :WORD; (*COB ID ->high word from dword *) COB_ID_LSW :WORD; CopyToPDIn :WORD; Data_0_1 :WORD;(**) Data_2_3 :WORD;(**) Data_4_5 :WORD;(**) Data_6_7 :WORD;(**) END_STRUCT END_TYPE

Function blocks 29 TYPE CAN_typMappingTxSettings : STRUCT COB_ID_MSW:WORD; COB_ID_LSW:WORD; SendGroup:WORD; FixedValue:WORD; Data_0_1:WORD;(**) Data_2_3:WORD;(**) Data_4_5:WORD;(**) Data_6_7:WORD;(**) CycleTime:WORD; END_STRUCT END_TYPE An example how to initialize the receive direction: myrx_mapping :ARRAY[0..43] OF CAN_typMappingRxSettings:= (COB_ID_MSW:=1,COB_ID_LSW:=1,CopyToPDIn:=2, Data_0_1:=20,Data_2_3:=21,Data_4_5:=22,Data_6_7:=23), (COB_ID_MSW:=1,COB_ID_LSW:=1,CopyToPDIn:=2, Data_0_1:=20,Data_2_3:=21,Data_4_5:=22,Data_6_7:=23), (COB_ID_MSW:=1,COB_ID_LSW:=1,CopyToPDIn:=2, Data_0_1:=20,Data_2_3:=21,Data_4_5:=22,Data_6_7:=23); An example how to initialize the transmit direction: mytx_mapping:array[0..43] OF CAN_typMappingTxSettings:= (COB_ID_MSW:=1,COB_ID_LSW:=1,SendGroup:=2,FixedValue:=0,Data_0_1:=20,Data_2_3: =21,Data_4_5:=22,Data_6_7:=23,CycleTime:=100), (COB_ID_MSW:=1,COB_ID_LSW:=1,SendGroup:=2,FixedValue:=0,Data_0_1:=20,Data_2_3: =21,Data_4_5:=22,Data_6_7:=23,CycleTime:=100), (COB_ID_MSW:=1,COB_ID_LSW:=1,SendGroup:=2,FixedValue:=0,Data_0_1:=20,Data_2_3: =21,Data_4_5:=22,Data_6_7:=23,CycleTime:=100);

30 Function blocks 3.13 CAN_FullConfigCheck Category: CAN Name: CAN_FullConfigCheck Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: Input/Output parameters Data type Comment: xexecute BOOL Start check the configuration typconfigdata CAN_typFullConf Structure with configuration data iguration fbcan_communication CAN_Communic ation Instance of communication block Output parameter Data type Comment: xbusy BOOL Operation in progress xerror BOOL An error occured xdatamatches BOOL Configuration matches Graphical illustration: Function Description This function block needs an instance of a communication block. This function block allows checking the configuration stored in the module against the configuration in the variable typconfigdata.

Function blocks 31 3.14 CAN_SLAVE_SDO Category: CAN Name: CAN_SLAVE_SDO Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: bdevice BYTE Node ID xenable BOOL Enable SDO server Input/Output parameters Data type Comment: aod fbcan_communication ARRAY[0..gcMA X_SERVER_SD O_OD] OF CAN_SERVER_ OD CAN_Communic ation Object dictionary. Available objects have to be defined by the application program. Instance of communication block Output parameter Data type Comment: xactive BOOL Server active Graphical illustration: Function Description This function block needs an instance of a communication block. This function block provides a simple object dictionary which may be read or written by a CANopen master using SDO communication. The global constant gcmax_server_sdo_od defines the total number of available objects.

32 Function blocks 3.15 CAN_SLAVE_NMT_GUARDING Category: CAN Name: CAN_SLAVE_NMT_GUARDING Type: Function Function block X Program Name of library:.lib Libraries used: WagoLibMBX_01.lib,WagoLibMBX_System_01.lib Applicable to: Input parameters Data type Comment: xenable BOOL Enable guarding bdevice BYTE Node ID estatus CAN_CIA405_ST ATE Actual status of the module in terms of CANopen. ttimeout TIME Period of time within a guarding message is expected. Input/Output parameters Data type Comment: fbcan_communication CAN_Communic ation Instance of communication block Output parameter Data type Comment: xactive BOOL Function block enabled xerror BOOL Guarding error detected. Graphical illustration: Function Description This function block needs an instance of a communication block. This function block handles incoming guarding messages and generates a respond according to the input estatus. After receiving the first guarding message the output xerror becomes false and stays false if within ttimeout the next guarding message is received. If within ttimeout now new guarding message is received the output xerror will be TRUE.

Data structures 33 4 Data structures 4.1 CAN_FullConfiguration TYPE CAN_typFullConfiguration : STRUCT aregister :ARRAY[0..gcCAN_MaxBufferClassicRegister] OF WORD; (*module register*) COB_ID_Filter mytx_mapping myrx_mapping : ARRAY[0..5] OF CAN_typFilterSettings; : ARRAY[0..43] OF CAN_typMappingTxSettings; : ARRAY[0..43] OF CAN_typMappingRxSettings; END_STRUCT END_TYPE 4.2 CAN_eErrorCode TYPE CAN_eErrorCode : _No_Error := 0, CAN_Stuff_Error := 1000, CAN_Form_Error := 1001, CAN_Acknowledgement_Error := 1002, CAN_Bit_Error_recessive := 1003, CAN_Bit_Error_dominant := 1004, CAN_CRC_Error := 1005, CAN_SW_Error := 1006, CAN_Hardware_In_Bus_Off_State := 1007, CAN_RxCounter_Bigger_Than_127 := 1008, CAN_RxCounter_Bigger_Than_96 := 1009, CAN_TxCounter_Bigger_Than_127 := 1010, CAN_TxCounter_Bigger_Than_96 := 1011, CAN_Transmit_Error := 1012, CAN_Arbitration_Lost := 1013, CAN_RxBuffer0_Overrun := 1014, CAN_RxBuffer1_Overrun := 1015, CAN_TxBuffer_Overrun := 1016, CAN_Bus_Off_State := 1017, CAN_HAL_Internal_Buffer_Overrun := 1018, CAN_DRV_Internal_Upstrm_Buf_Overrun := 1019,

34 Data structures CAN_DRV_Internal_Dnstrm_Buf_Overrun := 1020, General_Error := 1021, _24V_Unpowered := 1022 4.3 CAN_TemplateDiagnosis The placeholder MBXaux3 has to be replaced by the actual instance of the function block CAN_Diagnosis.

Data structures 35

WAGO Kontakttechnik GmbH & Co. KG Postfach 2880 D-32385 Minden Hansastraße 27 D-32423 Minden Phone: +49 (0) 571/8 87 0 Fax: +49 (0) 571/8 87 1 69 E-Mail: info@wago.com Internet: http://www.wago.com