Conversion To Float


Recommended Posts

Dear Support,

 

I am using OPC between the PLC and Daq.

I have an analog output to control the valve.

This channel is a REAL Value in PLC. But I could not convert word to integer in my OPC. 

So, I think I need to convert it in Daq Scada.

 

How can I convert the normal set to REAL Value?

For Example:

20- 16xxx

30-16xxx

 

Thanks in advance,

Sadyr

Link to comment
Share on other sites

Dear Guru,

 

When there is a connection via OPC there is no many choices like to write float or real.

 

When I write without OPC with DF Quickmod SCAN, it is ok.

But, via the OPC, how can I convert my setpoint in DF, forexample 50 C to 16968?

 

I have too many tags, so not to confuse I do not want to write with sequence.

Is it possible to use some conversion on channel or before setting the channel? 

 

Thanks in advance.

 

 

 

post-120-0-55501900-1416570796_thumb.png

post-120-0-45941600-1416570809_thumb.png

Link to comment
Share on other sites

The OPC server should have an option to specify float or real.

 

Anyhow, the Conversion you want is:

 

(from.Float(Value))[0][3] * 256 + (from.Float(Value))[0][2]

 

 

 

That will convert 50 to 16968, and other integers to part of the float.  You can then apply that conversion to any channel.

 

Note that this will only work on integers because you are ignoring the decimal part of the float and only updating 2 of the 4 bytes.  Likewise, you will be limited by the range of values available.  This may or may not be a problem.  This is not the best solution really, but if it works for you, there it is.

Link to comment
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.

 Share