PROGRAMMABLE CONTROLLERS Jerzy Kasprzyk Lecture: Communication in PLC 1. Introduction CPU PADT (Programming And Debugging Tool), RS232 (RS 485) protocols (SNP, Modbus, etc.), Ethernet; LAN (Local Area Network) - communication modules; Field Network (Fieldbus) - communication modules (distributed control systems); GSM (Global System for Mobile Communication) GSM modules or other devices (GSM modems) connected with CPU using standard RS, data exchange via SMS (Short Message Service).
2. Local Area Networks Network topology: Star Ring Bus In industrial LANs or in field buses digital data are transmitted mainly via: twisted cables, concentric cables, light pipes. Basic access methods to a link: physical allocation, e.g. in Master-Slave communication; controlled access, e.g. based on the token-passing; random access, e.g. CSMA/CD in Ethernet.
3. Communication Protocols Data transfer involves some rules that should be settled for: electrical, mechanical and functional characteristics of a link; ways to control data transfer from a transmitter to receiver. Standardization organizations: ISO (International Standards Organisation), EIA (Electronic Industries Association), CCITT (Consultive Committee on International Telephone and Telegraph) and others have proposed different multilayer communication protocols: in each layer different functions and protocol characteristics are defined; each layer is independent from each other, but for proper functioning of the layer, the lower layers have to work correctly. Different protocols are based mostly on the OSI (Open System Interconnection) standard proposed by ISO, which represents the 7 layers hierarchy: application layer access to communication services from the application, identification and safety of data; presentation layer syntactics for coding, formatting and transforming the data; session layer settling and interrupting of connections, synchronization, data flow control and buffering; transport layer specification of links between terminals, point-to-point maintenance; network layer transparent data exchange between nodes, services for addresses, paths etc.; data link layer access to the medium, error detection and servicing; physical layer transfer of bit sequences via medium, definitions of electrical and mechanical interface. MAP (Manufacturing Automation Protocol) based on OSI and designed in General Motors plays a particular role in the history of distributed control systems.
4. Industrial Networks Basic requirements: work in the real-time (time to transmit data from one node to another is determined); immunity to disturbances typical in industrial environment. Master-Slave protocols (e.g. MODBUS) Two types of data transmission: Query-Response; Broadcast. Uniform data frame format and standard set of functions. Token-passing protocols (e.g. GENIUS) This protocol is dedicated for communication between many nodes (peer-to-peer) and guarantees reliability at high speed. The main features: distributed architecture (there is no central node); it can be easy extended; frame dimension is limited; time is guaranteed, network can work even if one of the nodes is broken down. Two types of frames: service frames (token); data frames. Token is transferred between nodes and only the owner of the token can send the frame, that is available for all others nodes. Data are transmitted with a constant sweep depending on transfer speed, the number of nodes and the number of transferred bytes.
To transfer the token correctly, one should set in each station: number in the network (unique), number of the last station. It can be declared in a software or hardware way. Examples of Token-passing networks: Genius of GE Fanuc, Sycoway N10 of CEGELEC. The PROFIBUS protocol uses the Token-passing method for the access to a link between Master stations, and Master-Slave method for communication between the Master and simple slave devices. In the Modbus Plus network, the Modbus protocol is used to transfer data between two stations, however Token-passing is used to control the access to the network. In the Industrial Ethernet: Modbus over TCP/IP.
5. Modbus Protocol Query response cycle: Frame in the ASCII mode each byte is coded as two ASCII characters (0..9, A..F): Each character contains 10 bits: Advantage: consecutive characters can be sent with arbitrary time intervals between them.
In RTU (Remote Terminal Unit) transmission starts after silence that last time needed to transmit at least 3.5 characters. Frame in RTU mode: Information unit contains 11 bits: Advantage: greater capacity flow in the network. Typical function codes: 01 Read Coil Status; 02 Read Input Status; 03 Read Holding Registers; 04 Read Input Registers; 05 Force Single Coil; 06 Preset Single Register; 13 Program Controller; 14 Poll Controller; 15 Force Multiple Coils; 16 Preset Multiple Registers; etc.
Data addressing: coil 0001 in data is presented as 16#0000 address, coil 0127 as 16#007E (126 decimal); register 40001 is presented as 16#0000 address, while 40108 as 16#006B (107 decimal) An example of the query in the ASCII/RTU modes: An example of the answer in the ASCII/RTU modes: FFB in Concept: XXMIT or RTXMIT from the COMM library
6. Modbus Plus Network Basic elements: Token-passing in the network: In Concept the group MBP from the COMM library: CREADREG (Continuous Register Reading) CWRITREG (Continuous Register Writing) MBP_MSTR (Modbus Plus Master) READREG (Read Register) WRITEREG (Write Register)