accessing a memory address (6bit)

A

Thread Starter

Ax

I am new to modbus and looking for some enlightenment. I have read a few good tutorials but I still have some questions.

I am assigned to connect to a modbus slave that uses 6 bit addressing and access memory 308195.

So when I am given address 308195 to access, does that mean I need to use function code 3, and address 8195?

Thanks!
 
First I wish to clarify something important. So far as the actual Modbus protocol is concerned, there is no such thing as 4 digit addressing, 6 digit addressing, or anything else like that. All Modbus addresses are 16 bit binary numbers starting at 0 and going up to 65535. Any other way of expressing addresses is simply some manufacturer's idea of how to write their manuals or software user interface. It has nothing to do with what actually gets sent through the wires.

One documentation convention that is sometimes used is to prefix the addresses with a numeric digit indicating the type of address. These are typically as follows: "0" = coils, "1" = discrete inputs, "3" = input registers, and "4" = holding registers (note there is no "2"). This is analogous to how IEC PLC addresses are prefixed by "I", "Q", "M", etc. There is nothing about this in the Modbus protocol specification because it isn't part of the official Modbus protocol. It's just a unofficial convention that some people use.

Another thing to note is that some manufacturers write their addresses starting at "1", while others start at "0". However, that is also a documentation issue, the actual Modbus addresses always start at "0".

I have a web page at the following URL which may provide some additional details:

http://mblogic.sourceforge.net/mbapps/ModbusBasics-en.html
 
Could anyone tell me how to access addresses such as 50526. Its a socomec power meter, but their listed addresses dont work for me if I enter them as-is. Should I be using a different format?

If 40526 references 526/525, how do I access an address starting with 5?

Many thanks,
Mark
 
L

Lynn August Linse

> If 40526 references 526/525, how do I
> access an address starting with 5?

There is much notation confusion. Since Modbus supports, 65536 registers you have no reason to absolutely assume the 4xxxx doesn't mean 4x40526

40526 MIGHT mean:
- 4x access to holding register 525
- 4x access to holding register 526
- 4x access to holding register 40525
- 4x access to holding register 40526

There is no 5xxxx memory area (although a vendor could create one! Long live creativity)

50526 will mean either:
- 4x access to holding register 50525
- 4x access to holding register 50526
 
>40526 MIGHT mean:
>- 4x access to holding register 525
>- 4x access to holding register 526
>- 4x access to holding register 40525
>- 4x access to holding register 40526
>
>There is no 5xxxx memory area (although
>a vendor could create one! Long live
>creativity)
>
>50526 will mean either:
>- 4x access to holding register 50525
>- 4x access to holding register 50526

Thanks for your reply, much appreciated!

That would seem to make sense, and is what I had tried originally. However every time I enter the address 50525/50526, as with the other addresses listed, I get an invalid address exception in MODPOLL and my own code. I can get values for 526 etc, but I dont think these are correct. Might you have any ideas as to whats wrong?

Is it worth iterating through the entire address range (0 - 65536) to detect valid registers? Would this tell me anything useful or could I somehow miss registers this way also?
 
L

Lynn August Linse

There is another similar post on control.com - for that one I mentioned that some slaves (power meters specifically) use 32-bit values and prevent you from reading 1 register or mis-aligned registers.

In other words, reading 1 register at 50525 might fail but reading 2 (or 4 or 6) may succeed.

Such devices will also complain if you read mis-aligned, so if 50525/50526 is really a 32-float, then trying to read 2 registers at 50524 would fail because that would be 1/2 of one field and 1/2 of another.

This is NOT how Modbus works, only how these vendors have implemented it.
 
Thank you for your help and sorry for the late reply.

This was indeed part of the problem. The other part was that I was in fact dealing with an older meter and so the addresses given to me were incorrect.

Many Thanks,
Mark
 
Top