Jump to content

Changing number of Decimals in Numeric Controls

Recommended Posts


I have a doubt about the number of decimals with Numeric Controls. I need to be able to change the number of decimals in this controls, because sometimes a control must allow only one decimal, two decimals or no decimal in the same control, is this possible? how can I achieve this behaviour?

Share this post

Link to post
Share on other sites

Sorry for my English :(

My device is a SAMBA SM43-J-RA22.

I'm making a recipe application.

In this application the user can enter the weight for an ingredient in a Numerical Control.

I want the user to be able to enter a limited number of digits in the decimal part of the Numerical Control. This limitation of the number of digits will be configured in another part of the application.

For example:

12 <- numerical control set without decimals

12.2 <- numerical control set with 1 decimal

12.15 <- numerical control set with 2 decimals

How I can achieve this?

Share this post

Link to post
Share on other sites

You can't change the number of implied decimals on a numeric input at run time. Just set the numeric input for the maximum number of decimals and the user can input only the needed decimals. If the input is set for 2 implied decimals and the user only inputs 12.2, the correct value will go into the PLC (in this case 1220). As always, you need to do the math to handle the implied decimals.

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now