Theese calculations will overflow when adc_in is greater than 655.
For 0-300 lbs output = adc_in * 100 / 341
For 0-400 lbs output = adc_in * 100 / 256
It would be better to use the "*/" operator for these calculations.
For 0-300 lbs output = adc_in */ 75
For 0-400 lbs output = adc_in */ 100
If you want proper rounding of the result you can use.....
For 0-300 lbs output = ((adc_in */ 750)+5)/10
For 0-400 lbs output = ((adc_in */ 1000)+5)/10
Bookmarks