Jump to content

Recommended Posts

Posted

Hi

I have flow meters and have them counting up to a value and stopping a pump.

 

it all works but the display on the hmi counts up in decimal places because of the scale factor of the flow meters.

To scale them because of inacuracy I basically multiply what I want to count to by 1000 and i basically add for every pulse of the flow meters a value between 1500 and 500 to count to scale the flow meters then compair the two to stop the pump if the count is equal to or greater than the dialed in amount.

Is there an easy way to round this value to the nearest bigest 10's value?

I'm guessing convert to a floating point use the FIXL instruction?

is there an easy way im missing as I could not seem to find a rounding instruction?

 

 

Posted

What screen are you using?

If it is only for display, the NS screens will round the value automatically to the number of digits shown. FYI... the NS screens will also scale for you.

Posted

Hi,

Here's a suggestion for the logic to use ;-)

  1. Add 5 (half of 10) to make the result to round up or round down
  2. Divide by 10
  3. Convert to INT type to truncate.
  4. Multiply by 10

So 32 would become (INT((32+5)/10)) * 10 = 30 or 37 would become 40. Sorted?
Regards,

BB

 

 

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

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