Rounding to nearest multiple of 5
I'm working on an RF generator and I need to display the intensity value
on the screen rounded to the nearest number divisible by 5. For example
if I read 43 from the A/D I have to display 45. 32 would be displayed as 30.
Does anyone know a quick way to do this?
Thanks.
on the screen rounded to the nearest number divisible by 5. For example
if I read 43 from the A/D I have to display 45. 32 would be displayed as 30.
Does anyone know a quick way to do this?
Thanks.
Comments
val = val + 2 / 5 * 5
-Phil
Have a good one.