SLAC asyn class, Day 1, August 26, 2010 Example asyn driver Modbus Mark Rivers, Marty Kraimer, Eric Norum University of Chicago Advanced Photon Source.

Slides:



Advertisements
Similar presentations
Categories of I/O Devices
Advertisements

INPUT-OUTPUT ORGANIZATION
Supervisory Control & Data Acquisition Communication Technology Modbus Protocol.
Interfacing. This Week In DIG II  Basic communications terminology  Communications protocols  Microprocessor interfacing: I/O addressing  Port and.
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
Socket Programming.
Basic Input/Output Operations
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
Input/Output and Communication
Slide 1 / 20 Industrial Automation - Custumer View - Services PhW - Modbus_en 06/ 2002 Modbus training.
Copyright 2003 CCNA 1 Chapter 7 TCP/IP Protocol Suite and IP Addressing By Your Name.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
INPUT-OUTPUT ORGANIZATION
Module I Overview of Computer Architecture and Organization.
TM SM Maximum Value for OEMs SM From Rockwell Automation Using Modbus Protocol with OEMax Products Feb 26 ~ Mar 2, 2007 K.J Kim RAK OBB Strategic Marketing.
Computer Architecture Lecture 08 Fasih ur Rehman.
Layering and the TCP/IP protocol Suite  The TCP/IP Protocol only contains 5 Layers in its networking Model  The Layers Are 1.Physical -> 1 in OSI 2.Network.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
NetworkProtocols. Objectives Identify characteristics of TCP/IP, IPX/SPX, NetBIOS, and AppleTalk Understand position of network protocols in OSI Model.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Chapter 7 Low-Level Protocols
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Chapter 2: Computer-System Structures
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 2.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
RGEC MEERUT(IWT CS703) 1 Java Networking RGEC Meerut.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
Chapter 15 – Part 2 Networks The Internal Operating System The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
X-WindowsP.K.K.Thambi The X Window System Module 5.
Section 6 - Slide 1 / 27 P&T - GPS - Training PhW - 06_TECH_Modbus_en 06/ 2004 Modbus training Part 1 :Reference documents - WEB sites Part 2 :Definitions.
CCNA 1 v3.0 Module 9 TCP/IP Protocol Suite and IP Addressing
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
12/8/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
1 1999/Ph 514: Flow of Control EPICS Flow of Control Marty Kraimer APS.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Programmable Logic Controllers LO1: Understand the design and operational characteristics of a PLC system.
Motor drivers for asyn motor device support Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
1 EPICS Flow of Control: EPICS Workshop at IHEP, Beijing, August 2001 EPICS Flow of Control Marty Kraimer APS.
Multimedia Retrieval Architecture Electrical Communication Engineering, Indian Institute of Science, Bangalore – , India Multimedia Retrieval Architecture.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
TCP/IP Protocol Suite and IP Addressing Presented By : Dupien AMS.
LonWorks Introduction Hwayoung Chae.
1 Network Communications A Brief Introduction. 2 Network Communications.
Computer Organization and Design
Do-more Technical Training
Last Class: Introduction
Do-more Technical Training
Chapter 2: Computer-System Structures
Input/Output and Communication
DT80 range Modbus capability
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
CS703 - Advanced Operating Systems
Net 431 D: ADVANCED COMPUTER NETWORKS
Module 2: Computer-System Structures
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
Module 2: Computer-System Structures
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

SLAC asyn class, Day 1, August 26, 2010 Example asyn driver Modbus Mark Rivers, Marty Kraimer, Eric Norum University of Chicago Advanced Photon Source

SLAC asyn class, Day 1, August 26, 2010 Modbus MODBUS is an application layer messaging protocol –Positioned at level 7 of the OSI model –Provides client/server communication between devices connected on different types of buses or networks –Typically used for communication with I/O systems, including Programmable Logic Controllers (PLCs) Supports following communication links: –TCPTCP/IP using standard port 502. –Serial RTU protocol, using RS-232, RS-422, or RS-485. Directly transmits each byte as 8 data bits, so uses "binary" rather than ASCII encoding. Start and end of message frames is detected by timing rather than by specific characters. –Serial ASCII protocol, using RS-232, RS-422, or RS-485. Encodes each byte as 2 ASCII characters. Start and end of message frames is detected by specific characters (":" to start a message and CR/LF to end a message). Less efficient than RTU, but may be more reliable in some environments.

SLAC asyn class, Day 1, August 26, 2010 Modbus Data types –Single bits –16-bit registers Modbus communications –Request message sent from the Modbus client to the Modbus server. –Server replies with a response message. Modbus request messages contain: –An 8-bit Modbus function code that describes the type of data transfer to be performed. –A 16-bit Modbus address that describes the location in the server to read or write data from. –For write operations, the data to be transferred.

SLAC asyn class, Day 1, August 26, 2010 Modbus Modbus Function Codes AccessFunction descriptionFunction code Bit accessRead Coils1 Bit accessRead Discrete Inputs2 Bit accessWrite Single Coil5 Bit accessWrite Multiple Coils15 16-bit word accessRead Input Registers4 16-bit word accessRead Holding Registers3 16-bit word accessWrite Single Register6 16-bit word accessWrite Multiple Registers16

SLAC asyn class, Day 1, August 26, 2010 Other PLC manufacturers will use different Modbus addresses. Modbus Addresses for Koyo DL05/06/240/250/260/430/440/450 PLCs PLC Memory Type Modbus start address Decimal (octal) Function codes Discrete inputs and coils Inputs (X)2048 (04000)2 Special Relays (SP)3072 (06000)2 Outputs (Y)2048 (04000)1, 5, 15 Control Relays (C)3072 (06000)1, 5, 15 Timer Contacts (T)6144 (014000)1, 5, 15 Counter Contacts (CT)6400 (014400)1, 5, 15 Stage Status Bits (S)6144 (012000)1, 5, 15 Other PLC manufacturers will use different Modbus addresses.

SLAC asyn class, Day 1, August 26, 2010 Other PLC manufacturers will use different Modbus addresses. Modbus Addresses for Koyo DL05/06/240/250/260/430/440/450 PLCs PLC Memory Type Modbus start address Decimal (octal) Function codes Input registers and holding registers (V memory) Timer Current Values (TA)0 (00)4 Counter Current Values (CTA)512 (01000)4 Global Inputs (VGX)16384 (040000)4 Global Outputs (VGY)16512 (040200)3, 6, 16 Inputs (VX)16640 (040400)4 Outputs (VY)16704 (040500)3, 6, 16 Control Relays (VC)16768 (040600)3, 6, 16 Stage Status Bits (VS)16896 (041000)3, 6, 16 Timer Contacts (VT)16960 (041100)3, 6, 16 Counter Contacts (VCT)16992 (041140)3, 6, 16 Special Relays (VSP)17024 (041200)4 Other PLC manufacturers will use different Modbus addresses.

SLAC asyn class, Day 1, August 26, 2010 Modbus asyn Driver Architecture 1.EPICS asyn device support –General purpose device support provided with asyn –No special device support needed or provided with modbus. 2.EPICS asyn port driver that functions as a Modbus client. –Communicates with EPICS device support (layer 1) using the standard asyn interfaces (asynUInt32Digital, asynInt32, etc.). –Sends and receives device-independent Modbus frames via the standard asynOctet interface to the "interpose interface" (layer 3). –These frames are independent of the underlying communications protocol –One asyn driver handles a single function code and contiguous Modbus address range 3.asyn "interpose interface" layer –Handles the additional data required by the underlying communications layer (TCP, RTU, ASCII). –Communicates via the standard asynOctet interface to both the overlying Modbus driver (layer 2) and to the underlying asyn hardware port driver (layer 4). 4.asyn port driver –handles the low-level communication (TCP/IP or serial). –One of the standard port drivers provided with asyn, i.e. drvAsynIPPort or drvAsynSerialPort, not part of modbus package

SLAC asyn class, Day 1, August 26, 2010 Modbus Read Function Codes For read function codes the driver spawns a poller thread. Poller thread reads the entire block of Modbus memory assigned to this port in a single Modbus transaction. Values stored in a buffer in the driver. Delay between polls is set when the port driver is created, and can be changed later at run-time. Values are read by EPICS using the standard asyn interfaces (asynUInt32Digital, asynInt32, etc.) Values that are read are the last stored values from the poller thread. –EPICS read operations are thus synchronous, i.e. they do not block because no Modbus I/O is required. For read functions it is possible to set the EPICS records to "I/O Intr" scanning. –Improves efficiency, because such records only process when needed, they do not need to be periodically scanned.

SLAC asyn class, Day 1, August 26, 2010 Modbus Write Function Codes For write function codes the driver does not itself create a separate thread. Driver does the Modbus I/O immediately in response to the write operations on the standard asyn interfaces. –This means that EPICS write operations are asynchronous, i.e. they do block because Modbus I/O is required. –When the modbus driver is created it tells asynManager that it can block, and asynManager creates a separate thread that executes the write operations. Word write operations using the asynUInt32Digital interface (with a mask parameter that is not 0x0 or 0xFFFF) are done using read/modify/write operations. –Allows multiple Modbus clients to write and read single words in the same block of Modbus memory. –However, it does not guarantee correct operation if multiple Modbus clients (or the PLC itself) can modify bits within a single word. –This is because the Modbus server cannot perform the read/modify/write I/O as an atomic operation at the level of the Modbus client. For write operations it is possible to specify that a single read operation should be done when the port driver is created. –This is normally used so that EPICS obtains the current value of an output device when the IOC is

SLAC asyn class, Day 1, August 26, 2010 Modbus Write Function Codes For write function codes the driver does not itself create a separate thread. Driver does the Modbus I/O immediately in response to the write operations on the standard asyn interfaces. –This means that EPICS write operations are asynchronous, i.e. they do block because Modbus I/O is required. –When the modbus driver is created it tells asynManager that it can block, and asynManager creates a separate thread that executes the write operations. Word write operations using the asynUInt32Digital interface (with a mask parameter that is not 0x0 or 0xFFFF) are done using read/modify/write operations. –Allows multiple Modbus clients to write and read single words in the same block of Modbus memory. –However, it does not guarantee correct operation if multiple Modbus clients (or the PLC itself) can modify bits within a single word. –This is because the Modbus server cannot perform the read/modify/write I/O as an atomic operation at the level of the Modbus client. For write operations it is possible to specify that a single read operation should be done when the port driver is created. –This is normally used so that EPICS obtains the current value of an output device when the IOC is