Greg Smith Posted May 30, 2014 Report Share Posted May 30, 2014 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 More sharing options...
Ofir Posted June 2, 2014 Report Share Posted June 2, 2014 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 More sharing options...
MVP 2014 Simon Posted June 3, 2014 MVP 2014 Report Share Posted June 3, 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 More sharing options...
Greg Smith Posted June 4, 2014 Author Report Share Posted June 4, 2014 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 More sharing options...
Greg Smith Posted June 4, 2014 Author Report Share Posted June 4, 2014 Picture for my last post... Link to comment Share on other sites More sharing options...
Greg Smith Posted June 4, 2014 Author Report Share Posted June 4, 2014 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 1 Link to comment Share on other sites More sharing options...
MVP 2014 Simon Posted June 4, 2014 MVP 2014 Report Share Posted June 4, 2014 Hi Greg, I didn't try to compile mine, looks like I didn't go far enough. I'm still curious why UINTs arent allowed as inputs for formula and conversions. Link to comment Share on other sites More sharing options...
papouchka Posted September 17, 2022 Report Share Posted September 17, 2022 8 years later, I am doing something similar. 😁 To go from UINT to REAL I used the "store" block to put a UINT in an INT and then I applied a formula with the right parameters. Multiplication by -1 should work but I don't know what is better between "multiplication by -1" and "store" from a memory and CPU resource point of view. Does anyone have an idea? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now