register structure of complex data (e.g. value + status + unit)

J

Thread Starter

Julian

Hello,

I'd like to know which register structure is the best way to transmit complex data structures like a measurement values and their unit and status.

For example: I have a device that provides some measurement values and each value has its own unit and status. I want to read the data with a single transaction, so the data must be arranged on contiguous registers.

1. approach:
<pre>value 1
unit 1
status 1
value 2
unit 2
status 2
value 3
unit 3
status 3</pre>
2. approach
<pre>value 1
value 2
value 3
unit 1
unit 2
unit 3
status 1
status 2
status 3</pre>
3. approach (kind of PROFIBUS PA style)
<pre>value 1
status 1
value 2
status 2
value 3
status 3
unit 1
unit 2
unit 3</pre>
I saw many different approaches for mapping data onto Modbus registers and it seems that data on contiguous registers should have the same data type in order to let PLCs interpret the data in an easy way.

The example above may has three different data types: value in REAL, status in BYTE and unit in UINT. Therefore the first approach seems to be to complicated for a plc?!

What do you think is the best way?

I came up with two ideas:

- provide multiple structures (e.g. the 3 approaches) -> static

- assume a default structure and let the customer select other variants via an extra register -> dynamic

I'm looking forward to your suggestions and opinions.

Julian
 
L

Lynn August Linse

You'll find method 2 best for Modbus - and remember that most Master/hosts force a single read to be either all 16-bit, or all 32-bit. So all 32-bit must be aligned, sometimes on an even boundary.

So doing:
: 2x16 as 32-bit float
: 1x16 as 16-bit status
: 2x16 as 32-bit float
: 1x16 as 16-bit status
Is very problematic.
 
Top