Understanding Modbus Serial and TCP IP

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video will go over the basic characteristics of the Modbus protocol with special emphasis for rockwell automation users will be covering some of the broad differences between Modbus over serial and over ethernet we'll also discuss the different wiring standards for serial communications next we'll cover the dynamics of Modbus as a master and slave network / serial and as a client and server over ethernet we'll delve into Modbus data addressing and the associated function codes and breakdown coils bits bytes and registers we'll also talk about float and double integer values in how they're handled by Modbus first a brief history lesson Modbus is a serial communications protocol developed by modicon in 1979 it was created specifically for use in modicon plcs for industrial applications today it's an open protocol used by a wide range of automation products Modbus can be used over Ethernet as well as serial cable there are three major types or variations of the Modbus protocol Modbus ASCII Modbus RTU and Modbus tcp/ip Modbus was originally developed using ASCII characters to encode messages and this version of the protocol is still in use today Modbus RTU is by far the most common implementation using binary coding and crc error checking the two modes are incompatible so a device configured for ASCII mode cannot communicate with one using rtu Modbus RTU devices typically use one of three electrical interfaces rs-232 rs-485 and rs422 rs-232 is a simple point-to-point arrangement if you only need to connect one device to another and the distance between the two devices is less than 50 feed or 15 meters then rs-232 will do the job to connect more than two devices on the same line and or have a distance of greater than 50 feet you should use rs-485 or rs422 for a master communicating with multiple slave devices rs485 is by far the most popular method this standard can support up to 32 nodes over a range of up to 4,000 feet roughly 1200 meters without a repeater the speed that Modbus messages are sent at is referred to as the baud rate or bits per second all devices on an RTO network must use the same baud rate different devices support different transmission speeds but between 9600 and 19,200 bits per second is a typical range Modbus modules can be configured from as low as 300 to as high as over a hundred thousand a Modbus serial network has a master device that issues commands to the slave devices the slaves will not transmit information unless they receive a command to do so from the master there can only be one master on a network and a maximum of 247 slaves each with a unique slave ID from one to two hundred and forty-seven rs45 cannot drive more than thirty two nodes in a single segment so for the rare application that needs more than thirty two nodes a repeater is required the master can write data to the slaves as well as read data from them SCADA and HMI systems typically would be the master communicating with a series of Modbus slave devices here is a diagram of a serial network where the master is connected to a slave which is then daisy chained along to all the other slaves on the line the devices must be connected in a daisy chain manner they cannot be connected in a star topology Modbus over Ethernet operates exactly like it sounds modbus devices using regular Ethernet cables and switches to communicate with each other the big difference with Modbus tcp/ip is that an ambassador or Modbus application header is added to the start of each message the slave ID at the beginning of the message is removed as well as the cyclic redundancy check at the end the Ambassador contains all the identifying information needed to route the data to the address device Modbus uses port 502 for TCP IP communication this is important if your data needs to go through a firewall prosoft uses that port for em back messaging specifically Modbus serial messages can also be sent as regular RTO messages encapsulated inside an ethernet TCP IP packet encapsulated messages can use any port but prosoft products are set to use port 2000 by default note that the EM bap and rtu encapsulation are not compatible devices must be set to use one or the other and that messaging is by far the most popular Modbus tcp/ip communication method so for this video we'll be focusing on Modbus RTU and Modbus tcp/ip using em back Modbus tcp/ip uses the terms client and server instead of master and slave the tcp/ip network consists of the client connected to a switch or a series of switches to which all the servers on the network are also connected Modbus tcp/ip devices use Internet Protocol addressing and require a subnet mask the IP address and subnet mask are both represented by 48 bit numerical groups or architects the IP address is the location of a particular device on a network and the subnet mask serves to simplify the task of routing traffic within the network if you don't know your IP addressing your IT group or network administrator will you know the IP addresses and subnet mask your devices will need the default gateway is optional and not required for networks that do not use a default gateway again you can consult your IT group or network administrator now let's talk about mod buses eccentric addressing system and the different data tables there are four tables where information is stored two tables store simple discrete values called coils and to store numerical 16-bit values known as registers for each type of data there is one read-only table and one rewrite table there are no tables for 32-bit data types because back when Modbus was defined double integers and floating-point values were not available in PLC's there is a way to use those data types though and we'll get to that in a moment each table has a maximum of 9999 addresses data table addresses one through 9999 are the read/write Table four coils addresses 10,000 1 through 19 thousand nine hundred ninety-nine are the read-only for discrete inputs data table addresses 30,000 one through 30 9999 are the read-only for input registers and addresses 40,000 1 through 40 9999 are the readwrite table for holding registers at this point it might be helpful to explain the terms used for data types in Modbus coils and discrete inputs are the Modbus vernacular for one bit of data or in Rockwell's terms of bull basically on or off a register is the term for one word or 16 bits or two bytes of data or in Rockwell's terms an int there are no registers for floats or double integers although they can be sent by dividing them into two registers float values are any real number with a small point that is represented by a 32-bit register double integers or dents are simply to 16-bit values stacked together also represented by 32 bits this presents a small problem since Modbus does not have a float Ord int data type the solution obviously enough is that the 32-bit value is broken into two separate 16-bit registers and then recombined into a 32-bit real value this is accomplished by copying the two 16-bit registers to one real tag in the Rockwell processor Modbus function codes are simple numerical codes that tell the slave which table to access and whether to read or write to that table each function code relates to a specific data table address range for instance function code one is the code to read and individual bit status function code 16 is the code to write multiple holding registers here are some of the most commonly used function codes Modbus as a protocol does not define exactly how the data should be stored in registers different vendors have different ways of storing and transmitting data some devices will transmit the higher bite first followed by the lower bite others will do it the other way around by the same token when registers are combined to represent 32-bit real values some devices will transmit the higher 16 bits in the first register and the lower 16 bits in the second register other vendors do it the other way around the order that bytes or words are sent in doesn't matter as long as the receiving device knows which way they are ordered if the data is not appearing correctly because the byte or word order is incorrect prosoft products feature a bite and word swap function which will reverse the order in which the data is stored and sent resolving the issue instantly to wrap up we'll take a look at a Modbus RTU message being sent from our faster out to a slave device the message contains the slave ID of the device the command is intended for the function code to read or write data and the message data itself once the slave receives the command it will return the requested data to the master in the case of a read command or it will write the data to its own database and send an echo of the original message back to the master to confirm that the message was received we hope this video gives you a better understanding of Modbus cereal and tcp/ip for additional training videos using Modbus and other protocols in rockwell automation systems visit our website at WWF technology com happy training you
Info
Channel: VUI HOC
Views: 111,247
Rating: undefined out of 5
Keywords: Understanding Modbus Serial and TCP IP, Modbus Serial and TCP IP, Modbus Serial
Id: xjgznfsHpzk
Channel Id: undefined
Length: 12min 6sec (726 seconds)
Published: Thu Sep 01 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.