What is difference of INPUTS and OUTPUTS in Modbus

Hi,

I have been before asked about Modbus protocol and what is difference of READ & WRITE functions, that is solved.
But still there a vague point in this protocol and it is difference of INPUT & OUTPUT concept.
Regarding INPUTS and OUTPUTS entering and exiting from a RTU or PLC, and different configurations of network, I am not sure a data that is moving between Field devices and RTU/PLC or HMI,could be called INPUT or OUTPUT.

for example : A flow transmitter sending an Analog value to RTU. this value is OUTPUT of Flowmeter but INPUT of RTU. Now if RTU is MASTER and flowmeter is SLAVE, I guess we should use function codes to READ analog outputs, but I am not sure it is correct.
regarding all function codes (including READ/WRITE) are working on Modbus Slave memory, would you please help me if we use READ INPUT functions, which value is read by this function?
Can we consider INPUT, the same data that is coming from field device to RTU's INPUT and read by another Master device?

I have been attached a diagram that show data flow in Modbus network, but I am not sure it is correct understanding INPUT and OUTPUT concept in Modbus.
I would be thankful if someone help me in this case.

Thanks
 

Attachments

I believe you're thinking about it on too wide of a scope. Don't think about it from a communication perspective or from your whole system (i.e. one device sending values to another device, etc.). The Modbus slave alone defines whether specific data is INPUT data or OUTPUT data. INPUT data is read-only, while OUTPUT data is read/write on a Modbus slave.

Taking your example, focus on the flow transmitter and its data only. It doesn't matter whether it's a Modbus flow transmitter or a non-communicating flow transmitter for the purpose of determining INPUTS and OUTPUTS. A flow transmitter has a sensor for flow that is connected to (or integrated into) it. This flow data is an INPUT to the flow transmitter. Now the flow transmitter may also have relay contact(s) for alarms, flow limit, etc. for indication to external devices. These relay contacts are OUTPUTS of the flow transmitter. Therefore, if this flow transmitter were a Modbus flow transmitter, it would expose the flow sensor as an INPUT (for example, an Input Register), while exposing the relays as OUTPUTS (for example, Coils, that can be controlled and overriden via Modbus).

At the risk of adding to your confusion, it is important to keep in mind that in Modbus, although Holding Registers are read/write and must be used for OUTPUTS, it is also quite common for Modbus slave vendors to use Holding Registers for INPUTS as well (for simplicity of exposing only a single register type and supporting only a single read function code). Holding Registers used for INPUTS may reject writes by responding with an exception response or may accept the write command, but not actually change the value associated with the register, as it is read-only.
 
I appreciate your help.

I will delete INPUT & OUTPUT terminology from it. After spending a lots of time and asking many questions, I found INPUT and OUTPUT terms are not really input and output in real world. they are just names for memory area in Modbus.
Slave could have DIGITAL or ANALOG values in its memory.

Would you please confirm if I got your explanation correctly:
  • If master needs to READ DIGITAL value: Depending on which FC is used (FC01,FC02) ,MASTER will read data stored in 0xxxxx,1xxxxx.
  • If master needs to READ ANALOG value: Depending on which FC is used (FC03,FC04) ,MASTER will read data stored in 4xxxxx,3xxxxx.
  • If master needs to WRITE a DIGITAL value in SLAVE: It ONLY can be written in 0xxxx by using FC05,FC15 (FC 05 to write a single-bit, FC15 to write multiple bits).
  • If master needs to WRITE a ANALOG value in SLAVE: It ONLY can be written in 4xxxx by using FC06,FC16 (FC 06 to write a single-value, FC16 to write multiple values).
  • While READ there is no difference between 0xxxx or 1xxxx, the difference is when we want to WRITE to these memories, only can write 0xxxxxx.
  • While READ there is no difference between 3xxxx or 4xxxx, the difference is when we want to WRITE to these memories, only can write 4xxxxxx.
  • For SLAVES that only have DIGITAL STATUES, we can't use FC03 or FC04 (4xxx,3xxxx memory), and similarly in SLAVES that have ANALOG values we can't use we can't use FC01 or FC02 (0xxx,1xxxx memory) .
  • I think between different FCs, FC01 and FC03 will be more used than others as related memories could be written too.
QUESTIONS:
  • We need to READ a DIGITAL VALUE in SLAVE ,how can we know it is in 0xxxx or 1xxxxx and where is its address?
  • The same question is for ANALOG values. how can we know it is in 3xxxx or 4xxxxx and where is its address?

Thanks
 
After spending a lots of time and asking many questions, I found INPUT and OUTPUT terms are not really input and output in real world. they are just names for memory area in Modbus.
This statement is not true. I just provided you with an example in my previous post of real-world INPUTS (a flow sensor) and OUTPUTS (relay contacts) connected to a flow meter and how those would map to Input Registers (INPUTS) and Coils (OUTPUTS) on Modbus.

Would you please confirm if I got your explanation correctly:
  • If master needs to READ DIGITAL value: Depending on which FC is used (FC01,FC02) ,MASTER will read data stored in 0xxxxx,1xxxxx.
  • If master needs to READ ANALOG value: Depending on which FC is used (FC03,FC04) ,MASTER will read data stored in 4xxxxx,3xxxxx.
  • If master needs to WRITE a DIGITAL value in SLAVE: It ONLY can be written in 0xxxx by using FC05,FC15 (FC 05 to write a single-bit, FC15 to write multiple bits).
  • If master needs to WRITE a ANALOG value in SLAVE: It ONLY can be written in 4xxxx by using FC06,FC16 (FC 06 to write a single-value, FC16 to write multiple values).
  • While READ there is no difference between 0xxxx or 1xxxx, the difference is when we want to WRITE to these memories, only can write 0xxxxxx.
  • While READ there is no difference between 3xxxx or 4xxxx, the difference is when we want to WRITE to these memories, only can write 4xxxxxx.
  • For SLAVES that only have DIGITAL STATUES, we can't use FC03 or FC04 (4xxx,3xxxx memory), and similarly in SLAVES that have ANALOG values we can't use we can't use FC01 or FC02 (0xxx,1xxxx memory) .
  • I think between different FCs, FC01 and FC03 will be more used than others as related memories could be written too.
I did not provide you with any of this information, so this is not from my explanation. However, these statements are all correct.

QUESTIONS:
  • We need to READ a DIGITAL VALUE in SLAVE ,how can we know it is in 0xxxx or 1xxxxx and where is its address?
  • The same question is for ANALOG values. how can we know it is in 3xxxx or 4xxxxx and where is its address?
The Modbus slave vendor determines and documents what data is available as 0X, 1X, 3X, or 4X references (i.e. Coils, Discrete Inputs, Input Registers, and Holding Registers, respectively). Simple Modbus slaves may expose all of their data as only 4X references (Holding Registers), regardless of whether they are analog or digital values (up to 16 digital values may be bit-packed into a register) and regardless of whether they are inputs (read-only by the master) or outputs (read/write by the master). More complex Modbus slaves may use all reference types and will typically map data as follows:
Digital Outputs => 0X references (Coils)
Digital Inputs => 1X references (Discrete Inputs)
Analog Inputs => 3X references (Input Registers)
Analog Outputs => 4X references (Holding Registers)
 
I think this way (and always works):

The slave defines the IN and OUT terminology.

If the data is read only and it's format is INT or WORD, it must be 3xxxx (i.e. frequency feedback from an inverter, temperature feedback from a controller, etc.). These datas are read only and the master/client can't do anything about them.

If we're talking about a setpoint, it'll be 4xxxx because the master will WRITE it in the slave/server.

The same for digital datas (i.e. general status for inputs and start/stop for outputs)

So in my opinion the concept is:

INPUT: leaves from slave/server and enters in the master/client
OUTPUT: the master/client will WRITE and the slave/server will READ it
 
Top