Hi, my name is John Rinaldi here. I am at the video operations center that we built just to do these videos at Real Time Automation
here in Brookfield, Wisconsin which for those of you who are
Geographically challenged, is right on the big lake, Lake Michigan the biggest freshwater Lake in the entire world.
So we're talking about Modbus today
Modbus rTU
specifically
Before we get into that let me talk [about] a little background thing. That's a lot of people who call me are confused about
And what that is is?
Modbus is a serial communications protocol. What does serial means? It means bit by bit. There's serial
RS-485 and
There's serial RS-232
Now what's the difference between 485 [and] 232? 232
Uses 3 wires at transmit. There's a transmit wire, receive wire, and a comm wire
Tx/Rx and common, and then the teen on the other side you have an [rx] [@] [Tx] and a common so so
This device transmitted on the Tx line
This device transmits on this Tx line over to the Rx on the other side so you can have you can actually have full duplex
Communications and sending bits of both directions at the same time because of that this is point-to-point. You've got one device here one device there
And I lost my my eraser here we go
now
RS-485 is
differential
You just have two wires with RS-485 and it put the difference in in the potentials between the wires indicates
What the bits are so when Data is going this guy can send data in that direction by putting the potential between those two wires?
This guy sends it sends a a message going back the other way by putting in a potential 'no stewed wires
So the line has to be turned around from the center of the receiver when the receiver wants to resend a reply
so
That's the back row that was 45 so my bizarre to you is an RS-485 protocol a lot of people ask me can I do
Can I do my bus [rtU] and RS-232? Well? Yeah, you can if you just have two nodes, then you're fine now
Modbus rTU what does the rt? You mean RtO means remote terminal unit does that mean anything to us?
well, not really it just distinguishes it between
The TCP version of - same [packets] same data same everything
Only this goes in an ethernet packet this just goes out of serial bits on
RS-485 so first thing to talk about is number one why?
Modbus rtU well my bus [arts] [yous] been around since like Columbus came to America. I think Columbus added on the Santa Maria
the
Why is it? Why is it around? So why is it and it's been in it's in everything
There's probably hundreds and hundreds of thousands of nodes that have modbus
And by the [Busbar] to you
Specifically because all you need is a serial port and in an RS-485 driver to make your device a modbus rTU device
so it's been used in everything, and it's a very simple packet as I'll show you in a minute so a
Lot of people have implemented
So that's why it's important to you is because if you implement modbus rTU then you can also talk to this to this wide
variety of Devices that speak Modbus rTU
That's the first thing number two is
That we have to remember it's serial 485 so when we're talking about [rTU]
That always means serial 45 which I just explained is a differential line
And it's multi dropped with serial Modbus rTU you've got one master
And you've got a whole bunch of slaves
slave slave slave slave slave the Master puts out a message the slave that it's directed to receives that message and
Responds and then the master talks to a difference light so it says continuous
Messaging from the master out to the slaves with the slaves responding a slave that doesn't get talked to have to shut up
It can't say anything because there's only two lines here and only one device can talk at a time
[that's] why you can't have multiple masters another question many people ask we have multiple Masters. No never
In my bus TCP account not here
So that's another thing [you] [have] to be third thing that we want to know about vaughn Bus
Data
representation
Data Rap
How is Data represented in Modbus two ways either? It's registers and coils
What are we talking about data representation anyway whenever you have any kind of network device?
Everybody wants to know is how do I talk to [that] device? How does that how does the data?
How do I access the data in that device whether it be some kind of I/o lines?
Whether it can be some kind of analog single analog value like a temperature
whether it's going to be something like is the status of a valve well in Modbus things are represented in two ways by
16-bit unsigned
registers and by single bit coils and
So every device has some set of registers and some set of [coils] could have both could [have] one could have the other
Doesn't matter it's up to the designer the device to just pick the [other] thing that they pick is
So the other thing that they pick is the data space which which leads us to the next
Very important point on my buses
How is Data organized in that well?
They figure out the they allocate some sort of memory inside the device when you're designing a modbus rTU device
That this is going to be my register area
This is going to be my coil area and I want to start this [at] Say 300
[I'm] going to have a hundred registers
So this is going to be 399 so it's up to the designer to say that I'm going to have this register space
I'm going to have a hundred unsigned registers now. There's two kinds of registers
There's actually input registers which come back from the old days when when this was for PLc's
And you had io coming [into] a pLc
and so these were actually like analog inputs and you have [holy] registers were they're nothing more [than]
[the] internal internal registers same thing with coils. We've got status coils
Which just say hey?
What's the [smuts] to value what you know what's the current state of this coil or you've got input coils input coils are are
Actually, [it's] almost like field and can be field inputs
But people are free nowadays because we don't not tied to i/o all the time to use these in [anywhere], they want, so
[also] [for] registers and coils you can define the coils. You've got actually
64 K of space that you can allocate for input registers holding registers input coil status coils
Whatever you want, so you've got a lot [of] space
But most people just take a small
Segment of it because they've got very [small] amounts of data and say I want to I want to use 10 registers
I'm going to start it at this at this point inspect at this point and end at this point now
That's that that's real simple, but it's also the biggest downfall of Modbus
Downfall because every device is different this designer picked this representation
Another designer doing the same kind of thing will pick a totally different representation
He'll use 50 thousand as the address for 10 registers this guy used 300 for the address of 100 register
so nothing matches meaning if you've got a switch from one my bus device to the [nekkid] next you got a
reprogram your system
Okay
now let's take a look at
What's the packet look like?
packets very simple you just generally have an id for the device you haven't you have some kind of function code an address and
a date and data
So the pack is really simple. This is just says here's the the address of the slave on the on the network
Here's the code of what I want to do what can you do basically four things you can read a register write a register
Read a coil write, Okoye
And here's the [address] of where of the data register that I want to use and if I'm doing it, right
Here's the data then there's a CRc out here cyclic redundancy check that thing gives you about nine
Ninety-nine point nine nine six percent accuracy if you do a Crc write a lot of people in they're implementing - they do that wrong
They start with the wrong seed
So this is another reason that modbus is [u] is used in so many devices because you just create this packet you
Send it up. You've got a master
If you can if you receive the fact if you can see this packet from the frog master you can interpret it correctly
[send] a response back in the right format. You've implemented my pose. We've got my best acts
If you don't want to go through that that are guaranteed to work, and it might [be] a better way for you to go
now if you need more information on
Modbus rTU my bus TCp or any of us you can call our offices here [at] real-Time automation
We'll be glad to help you
We've got lots of device converters that convert by bus [R2] you to things like Ethernet/ip device
That profibus all sorts of stuff. We've got we've got source code stats that run on any kind of processor in any kind of
operating system
So we've got everything [that] [you] need to do my bus to be glad to work with you
My name is John Rinaldi, and it's been a pleasure talking to you today