Implementing MOD bus and CAN bus Protocol Conversion Interface



Similar documents
Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

Process Control and Automation using Modbus Protocol

Modbus Protocol. PDF format version of the MODBUS Protocol. The original was found at:

Microcomputer Protocol Implementation at Local Interconnect Network Georgi Krastev

Bus Data Acquisition and Remote Monitoring System Using Gsm & Can

Serial Communications

DeviceNet Communication Manual

Welcome to the Introduction to Controller Area Network web seminar My name is William Stuart, and I am a Applications Engineer for the Automotive

MODBUS over Serial Line. Specification and Implementation Guide V1.02

MODBUS over Serial Line. Specification & Implementation guide V1.0

RS-485 Protocol Manual

LIN (Local Interconnect Network):

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Serial Communications

Software User Guide UG-461

Display Message on Notice Board using GSM

Local Interconnect Network Training. Local Interconnect Network Training. Overview

Design and Implementation of Home Monitoring System Using RF Technology

Industrial Networks & Databases

Using Xbee in Serial Communication

Getting Started with CANopen Version Application Note AN-AON

Tutorial.

Alcalde # 1822 Col. Miraflores C.P Guadalajara, Jal. Mexico MX 01 (33) y USA 001 (619) (San Diego, CA.

ALL-USB-RS422/485. User Manual. USB to Serial Converter RS422/485. ALLNET GmbH Computersysteme Alle Rechte vorbehalten

Wireless monitoring system for temperature and humidity based on ZigBee

CAN Bus Analyzer for Industrial Applications

Secure My-d TM and Mifare TM RFID reader system by using a security access module Erich Englbrecht (info@eonline.de) V0.1draft

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

Single channel data transceiver module WIZ2-434

PCAN-B10011S Bus Converter High-speed CAN to Truck Trailer CAN. User Manual. Document version ( )

Industrial Networks & Databases. Protocols and Networks - Device Bus - - Field Bus -

Microcontrollers in Practice

1.Eastron SDM220Modbus Smart Meter Modbus Protocol Implementation V1.0

Microtronics technologies Mobile:

INDUSTRIAL CONTROL TECHNOLOGY. A Handbook for Engineers and Researchers. Peng Zhang. Beijing Normal University, People's Republic of China

PCAN-MicroMod Universal I/O Module with CAN Interface. User Manual. Document version ( )

Modbus Communications for PanelView Terminals

Tutorial Introduction

Figure 1.Block diagram of inventory management system using Proximity sensors.

In-Vehicle Networking

Measurement and Analysis Introduction of ISO7816 (Smart Card)

The I2C Bus. NXP Semiconductors: UM10204 I2C-bus specification and user manual HAW - Arduino 1

ARM Thumb Microcontrollers. Application Note. Software ISO 7816 I/O Line Implementation. Features. Introduction

RS-422/485 Multiport Serial PCI Card. RS-422/485 Multiport Serial PCI Card Installation Guide

SPI I2C LIN Ethernet. u Today: Wired embedded networks. u Next lecture: CAN bus u Then: wireless embedded network

RDF1. RF Receiver Decoder. Features. Applications. Description. Ordering Information. Part Number Description Packages available

Pmod peripheral modules are powered by the host via the interface s power and ground pins.

Lab Experiment 1: The LPC 2148 Education Board

Design of Wireless Home automation and security system using PIC Microcontroller

LOCAL INTERCONNECT NETWORK (LIN)

Eliminate Risk of Contention and Data Corruption in RS-485 Communications

DCM. Product Brochure. Diagnostic Communication Master

Web Site: Forums: forums.parallax.com Sales: Technical:

ENET-710. ENET Ethernet Module ENET-710 JAN / 06 FOUNDATION

Freescale Semiconductor, Inc. Product Brief Integrated Portable System Processor DragonBall ΤΜ

Modicon Modbus Protocol Reference Guide. PI MBUS 300 Rev. J

Location-Aware and Safer Cards: Enhancing RFID Security and Privacy

M68EVB908QL4 Development Board for Motorola MC68HC908QL4

CAN bus board. EB018

Manual Serial PCI Cards

Intelligent Fleet Management System Using Active RFID

From Fieldbus to toreal Time Ethernet

Bluetooth in Automotive Applications Lars-Berno Fredriksson, KVASER AB

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs)

Lecture N -1- PHYS Microcontrollers

RN-131-PICTAIL & RN-171-PICTAIL Evaluation Boards

APNT#1168 Modbus - Establishing Communications Hints

SafeSPI - Serial Peripheral Interface for Automotive Safety

Serial port interface for microcontroller embedded into integrated power meter

UCC 1 USB-CAN CONVERTER

with Electronic Assistant

Computer Organization & Architecture Lecture #19

Distributed Real-Time Systems (TI-DRTS) Track 2. CAN-BUS Introduction. Version Ref. VECTOR application note & Motorola note

Implementing a Digital Answering Machine with a High-Speed 8-Bit Microcontroller

Chapter 13. PIC Family Microcontroller

White Paper. Technical Capabilities of the DF1 Half-Duplex Protocol

Computer Systems Structure Input/Output

ESP 8266: A BREAKTHROUGH IN WIRELESS SENSOR NETWORKS AND INTERNET OF THINGS

Atmel Norway XMEGA Introduction

Remote PLC system using GSM network with application to home security system

Wireless Security Camera

AN141 SMBUS COMMUNICATION FOR SMALL FORM FACTOR DEVICE FAMILIES. 1. Introduction. 2. Overview of the SMBus Specification. 2.1.

Real-Time Vehicle Data Logging System Using GPS And GSM

Master-Touch and ValuMass. Modbus Communications. INSTRUCTION MANUAL (Rev. 2.1)

International Journal of Research in Advent Technology Available Online at:

Bluetooth to serial HC-06 wireless module

applicomio Profibus-DP

The Answer to the 14 Most Frequently Asked Modbus Questions

Introduction to RACE FUELS Hans-Christian von der Wense Munich, Germany

The Secrets of RS-485 Half-duplex Communication

Embedded Ethernet Interface Using Arm Processor

Wifi Web Server Module w TF Socket User s Guide

Introduction: Implementation of the MVI56-MCM module for modbus communications:

Implementation of Wireless Gateway for Smart Home

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Modbus and ION Technology

USB to serial chip CH340

1-Port R422/485 Serial PCIe Card

Vehicle data acquisition using CAN By Henning Olsson, OptimumG

A DIY Hardware Packet Sniffer

Transcription:

Implementing MOD bus and CAN bus Protocol Conversion Interface Umesh Goyal, Gaurav Khurana M.E., Electronics & Electrical Communications Department, PEC University of Technology, India M.E., Electronics & Electrical Communications Department, PEC University of Technology, India Abstract A number of field buses are available to exchange the serial data among one or more controllers and a number of field devices that are communicating with each other. However, field bus standards are not uniform at present, which brings many difficulties in system design, as different equipments from different manufacturers follow different standards. For a reliable system design there is a need of efficient communication interface to make the communication possible. CAN bus and Modbus are two most common field buses used in industrial control equipments. This paper highlights the basics of these buses and also explain the designing of CAN bus and Modbus protocol conversion interface. A complete hardware and software design detail is also provided in this paper. Index Terms Modbus, CAN bus, CANopen, PIC, Microcontroller I. INTRODUCTION Any Embedded system is generally consisting of one or more micro-processors or micro-controller and a number of peripherals IC s like EEPROM, Real time clock (RTC), watchdog timer and sensors etc. In communication system design, a key challenge is the ability to make different components from different manufactures communicates with each other. Many serial communication protocols like RS- 3/RS-485, IC, SPI, Modbus and CAN bus etc. compete for use in embedded systems. All these protocols have their own advantages and limitations. Generally, different manufactures follow different protocols and standards. This makes the system integration task very difficult. So there must be some means to make this task easier. Protocol conversion interface is one of the possible solutions for this problem. CAN bus and Modbus are two most common fieldbus protocol used in industrial control systems. This paper implement a CAN bus to Modbus protocol conversion interface. Both sides of serial connections are isolated galvanically to provide perfect protection against lightning, surges, high voltage transients. After the brief introduction of each protocol, this paper briefly explain the hardware and software design of CAN bus to Modbus protocol conversion interface. Fig describes the basic overview of the system i.e. how different devices are connected in the system []. A. MOD bus II. PROTOCOL OVERVIEW Modbus is a serial communications protocol published by Modicon in 979. MODBUS Protocol defines a standard message structure with universal recognition and usage regardless of the type of networks over which any two devices communicate. It is a master-slave communication protocol. It describes the process a master uses to request an access to slave, and how the slave will respond to these requests, and how errors will be detected and reported. Master can initiate transactions (called queries ) and slave respond by supplying the requested data to the master, or by taking the action requested in the query. The master can address individual slaves, or can initiate a broadcast message to all slaves. Slaves return a message (called a response ) to queries that are addressed to them individually. Responses are not returned to broadcast queries from the master. Fig describes the Masterslave query response cycle. Fig. System structure Fig. Modbus master-slave query-response cycle ISSN: 3-538 http://www.ijettjournal.org Page 630

Master s query consists of slave device (or broadcast) address, a function code defining the requested action, any data to be sent, and an error checking field. The slave s response contains fields confirming the action taken, any data to be returned, and an error checking field. Table I shows the PDU and ADU of Modbus protocol. Table I Modbus data format Protocol data unit (PDU ) Application Data unit(adu) byte byte Variable bytes Address field Function field Data field Error checking field If the slave makes a normal response, the function code in the response is an echo of the function code in the query. If an error occurred in receipt of the message, or if the slave is unable to perform the requested action, the slave will construct an error message by modifying the function code (set the MSB of function code) to indicate that the response is an error response, and the data bytes contain a code that describes the error. B. CAN bus(controller Area Network) The CAN bus was developed by German automotive system supplier Robert Bosch in mid-980 s for automotive applications in automobile systems. CAN is an International Standardization Organization (ISO) defined serial communications bus originally developed for the automotive industry to replace the complex wiring harness with a twowire bus. The specification calls for high immunity to electrical interference and the ability to self-diagnose and repair data errors. These features have led to can s popularity in a variety of industries including building automation, medical, and manufacturing. The can communications protocol, iso-898, describes how information is passed between devices on a network and conforms to the open systems interconnection (OSI) model that is defined in terms of layers. Actual communication between devices connected by the physical medium is defined by the physical layer of the model [3]. The ISO 898 architecture defines the lowest two layers of the seven layer OSI/ISO model as the data-link layer and physical layer as shown in figure 3. Modbus protocol can be established in two kinds of transmission mode: ASCII mode or RTU mode. In ASCII mode, each 8 bit byte in a message is sent as two ASCII characters. In RTU mode, each 8 bit byte in a message contains two 4 bit hexadecimal characters. The main advantage of RTU mode is that its greater character density allows better data throughput than ASCII for the same baud rate. Modbus protocol has the parity check, besides, the ASCII mode uses the LRC check, and the RTU mode uses 6 CRC check. Table II is a comparison between ASCII mode and RTU mode[]. Table II Comparison of ASCII and RTU mode Mode Beginning Ending Check Transmission efficiency marks marks ASCII : (colon) CR,LF LRC low RTU Non Non CRC High According to Table I, the data transmission rate of ASCII mode is a little lower than RTU mode. So, when need to send large data, user always uses RTU mode. The standard Modbus protocol is to use a RS-3C compatible serial interface, which defines the port pin, cable, digital signal transmission baud rate, parity. Fig. 3 The layered ISO standard 898 architecture The CAN communication protocol is a carrier-sense, multiple-access protocol with collision detection and arbitration on message priority (CSMA/CD+AMP). CSMA means that each node on a bus must wait for a prescribed period of inactivity before attempting to send a message. CD+AMP mean that collisions are resolved through a bit-wise arbitration, based on a pre-programmed priority of each message in the identifier field of a message. The higher priority identifier always wins bus access, that is, the last logic-high in the identifier keeps on transmitting because it is the highest priority as shown in fig 4. For can, the dominant bit is logic 0 and recessive bit is logic. ISSN: 3-538 http://www.ijettjournal.org Page 63

Fig.4 Arbitration on a CAN Bus A CANopen device can be logically structured in three parts. One part provides the CAN interface and another part provides the device's application, which controls e.g. the Input/output (I/O) lines of the device in case of an I/O module. The interface between the application and the CAN-interface is implemented in the object dictionary [4]. The object dictionary is unique for any CANopen device. It is comparable to a parameter list and offers the access to the supported configuration- and process data. To gain access to the object dictionary, each CANopen device has to implement a CANopen protocol stack [5]. This CANopen protocol stack is software, which is usually implemented on the same microcontroller that is used by the device's application software. The internal device structure is shown in fig 5. A. Hardware design Fig. 5 Internal Device Structure III. IMPLEMENTATION Design of this CAN bus to MODBUS protocol conversion interface is done by using PIC3MX-XXX series microcontroller. This series of microcontrollers has 6 UART and CAN modules. These on chip modules are appropriate of the design of protocol conversion interface. This design also included a CAN trans-receiver (ISO-050) and As the MODBUS using the RS-485 serial interface, this design uses RS485 trans-receiver (ISO-3050). The ISO-050 is an isolated CAN transceiver that meets or exceeds the specifications of the ISO-898 standard [6] and ISO-3080 is an isolated full-duplex differential line drivers and receivers. This CAN transceiver provides differential transmit capability to the bus and differential receive capability to a CAN controller at signalling rates up to megabit per second (Mbps). The internal oscillator circuit of PIC3 microcontroller is used to generate the system clock. This system is working on a high frequency of 3 MHz. Block diagram of protocol conversion interface is shown in figure 8. Fig 6 shows the schematic diagram for MOD bus communication using RS 485 and Fig 7 shows the schematic diagram for CAN bus communication. ISSN: 3-538 http://www.ijettjournal.org Page 63

+5V_ISO ISOLATED RS485- +5V R RS485_EN R5 C R3 RS485_RX RS485_TX 7 8 4 5 3 6 U VCC RE DE R D ISO3080 6 VCC 5 9 0 A 4 B 3 Y Z ISO_GND C3 C R7 R0 R3 R R8 GISO_ R4 K ISOLATED SUPPLY ISOLATED GND J A-RX+ B-RX- Y-TX+ Z-TX- R4 K R6 R9 R PD-'B' R RS485 VISO RS485 GISO RS485 A RS485 B RS485 Y RS485 Z Fig. 6 Schematic Diagram for MOD bus Communication GISO_ +5V_ISO CAN- COMMUNICATION R5 C4 C5 C6 +5V 0E CANH CANL CANRX CANTX R7 3 4 U VCC RXD TXD 8 VCC CANH 7 6 CANL 5 C7 C8 C9 R6 J CANH R8 R9 CAN_VISO CAN_GISO CAN_H CAN_L C0 IS0050 R 0E R0 CANL ISO_GND GISO_3 Fig. 7 Schematic Diagram for CAN bus Communication ISSN: 3-538 http://www.ijettjournal.org Page 633

RS485 VISO RS485 GISO RS485 Y RS485 Z RS485 A RS485 B MODBUS RS 485 FOR MODBUS RS485_EN RS485_RX RS485_TX P I C 3 M X M i c r o c o n t r o l l e r CANRX CANTX CAN ISO050 CANBUS CAN_VISO CAN_GISO CAN_H CAN_L Fig. 8 Conversion Interface B. Software design This protocol conversion interface is working on Masterslave technique and only master can initiate the communication. Here CAN bus is chosen as the master and MODBUS as slave i.e. only CAN bus can start the communication and MODBUS devices can respond according to request made by the master. The whole communication is controlled by an event driven interrupt. Whenever CAN master want to communicate with a device connected over the MODBUS then it generate an interrupt. On receiving this interrupt, CPU enters into an interrupt service routine (ISR). In this routine, CPU receive the data from CAN master and checks the integrity of the data using CRC check. If data is found to be valid then program enters into a routine which convert this data into MODBUS format. This format contain slave address, function code, data field and CRC field. Thus this conversion interface encapsulates the data in Modbus protocol format to send to the Modbus site. Now slave device receives the data and responds back with the response data. Conversion interface receives this response data. After receiving message conversion interface analyses data, and then convert to CAN protocol format, send to master. Note that, due to the length of CAN bus data transmission up to 8 bytes, if Modbus protocol transmits data is longer than 8 bytes it will send data many times. C. Flow Chart The flow chart as shown in figure 9 described the working of the system i.e. how the data from one bus is sent to other bus with their data formats changed using PIC3MX microcontroller. Fig. 9 Flow Diagram of Conversion Interface ISSN: 3-538 http://www.ijettjournal.org Page 634

IV. RESULTS By using the hardware and software logic as explained above CAN bus to Modbus protocol conversion interface is implemented and results are shown in figure 0 and. Figure 0 shows the data sent by CAN bus device to the protocol conversion interface and figure shows the data sent by protocol conversion interface to Modbus device. Fig. 0 data from CAN bus to conversion interface Umesh Goyal, born on 8 July 990 at Moga, Punjab, India. He is currently pursuing Masters in Engineering in Electronics field from PEC University of Technology, Chandigarh, India. His Masters in Engineering will be completed by June, 03. He has completed his Bachelors of Technology in Electronics and Communication Engineering from Chitkara Institute of Engineering & Technology, Punjab, India in year-0. The major field of his work is related to Electronic Embedded Systems, Digital Signal Processing, and System Design. Gaurav Khurana, born on 07 September 987 at Ambala Cantt, Haryana, India. He is currently pursuing Masters in Engineering in Electronics field from PEC University of Technology, Chandigarh, India. His Masters in Engineering will be completed by June, 03. He has completed his Bachelors of Technology in Electronics and Communication Engineering from Ambala college of Engineering & Applied research, mithapur, Haryana, India in year-009. The major field of his work is related to Microcontroller and Embedded Systems, Digital Signal Processing and digital communication. Fig. data from conversion interface to Modbus. REFERENCES [] Guohuan Lou, Zhang Hao, Zhao Wei, Research on Designing Method of CAN Bus and Modbus Protocol Conversion Interface. In Proceeding of 009 International Conference on Future Bio- Medical Information Engineering. [] Modbus Application Protocol Specification V.b, Modbus-IDA, December 006, pp. -5, [Online] available at http://www.modbus-ida.org. [3] H. Boterenbrood, Canopen high-level protocol for CAN-bus, NIKHEF, Amsterdam, March 0, 000. [4] Rao Yuntao. Principle and Application of CAN field bus technology. [5] Rauchhaupt L., System and Device Architecture of a Radio Based Fieldbus -The RFieldbus System[C], In Proceeding of the 00 IEEE International Workshop on Factoty Communication Systems, 00,8.pp.93-0 [6] ISO-IS 898 Road vehicles - Interchange of digital information - Controller Area Network (CAN) for high speed communication, 993 ISSN: 3-538 http://www.ijettjournal.org Page 635