Read Int64 Modbus Registers

Afternoon,

I work with a lot of schneider equipment where the energy registers are stored in 4 consecutive registers. Is there any way to pull 4 registers and have the ewon compile them into a single tag?
I’ve read here that 4 consecutive registers can be read (Large values) and then the opposite here (Modbus RTU serial 485 read a double float).
If this can’t be done, is there any way to pull the two registers as int32s and then combine them in the basic IDE?

Thanks,
Sam

INT1, INT2, INT3, INT4
DINT1=INT1 & INT 2 COMBINED
DINT2=INT3 & INT 4 COMBINED
Method 1
TOTAL@=DINT1@ * 4294967296 + DINT2@
Method 2
TOTAL@=INT1@*2^32+INT1@*2^24+INT1@*2^16+INT1@

1 Like

Thanks Muhanda,

I’ve tried doing this within the Basic IDE but I keep getting an error which I think is just down to how I have written it. I’ve tried the code below within a new section and have created the last tag under mem with no luck - Can you see where i’m going wrong?

Also, as the value could be larger than the max for an int32, would i need to store the data as a floating point or a string? If so, is it just a case of making sure the tag type is set up as a float or string?

ONCHANGE “MCCB2_4_kWh”, “GOTO TagCreate”
ONCHANGE “MCCB2_4_Wh”, “GOTO TagCreate”

TagCreate:
MCCB2_4_Total@ = (MCCB2_4_kWh@ * 4294967296) + MCCB2_4_Wh@

End


Capture2

Thanks in advance,
Sam

The first article is in reference to a different product (Netbiter), so the second article is the only one that is relevant to your question.

Unfortunately, the Ewon does not support 64 bits variables, so there is no way to recompose, store or process these kind of data. You would have to pass the raw data onto another device in order to view it in 64-bit precision.

The Netbiter or the IXXAT SG Gateway would work better for this type of application.

image

I did a quick test on my ewon flexy 205.
Looks like it worked.
image

image

1 Like

Wow, that’s great! @Sam3 are you able to get it to work?

I have been told that this is not possible, so I’m really surprised! I will try to test myself as well.

This does not work for me - there are no errors, but INT1_4 just reverts to 0. Is there anything else in the script or do you just have a magical Flexy? :slight_smile:

INT1_4 data type is set to Automatic.
Just noticed there was a typo, as the last + should be INT4.
image

Just checked for the maximum values for INT1-INT4.
Which is 32767. And it works ok.


Check the data type you have for INT1_4. Make sure it’s set to Automatic.

Hi Both, thanks for your help with this

I’m still not having any luck so i’m not sure where i’m going wrong…
Both modbus tags are set as an automatic data type. Could it be that as i’m reading the tags as 32bits the modifier is forcing the data type of the modbus tags?

Capture2

Is it a typo here?
MCCB2_4_Tot@ = (MCCB4_2_kwh@ * 1000) + MCCB4_2_wh@

Should be
MCCB2_4_Tot@ = (MCCB2_4_kwh@ * 1000) + MCCB2_4_wh@