Jump to content

How do I convert a UINT32 to Real?


Greg Smith

Recommended Posts

Hello,

 

I guess I'm spoiled by RS5000 Rockwell Logix software automatic conversion of dissimilar data types...  In other words I can very easily compare or do math to a "real" and "integer" values without having to code additional steps to covert the numbers.

 

So now I'm trying Unistream for the first time mainly because of the "STRUCTS" and "UDFB" features are very powerful tools to have that are competitive to Rockwell and Siemens features... 

 

Is there an easy way to convert at UINT32 to Real?  I see the conversion instruction under the Tools/Math functions... however I do not understand how to code this... the instruction only shows A, B, C, D, etc... 

 

I don't see an instruction manual for UniLogic anywhere either... like the Visilogic programming manual.

 

 

Thanks,

Greg

 

 

Link to comment
Share on other sites

Hi Greg,

 

First of all note that if you will mouse over the parameters (A, B, C, D etc..) you will get a tooltip with the description of the specific parameter.

If you wish to perform math operation between different data types, you can find in the solution explorer --> Formulas

You can prepare your own formula and combine signed integers and real numbers.

Link to comment
Share on other sites

  • MVP 2014

I note that the INT to REAL function in the math menu only allows signed integers.  Question for the creators, why not UINTs as well?

 

My favorite solution is to use a multiplier block, multiply your UINT32 by 1 and store the result into a REAL.  I checked and the software lets you do this.  You could then save this as a UDFB if you so choose.

Link to comment
Share on other sites

Thanks to all for the responses.
 
The formula solution solves INT32 to REAL problem.  However, like Simon said (sorry for pun) no UINT32 options in the formula tag data type selection. 
 
 
Nice to see the description pop up for the variable ABCD... etc.  If I was only patient enough to hover and wait a moment!
 
 
While on this topic... is there a way to increase the column width for each visible cell in the ladder view?  By this I mean... if the struct or tag name is more than 17 characters long can it be displayed without having to hover the cursor over the tag name?  Currently the software truncates the displayed tag name with an ellipsis at the end.

 

 

Kind Regards,
Greg

Link to comment
Share on other sites

I goofed up again... forgot to mention that the "MUL" multiple math function block will not convert INT to Real by simple multiplication by 1 has Simon mentioned.  Keep getting the error message "Parameters of this function must be linked to the same data types"

 

BTW, I'm running Version 1.6 rev 83 (latest as of 3-Jun-14)

 

Simon, what did I miss here?

 

Thanks,
Greg

  • Upvote 1
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.

×
×
  • Create New...