Jump to content
drr

Changing number of Decimals in Numeric Controls

Recommended Posts

Hi.

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

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