Red Lion MODBUS register mapping (for Arduino)

phuz

Member
Join Date
Jun 2008
Location
Mohnton, PA
Posts
1,044
Because I'm apparently a glutton for frustration, I am experimenting with an Arduino communicating Modbus to a Red Lion.

The Arduino code has the capability to read from a Modbus register, but only allows 16-bit entries. The Red Lion assigned my mappings in the 6-digit range, therefore exceeding the 16-bit max (65535). Is there a way to set the Red Lion mappings to different ranges?

I've successfully made the connection, but it appears the Arduino can't read addresses over 65535, and the Red Lion can't set them below 100000.
 
Though it appears as 6 digits, that's not really the real address. Example: in Crimson, 400245 is really 40245. They do this to address the people who don't adhere to the standard. As I recall, the true ranges start at 00001, 10001, 30001, and 40001.
 
Though it appears as 6 digits, that's not really the real address. Example: in Crimson, 400245 is really 40245. ... As I recall, the true ranges start at 00001, 10001, 30001, and 40001.

MODBUS uses a function code to designate the memory area.
MODBUS uses a 16 bit data type to specify the register number.

0, 1, 3 and 4 is what was selected, for the devices, when the protocol was created, to specify the memory area.

When the protocol was created, the devices could not address greater than 9999 of any register type. Back then 4K was ALOT of memory.
That gave you:
00001- 09999
10001- 19999
30001- 39999
40001- 49999

Because 16 bits can specify 0-65535 the extra digit was added to give you:

000001- 065535
100001- 165535
300001- 365535
400001- 465535

So, it is just the addressing for humans that was modified. The extra leading digit, after the memory designation, works for old and new. Just add or drop the digit as needed.
 
MODBUS uses a function code to designate the memory area.
MODBUS uses a 16 bit data type to specify the register number.

0, 1, 3 and 4 is what was selected, for the devices, when the protocol was created, to specify the memory area.

When the protocol was created, the devices could not address greater than 9999 of any register type. Back then 4K was ALOT of memory.
That gave you:
00001- 09999
10001- 19999
30001- 39999
40001- 49999

Because 16 bits can specify 0-65535 the extra digit was added to give you:

000001- 065535
100001- 165535
300001- 365535
400001- 465535

So, it is just the addressing for humans that was modified. The extra leading digit, after the memory designation, works for old and new. Just add or drop the digit as needed.

Thanks Captain Obvious.

Yes, the extra digit is also to reach the full offset range, but as I said before, it's also to address devices that don't adhere to the standard, e.g. a certain water cut meter comes to mind that confuses address with offset. Throughout their manual, they refer to addresses in the 4xxxx range (and call them addresses), when in reality the device works with those number offsets, not those addresses.
 
Thanks Captain Obvious

Nice to meet you, Mr. Confused.

Yes, the extra digit is also to reach the full offset range,

That is the ONLY reason it was added to the address format. It has nothing to do with "offsets."

The only addresses that do not "adhere to the standard" are addresses that begin with zero (0) regardless of 5 or 6 digits.

00000, 10000, 30000, 40000 are all invalid addresses. 0000 is a valid offset.

...they refer to addresses in the 4xxxx range (and call them addresses), when in reality the device works with those number offsets, not those addresses.

4xxxx is an address.
4xxxx is not an offset.
xxxx could be an offset to any memory area.
Only the 4 converts it to an address in what is normally called the holding registers and xxxx is the register number.
xxxx used with function code 3 is an offset into the holding registers.

Enjoy.
 
Last edited:
So basically Red Lion just allocates more memory than conventional Modbus systems.

From an earlier post: The Arduino code has the capability to read from a Modbus register, but only allows 16-bit entries.

16 bits will cover the complete offset range. 0-65535
Function code 3, for 4x registers, defines the area of memory.

Examples:
Function code 3 offset 0 = address 40001 and 400001
Function code 3 offset 10 = address 40011 and 400011
Function code 3 offset 1000 = address 41001 and 401001
Function code 3 offset 10000 = address ***** and 410001; that is out of the 5 digit address range but, 10000 is a valid offset.

So to "address" above 49999 another digit must be added to the address but, the "offset" is valid.

Since you are talking about "code" and not an address entered for a tag, I would "assume" the Arduino can access the full offset range.
 
Last edited:
Gotcha.
Well I have it working well. At least on 16-bit data types. Trying to do 32-bit and floating point now. Not successful....yet. ;)
 
Gotcha.
Well I have it working well. At least on 16-bit data types. Trying to do 32-bit and floating point now. Not successful....yet. ;)

For floats (4 byte floats) you need to read 2 registers per float. Then assemble the bytes in the correct order for the float type.
 
Exactly how I have it set up. But the native modbus library for the arduino looks at 2 bytes, so I made it 4, but it appears to be ignoring the last 2 because it still rolls over at 65535.
 
Exactly how I have it set up. But the native modbus library for the arduino looks at 2 bytes, so I made it 4, but it appears to be ignoring the last 2 because it still rolls over at 65535.

It is really tough to speculate what the library is doing.
Without modifying the library, read one register, then read the next register and manipulate the bytes outside the library to make the float.

It is not a matter of adding the registers together. Floats are encoded, not bit weighted. Each bit does not have a value like for an integer.

It is a matter of moving the bytes into a float data type in the correct order for the language/platform you are running on.
 
Exactly how I have it set up. But the native modbus library for the arduino looks at 2 bytes, so I made it 4, but it appears to be ignoring the last 2 because it still rolls over at 65535.

What code/library are you using for Arduino Modbus?
 
Nice to meet you, Mr. Confused.



That is the ONLY reason it was added to the address format. It has nothing to do with "offsets."

The only addresses that do not "adhere to the standard" are addresses that begin with zero (0) regardless of 5 or 6 digits.

00000, 10000, 30000, 40000 are all invalid addresses. 0000 is a valid offset.



4xxxx is an address.
4xxxx is not an offset.
xxxx could be an offset to any memory area.
Only the 4 converts it to an address in what is normally called the holding registers and xxxx is the register number.
xxxx used with function code 3 is an offset into the holding registers.

Enjoy.

My my what problems you must have to unnecessarily be condescending/rude to me twice, after I already answered OP's question no less.

You obviously didn't read my response regarding the water cut meter I was talking about, as your response completely misses the point. Not going to waste any more time with you.

"Enjoy" having PeakHMI on the list of companies I tell people never to deal with.
 

Similar Topics

Trying to get a G306A panel to talk to an SDM120CTM meter but i can't make the Red Lion make sense of the response from the meter. Using PC...
Replies
9
Views
843
I have a Red Lion G09 scanning 8 Invertek P2 VFDs via modbus RTU - I've setup necessary comms and tags and all works well. I have a 'Settings'...
Replies
3
Views
1,870
Greetings all. First post here, new to RL, MODBUS, pretty much all things PLC, so please forgive me if I'm asking dumb questions. - I need to...
Replies
11
Views
6,166
Hi all, Got an issue with some equipment I'm trying to get talking over modbus RTU, using a Red Lion DA10D. I have attached a couple of...
Replies
11
Views
2,541
I've got a project where I need to send a 64 bit integer that is in 8 consecutive modbus registers to another device as a string. I see the...
Replies
16
Views
7,935
Back
Top Bottom