M580 Modbus RTU Slave

Costi_S

Member
Join Date
Dec 2022
Location
Italy
Posts
2
Hi Everyone,
I'm new to Control Expert but currently I'm working with a project in which I have a Slave M580 PLC that is using a NOM0200 module to communicate in Modbus RTU with a Master Display.

After setting up the Channel 1 as a Slave (Address 15) I managed to connect the PLC to the Display and remove the communication error on his screen. Also, using Read_Var i read some datas, which means I was able to set up some sort of communication between the 2 devices.

Do i need also to define a memory area for the data exchange with the display?

In my specifications i need to set up some PDU (Ex: PDU2000, PDU3000, PDU4000,...) read by the Master.
What is the address of the memory area for a certain PDU? Do i need to configure something?

Thanks everyone for your help.
 
I'm confused. If the M580 is acting as a Modbus slave, then you would not use read_var. The display should poll the PLC for data. Read_var is used when the PLC is acting as a master.

If the display is indeed the master, then it will be configured in some way to read certain Modbus addresses. Are you configuring the display, or do you have a list of Modbus addresses that need to be configured?

Modbus addresses are set by using the address field for a defined variable. Control Expert uses %M for 0x coil addresses and %MW for 4x holding register addresses. I.e. %MW0 would be holding register 40001.
 
Okey probably read_var was a mistake but
Do you know how can i convert the PDU i have to holding register addresses? Because from my specifications i have to write PDUxxxx U16, not register 40xxxx.
Thanks for your help in advance.
 
Last edited:
I have no idea what this PDU you're talking about is. That's a generic term for a unit of data in the OSI model as far as I'm aware?

Modbus is very simple. Master uses a function code, a start register and the number of registers to read data.

It sounds to me like someone has written a specification with no understanding of the protocol.

Are you able to post the specification you're looking at, or at least the relevant parts?
 
In Modbus jargon, PDU (Protocol Data Unit) refers to the [Function Code+Code-related data] bits "on the wire."

Cf. here, top and bottom of that page from the Modbus specification.

To OP (@Costi_S):

The "4(0)" prefix is not part of the address, it is a common convention telling you to use to either use Function Code 6 or 16 to write, or Function Code 3 to read, Holding Register data on the Modbus Device.

Background

I am not sure what PDUxxxxx means, but 40xxxx (4xxxxx) is a common (e.g. this Wiki) convention that refers to a Holding Register i.e. the "4" prefix is not part of the address (xxxxx or 0xxxx) but rather a way to declare the register type (i.e. address "location" in the Modbus device). For comparison 30xxxx (3xxxxx), from the same common convention, refers to an Input Register. And to make it more confusing, Function Code 3 is used to read Holding Registers (4xxxxx), and and Function Code 4 is used to read Input Registers (3xxxxx).

Bottom line, these two directives below are equivalent:

  • Apply Function code 3 (Read Holding Register) to address xxxxx (PDU)
  • Read "address" 4xxxxx* (common convention);
* "Holding Register" is implicit in the prefix "4"

The important thing to understand is the the "4" or "3" prefix is only a commonly used convention that has nothing to do with the address specified in the PDU.

The other thing to be careful of is that the meaning of "xxxxx" for an address is dependent on context i.e. on the address model (Cf. section 4.4 here): in MODBUS PDU addressing (on the wire), xxxxx is zero-based and in the range [0:65535]; in MODBUS data model addressing, xxxxx is one-based and in the range [1:65536]. If you look at the archive of this forum, you will most likely find that off-by-1 error are the most common errors in Modbus communications.
 

Similar Topics

we use M580 which have an Modbus RTU port correct if iam wrong now should i have to read input data from ab micrologix through read var block and...
Replies
0
Views
1,878
I'm trying to read modbus data from modbus slave using Read_VAR function. I'm getting an error that my device is not linked to a module. I have a...
Replies
1
Views
178
Looking for some advice on a project. The controller is a BMEP584040. There is a RIO ring with several drops with Quantum I/O. On this ring...
Replies
12
Views
1,146
Hi all, I'm really new to this. I need to export the Modbus register mapping from a Modicon M580 through Control Expert for the registers that...
Replies
4
Views
1,002
I have a project coming up with a M580 cpu with a NOC0301 card. The majority of the comms will be EIP, which I'm familiar with, but I will have...
Replies
3
Views
1,944
Back
Top Bottom