Application Note ® PERSPECTO CP with TV Using serial interfaces A762100d English Version 1.0.2 Imprint Copyright 2013 by WAGO Kontakttechnik GmbH & Co. KG All rights reserved. WAGO Kontakttechnik GmbH & Co. KG Hansastraße 27 D-32423 Minden Phone: Fax: +49 (0) 571/8 87 – 0 +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 names, as well as the trademarks of companies used and/or mentioned in the present manual, are generally protected by trademark or patent. Application noteA762100d 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 Functional Range ....................................................................................... 3 3 Interfaces of Various Devices .................................................................... 3 3.1 Designations and Functions ................................................................... 3 3.2 Pin Assignment and Wiring ................................................................... 4 3.2.1 X3 (COM1) – CP 57, CP 104, CP 121, CP 150 .................................... 4 3.2.2 X2/X5 (COM2/CAN)– CP 35 ............................................................... 6 3.2.3 X2 (COM2/COM3) – CP 57, CP 104, CP 121 ...................................... 7 3.2.4 X2 (COM2) – CP 150 ............................................................................ 9 3.3 WAGO-I/O-PRO Programming .......................................................... 10 3.3.1 Simple, Transparent Serial Communication ........................................ 10 3.3.2 Using Higher-level Protocols ............................................................... 15 Application noteA762100d Application noteA762100d Important Notes 1 • 1 Important Notes 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. 1.1 Legal Principles 1.1.1 Copyright 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 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. 1.1.3 Intended Use 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 direct any requirements pertaining to a modified and/or new hardware or software configuration directly to WAGO Kontakttechnik GmbH & Co. KG. Application noteA762100d 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. Application noteA762100d Functional Range 2 • 3 Functional Range This application example demonstrates use of serial interfaces internal to PERSPECTO® CP control panel with Target Visualization (TV). 3 Interfaces of Various Devices 3.1 Designations and Functions Depending on the design, requirements and available space, PERSPECTO® CP series control panels with TV are equipped with various serial interfaces. These differences concern the number, connection type and the physical signal transmission of the interfaces. While the CP 35 QVGA TV has only one RS-485 serial interface on an RJ-45 socket for reasons of space, the CP 57 QVGA TV, CP 104 VGA TV and CP 121 SVGA TV each have 3 serial interfaces distributed on two 9-pin Sub-MinD connectors. These interfaces are found on the back of the devices, marked COM1, COM2 and COM3, and meet different requirements. For example, COM1 is designed connect serial RS-232 devices that require a hardware handshake (RTS/CTS) and COM2 is designed for operating RS-485 or for larger devices (10.4" or more) optionally as RS-422. Both interfaces are complimented by COM3, e.g. simple RS-232 devices without handshake. COM1 ... CP 35 QVGA TV nv CP 57 QVGA TV RS-232 CP 104 VGA TV RS-232 CP 121 SVGA TV RS-232 CP 150 XGA TV RS-232 Fig. Overview of the interface functionality * Hardware handshake possible nv not available Application noteA762100d COM2 ... RS-485 RS-485 RS-485/RS-422 RS485/RS-422 RS-232/RS-485/RS-422 COM3 ... nv RS-232 RS-232 RS-232 nv 4• Interfaces of Various Devices 3.2 Pin Assignment and Wiring 3.2.1 X3 (COM1) – CP 57, CP 104, CP 121, CP 150 For the following devices only: 3.2.1.1 • CP 57 QVGA TV • CP 104 VGA TV • CP 121 SVGA TV • CP 150 XGA TV RS-232 serial interface (COM1) The interface is designed as an RS-232 interface. It is DC coupled with the device ground. The interface is used for modem operation or for user-specific protocols. The connected data cable must be shielded. The following rule of thumb is used to connect to another RS-232 device. If the connecting cable requires a connector on one end and a socket on the other, they are to be connected 1:1. In all other cases, a null modem cable is to be used. 6 9 6 6 1 1 5 9 1 2 3 4 5 6 7 8 9 5 1 Null-Modem 1 2 3 4 5 6 7 8 9 1 6 9 9 5 5 6 Application noteA762100d 9 Figure 1: X3 connection – RS-232 serial interface 1 2 3 4 5 6 7 8 9 5 1 1:1 1 2 3 4 5 6 7 8 9 Interfaces of Various Devices Table 1: X3 pin assignment Pin 1 2 3 4 5 6 7 8 9 Application noteA762100d Assignment DCD RxD TxD DTR GND5V DSR RTS CTS RI Function Data carrier detect Receive Data for RS-232 Transmit Data for RS-232 Data Terminal ready Signal Ground Data set ready Request to send Clear to send Ring indicator • 5 6• Interfaces of Various Devices 3.2.2 X2/X5 (COM2/CAN)– CP 35 For the following device only: • 3.2.2.1 CP 35 QVGA TV RS-485 serial interface (COM2) / CAN 0 nterface This interface is designed as an RJ-45 connector. The interface is a combination of RS-485 serial interface and CAN 0 interface. The CAN 0 interface is designed with electrical isolation in accordance with ISO 11898. A terminating resistor that can be switched on by relay is integrated in the device in accordance with ISO11898. The connected data cable must be shielded. X2/X5 COM2 RS-485 CAN 0 8 1 Figure 2: X2/X5 connection – RS-485 serial interface / CAN 0 interface, RJ-45 Table 2: X2 / X5 pin assignment Pin 1 2 3 4 5 6 7 8 Assignment CAN_L CAN_H GND B (Rx-) A (Rx+) - Function CAN Signal low CAN Signal high Ground (CAN/RS-485) RS-485 RS-485 Not used Not used Not used Note: The interface is always addressed with COM2. Application noteA762100d Interfaces of Various Devices • 7 3.2.3 X2 (COM2/COM3) – CP 57, CP 104, CP 121 For the following devices only: 3.2.3.1 • CP 57 QVGA TV • CP 104 VGA TV • CP 121 SVGA TV RS-232 serial interfaces (COM3) and RS-485/RS-422 (COM2) The RS-232 and RS-484-/RS-422 interfaces are confined in one connector. They DC coupled with the power supply of the device. They are generally used for communication (service devices, modem operation, etc.). Both interfaces can be operated together. The connected data cable must be shielded. Figure 3: X2 connection – RS-485/RS-422 and RS-232 serial interface Table 3: X2 pin assignment 1,5K 121R Pin 1 2 3 4 5 6 7 8 9 Assignment Y (Tx+) RxD TxD Z (Tx-) GND5V R B (Rx-) A (Rx+) R Function RS-485/RS-422 Receive Data for RS-232 Transmit Data for RS-232 RS-485/RS-422 Signal Ground Terminating resistor RS-485/RS-422 RS-485/RS-422 Terminating resistor 1,5K +5V Whether COM1 is operated as an RS-485 or RS-422 interface, the definition is made in the "WAGO Control Center" advanced settings. The operating mode must be specified accordingly before the interface is used. Application noteA762100d 8• Interfaces of Various Devices You can find the "WAGO Control Center" in the start menu on the device under "Programs -> Utilities". Note COM2 can only be used as an RS-485 interface on the CP 57, i.e. the selection is grayed out for this device. Application noteA762100d Interfaces of Various Devices • 9 3.2.4 X2 (COM2) – CP 150 For the following device only: • 3.2.4.1 CP 150 XGA TV RS-232/RS-484/RS-422 serial interface (COM2) The interface is designed as a combined RS-232-/RS-484-/RS-422 interface. It is DC coupled with the power supply of the device. It is generally used for communication (service devices, modem operation, etc.). The connected data cable must be shielded. 5 9 6 1 RS232/ RS485/ RS422 Figure 4: X2 connection – RS-485/RS-422/RS-232 serial interface Table 4: X2 pin assignment 1,5K 121R Pin 1 2 3 4 5 6 7 8 9 Assignment Y (Tx+) RxD TxD Z (Tx-) GND5V R B (Rx-) A (Rx+) R Function RS-485/RS-422 Receive Data for RS-232 Transmit Data for RS-232 RS-485/RS-422 Signal Ground Terminating resistor RS-485/RS-422 RS-485/RS-422 Terminating resistor 1,5K +5V Whether COM2 is operated as an RS-485 or RS-422 interface, the definition is made on the slide switched on the side. The operating mode must be specified accordingly before the interface is used. Application noteA762100d 10 • Interfaces of Various Devices 3.3 WAGO-I/O-PRO Programming After getting familiar with the wiring of the respective interfaces in the previous section, we will not take a look at using the interfaces in the WAGO-I/O-PRO. 3.3.1 Simple, Transparent Serial Communication Thanks to the "SercomPerspecto.lib" library and the "Serial_Interface_01.lib" library available on all devices programmable with WAGO-I/O-PRO, all directly coupled serial interfaces are addressable in an identical manner. Only interfaces coupled via a fieldbus deviate from this. Only these two libraries are to be included in a project and the "SERIAL_INTERFACE" function block to call up from the "Serial_Interface_01.lib" library. The function block should be configured according to the interface used. For the control panels, the COM port No. comes from the interface labeling on the back, e.g., COM1 has port No. 1. It should also be noted that the other interface parameters match the type used (i.e., it does not make sense to use an RS-485 with the "RTS/CTS" setting). Please see useful parameter combinations in the table below. Application noteA762100d Interfaces of Various Devices • 11 Table : Parameter combinations Devices COM port No. Use CP 57 / 104 / 121 / 150 1 CP 35 / 57 / 104 / 121 / 150 2 CP 104 / 121 / 150 2 CP 150 2 CP 57 / 104 / 121 3 RS-232 RS-485 RS-422 RS-232 RS-232 Baud Rate BAUD_4800 BAUD_9600 BAUD_12000 BAUD_14400 BAUD_19200 BAUD_28800 BAUD_38400 BAUD_57600 BAUD_62500 BAUD_115200 BAUD_4800 BAUD_9600 BAUD_12000 BAUD_14400 BAUD_19200 BAUD_28800 BAUD_38400 BAUD_57600 BAUD_62500 BAUD_115200 BAUD_4800 BAUD_9600 BAUD_12000 BAUD_14400 BAUD_19200 BAUD_28800 BAUD_38400 BAUD_57600 BAUD_62500 BAUD_115200 BAUD_4800 BAUD_9600 BAUD_12000 BAUD_14400 BAUD_19200 BAUD_28800 BAUD_38400 BAUD_57600 BAUD_62500 BAUD_115200 BAUD_4800 BAUD_9600 BAUD_12000 BAUD_14400 BAUD_19200 BAUD_28800 BAUD_38400 BAUD_57600 BAUD_62500 BAUD_115200 Parity PARITY_NO PARITY_ODD PARITY_EVEN PARITY_NO PARITY_ODD PARITY_EVEN PARITY_NO PARITY_ODD PARITY_EVEN PARITY_NO PARITY_ODD PARITY_EVEN PARITY_NO PARITY_ODD PARITY_EVEN Stopbits STOPBITS_1 STOPBITS_2 STOPBITS_1 STOPBITS_2 STOPBITS_1 STOPBITS_2 STOPBITS_1 STOPBITS_2 STOPBITS_1 STOPBITS_2 Byte size BS7 BS8 BS7 BS8 BS7 BS8 BS7 BS8 BS7 BS8 Flow control NO_FLOW_CONTROL RTS / CTS HALFDUPLEX FULLDUPLEX NO_FLOW_CONTROL RTS / CTS NO_FLOW_CONTROL Application noteA762100d 12 • Interfaces of Various Devices With this knowledge, you can now create a simple WAGO-I/O-PRO project to send and receive any data transparently via the serial interface. A WAGO-I/O-PRO project is first created and any PERSPECTO® control panel selected as the target system from the list of available devices. If you actually have a control panel available, then select it here. In the next step, a program block is created in the "FUP" programming language, which can be given any name. In this example, the name "MyProgram" is used here and going forward. After creating the "MyProgram" program block, switch to the main menu "Window > Library Management" in the library manager and the "SercomPerspecto.lib" and "Serial_Interface_01.lib" libraries added to the project from the "Application" folder. Use the latest version of these libraries. • SercomPerspecto.lib -> Version 2.0 or higher • Serial_Interface_01.lib -> Version 2.6 or higher Application noteA762100d Interfaces of Various Devices • 13 After returning to the "MyProgram" program block previously created, create and call an instance of the "SERIAL_INTERFACE" library function block. Of course, do not forget to link the "MyProgram" function block to a corresponding task in the task configuration. In this example, COM1 was used and configured accordingly. However, COM2 / COM3 can also be easily reprogrammed and used. By setting the "StartSend" variable once, the content of the "Text" variable is then sent via the serial interface. After sending the content, the "StartSend" variable is automatically deleted from the communication module. The module enters the characters received in the "ReceiveBuffer" structure. The "ReceiveBuffer.Index" structural component is increased by one after receiving each character and always points to the first free space behind the received characters. Application noteA762100d 14 • Interfaces of Various Devices Because COM1 and thus an RS-232 interface was selected, signals Tx (pin 3) and Rx (pin 2) can now be bridged for test purposes and thus, the characters sent are again received in their own ReceiveBuffer. Hallo Welt! Application noteA762100d Interfaces of Various Devices • 15 3.3.2 Using Higher-level Protocols A number of serial protocols are available from WAGO for various applications. These include Modbus RTU/ASCII, 3964R, NMEA 0183 and various proprietary protocols for serial communication with other devices. At WAGO, these protocols rely on the "Serial_Interface_01.lib" and can be used on all devices that have the "Serial_Interface_01.lib" library. "Sercomm.lib" only has to be replaced by "SercomPerspecto.lib" in the library manager. Table : Selection of available libraries Library name Balluff_Bis_01 WagoLib_IPT_FP_01 RFM32_01 GSM_SMS_01 SMS 01 ABB_ASCII2w Inca_01 MODEM_01 NMEA_02 Scanner_01 SEW_LIB_02 WagoLib_ebmBus_01 WagoLib_ebm_MB_01 3964R_RK512_01 Modb_l05 RFID Balluff RFID Pepperl&Fuchs RFID Leuze Send/receive GSM SMS Send land-line SMS ABB transducers Gas analysis Union Modem communication NMEA 0183 National Marine Electronics Association ASCII protocols with start / end character SEW Movilink ebm-papst ventilators with ebmBus ebm-papst ventilators with Modbus Siemens Modbus RTU / ASCII Master/Slave NOTICE When using "Modb_I05.lib", "CRC_extern.lib" also has to replace the "Modcom.lib" library. Use the application instructions and documentation for the respective libraries and only replace the libraries specified above in the respective examples. Application noteA762100d 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