Jump to content
Sign in to follow this  
dsoper

Using int to real

Recommended Posts

I 'm using a unistream 10" hmi and have analog inputs and outputs. the properties for the analog are int16. if I want a range of 0 to 5.00 for one, but can only put in 0 to 5 or 0 to 500, how do I use an INT to Real conversion block to change it. I use the int16 value of the an input as A, what is used on B and C so that I can have a real value of 5.00

Share this post


Link to post
Share on other sites

Hello,

 

There are two ways you could handle this value: A.) leave it as a 'scaled' number and format for diaplying purposed, or B.) convert to a 'REAL' as you mentioned.

 

A.) If you plan to leave it scaled, you just have to remember that you have scaled by 100 if you perform any math with the number.  When displaying on screen, you have the option to format the INT with a forced decimal place.  This is handled in the properties window (bottom right side of UniLogic) when you have the numeric box displayed.  This is the more simple way of handling this number.

 

B.)  If you plan to convert to a 'REAL', you must perform two math functions first.  First, divide the number to receive the whole part of the REAL number (in your case, divide the input by 100) and save this into an INT register (we'll call it tag A).  Then, take the modulous of the input over your scale (again, 100 in your case) to receive the remainder, or fractional, part of the REAL number and save this again into an INT register (we'll call this tag B ).  In the "INT to REAL" function block, insert tag A (the whole portion) into input A, insert tag B (the fractional portion) into input B, and in input C, you will put the location of the decimal point (2 for your case stated above).  This function block will reply with your "REAL" number in output D.

 

With UniLogic, if you hover over the parameter letters, the input and outputs will provide a pop-up description of what the input or output needs or will provide.

 

Hope this helps.

Share this post


Link to post
Share on other sites
I was using the INT to Real element. hovering over the parameter letters doesn't give me a clue as to what it needs to be . The A I put as the input value that I want to convert. No idea what is in B or C. Help file is worthless. 
Even with other things like the Formula element is basically worthless. I created basic formula A + B    it doesn't work either. Is there anything that actually works?

I'm not sure I understand how to   "Then, take the modulous of the input over your scale (again, 100 in your case) to receive the remainder, or fractional, part of the REAL number and save this again into an INT register (we'll call this tag B )."

For example if my input value was 3.92, the integer value of the input would be 392. divide by 100 to get the first part... 3    then?

Share this post


Link to post
Share on other sites
I was using the INT to Real element. hovering over the parameter letters doesn't give me a clue as to what it needs to be . The A I put as the input value that I want to convert. No idea what is in B or C. Help file is worthless. 
Even with other things like the Formula element is basically worthless. I created basic formula A + B    it doesn't work either. Is there anything that actually works?

I'm not sure I understand how to   "Then, take the modulous of the input over your scale (again, 100 in your case) to receive the remainder, or fractional, part of the REAL number and save this again into an INT register (we'll call this tag B )."

For example if my input value was 3.92, the integer value of the input would be 392. divide by 100 to get the first part... 3    then?

 

 

There is a function under the math tab call 'Modulous' (MOD).  This will divide the number and only provide the remainder.  For instance, if you take the modulous of 392 by 100, it will result with 92 (392 % 100 = 92).  It does not care about the whole number portion, only what is left after division.  For the INT to REAL function, we need to get the 'whole' part and the 'fractional' part in two separate registers, the put them back together with a decimal place in between.

 

If hovering over the parameters does not show descriptions, I would suggest re-installing the software and ensuring you are running as an administrator by right clicking on the UniLogic icon.  What type of Windows OS are you using?  What UniLogic version are you running? 

Share this post


Link to post
Share on other sites

Thank You Shane! That helped. I had messed around and figured out a way of doing it with the divide by 100 and then using a subtract and feeding that into theInt to Real element. I was able to connect using usb on another laptop. The one I normally use can connect to a vision on Eth, but will Not connect to the unistream. I made sure to add the 2 unistream files for notification etc. to the allow portion of windows firewall, but it still did not work for either usb or Eth. Not sure why. IT's have stuff so locked up it's hard to get into some things in windows. I am using Windows 7 and the unilogics is the 1.15 Rev 70. I appreciate your help. I am doing a lot of math in the program to use analog inputs to provide the the settings for a PID loop to control a vfd speed and valve positioning, so having the input converted to a real number makes the calculations a lot easier. Again, thank You.

Share this post


Link to post
Share on other sites

I can connect using Ethernet, but not usb. tried different cables and different ports but nothing. it says it is searching for a plc, but does not find one. I am logged on as administrator.

Share this post


Link to post
Share on other sites

We have seen this issue before with some PCs.  Usually it is due to Windows only allowing 'signed drivers', whereas we are an unsigned driver.  If you go to your device manager, does the USB connection show under 'Ports'?

 

Please note that you need to support unsigned USB drivers.
Remove the USB driver and reboot your PC, then follow the instructions below.

 

Step by step guide on how to unsigned drivers (USB) on Windows.

Move your mouse courser to the upper right part on the screen
Select settings ->Change PC settings->Updates and Recovery > Recovery > Under “Advanced Startup” > Restart now.

Now the system will restart and might take some minutes to show up the boot menu.

You will be prompted with a menu with following options.

- Continue

- Troubleshoot

- Turn off

Choose Troubleshoot

 

Then the following menu appears.

- Refresh your PC

- Reset your PC

- Advanced Options

Choose Advanced Options

 

Then the following menu appears

- System Restore
- System Image Recovery
- Automatic Repair
- Command Prompt
- Windows Startup settings
Choose Windows Startup Settings, then Click Restart.

 

Now the computer will restart and the boot menu appears.
Choose Disable Driver signature Enforcement from the menu by using your keyboard numbers.
Windows will start and you can do the installation of the driver that is not signed.

 

Also, please be sure you have the driver installed.

 

Please let me know how this works for you.

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...