Ivan Posted November 24, 2017 Report Share Posted November 24, 2017 Good day. Somebody tell me please how to change number of digits in fractional part in the numeric variable in case if this variable shows floating point number? (It is set to 9 by default) I use the VisiLogic OPLC IDE version 9.8.31 Build 0 I tried to change number of digits on 2 but when I opened my variable again I saw that number of digits was set to 9 again Thanks in advance Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted November 25, 2017 MVP 2023 Report Share Posted November 25, 2017 Unfortunately, that's one thing you can't specify when a float is involved. We've asked. As a workaround, you can convert the float to two integers and display it that way. Let us know if you need help with that. If you post your code I can quickly hack it in for you. Joe T. Link to comment Share on other sites More sharing options...
Ivan Posted November 25, 2017 Author Report Share Posted November 25, 2017 Thanks a lot. But my code is written on LAD so I can send you whole project. Does it fit? Link to comment Share on other sites More sharing options...
Ivan Posted November 25, 2017 Author Report Share Posted November 25, 2017 I found two function which can be used for converting floating point numbers: A+B/n and INV(A+B/n). Is that it? Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted November 26, 2017 MVP 2023 Report Share Posted November 26, 2017 Yes - you want INV(A+B/n). Look over the Help on how it works. You can attach your .vlp file to a post to let us look at it. Joe T. Link to comment Share on other sites More sharing options...
Ivan Posted November 27, 2017 Author Report Share Posted November 27, 2017 PRU.rar That's it. I tried to use INV(A+B/n) function. Everything is OK except: - the second INT number(MI) has always 3 digits (It is enough 2 for me I don't know how change it) - Visualization - I put two numeric variable window on the screen and it shows me almost what I need - zero (first window) and 3 digits (second window). All right, but I need point between it and at all the view of two areas filled with digits without point looks not beatiful )) In the attached file you can see this two areas Thanks a lot Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted November 28, 2017 MVP 2023 Report Share Posted November 28, 2017 You weren't specific about which variable you're talking about, but opening the program I'm guessing it's on screen N11 and it's variable 284 and 285. It's a matter of display formatting. Unfortunately, you can't use the 3D style and get what you want. On variable 284, I changed the style to Flat and in the "Text After" field I entered a "." and widened the field to accommodate it. If you don't want the negative sign to show up check the "Do not reserve space for sign" box. On variable 285, I changed the "Leading" field to "Leading Zeros". I also checked the "Do not reserve space for sign" box. Then I resized stuff until it looked right. I generally make display-only variables flat and user-entry variables 3D for user clarity. Hopefully this gives you close to the look you're going for. Joe T. PRU.vlp Link to comment Share on other sites More sharing options...
Ivan Posted December 2, 2017 Author Report Share Posted December 2, 2017 Thanks. This solution definitely solved my problem Best regards 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