Jump to content

Recommended Posts

Hello, 

I'm have some problems with the conversion of two integers to a floating point value. 

I have a modbus energy meter (SDM120) who works with 32bit IEEE745 floats values.

In visilogic I receive two 16bit integers (MI);

MI0 : 15643

MI1: -23069

I converted these integers to bits by the 'num to bit' function block. 

These are the converted value's :  

MI0 : 15643 --> 0011 1101 0001 1011

MI1: -23069 --> 1010 0101 1110 0011

 

If I put the two value's behind eachother I get the following binary code:

0011 1101 0001 1011 1010 0101 1110 0011 (MI0,MI1)

When I fill in these binary code on a online binary to IEEE745 converter I get the following result: 0,038

This matches with the amps showing on the energy meter's display. 

 

The question is; How can can I make from MI0(15643) and MI1(-23069) a float in Visilogic

So, MI0(15643) and MI1(-23069) -------------- some kind of formula -----------> MF0 = 0,038

 

Annyone who can help?

 

Best regards, Jelmer 

 

Share this post


Link to post
Share on other sites

Looks like this is always the case with energy meters.

You use "Struct" block under Vector -> Struct for merging those two registers into a float. There is an explanation for struct block in help file. After that use math function blocks for floats to extract the values if you need them converted to int.

MB.PNG

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...