CP1L-EL/EM Modbus TCP Client Socket Services CP1L-EL/EM Modbus TCP Client Socket ServicesThe CP1L-EL/EM-type CPU units are programmable controllers with built-in Ethernet ports enabling low-cost Ethernet connection and designed to meet a wide variety of Ethernet connectivity needs in a wide range of fields. This article explains how to setup a Modbus TCP communication using Function Blocks. Functional DetailsFor detailed information see CP1L-EM/EL CPU Unit Manual (W516-E1). 1. EthernetSocket ServicesThe socket services allows the CP1L-E* to send and receive data using either the UDP or TCP protocol. The CP1L-E* provides 2. ConfigurationAuto-IP- MAC ID based identification of a new controller in CX-P and will find all of the CP1L-EL/EM PLCs physically connected within the same network with minimal IP configuration. Displays MAC ID and IP address for further configuration. LNK/ACT- Valid Ethernet link and activity indicator 3. ProgrammingThe CP1L-E* requires CX-Programmer Ver. 9.40 or higher (CX-One V4.25). Independent FB CapacityCP1L-EL/EM series PLCs have an extra 10K steps FB capacity on top of normal program memory. Send/Receive Data AddressThe following specifications can be used. Note: EM types 32 Kwords: D0 to D32767 Function Block Memory AllocationThe restrictions for the Send / receive Data Address is the H Area above 511. TCP Status TransitionsNOTE: When closing a socket the socket cannot be used for 120 seconds. This is because the timeout (2MSL) is started while changing from state TIME WAIT to CLOSED. Modbus TCPModbus TCP/IP or Modbus TCP — this is a Modbus variant used for communications over TCP/IP networks, connecting over port 502. It does not require a checksum calculation as lower layers already provide checksum protection. Configuration ExampleProgram Flow Example (single or continue)Function blocks can be used for single or continuous communication. In case of single communication the socket is opened, data is send and/or received and then the socket is closed.
Continuous communication typically is used when the connected Modbus device (server) requires to be serviced periodically. Typically the socket is opened once and data is send are received continuously. Socket is only closed in case of communication anomalies. The Open Socket function Block opens a Socket (1 to 3) that is available and outputs the opened Socket number. The Socket Output can be used as Socket Input variable for all of the other Function Blocks. The individual Function Blocks and detailed information can be found in References. Move the Function Block file together with the Function Block documentation file into the Library location. Then the Help is available. ReferencesCP1L-EL/EM: TCP Active Open Socket Function Block CP1L-EL/EM: Fn03 Read Register (Modbus/TCP) Function Block CP1L-EL/EM: Fn04 Read Input Register (Modbus/TCP) Function Block CP1L-EL/EM: Fn05 Force Single Coil (Modbus/TCP) Function Block CP1L-EL/EM: Fn06 Write Register (Modbus/TCP) Function Block CP1L-EL/EM: Close Socket Function Block Link: |
Comments | ||
|