Remember that the MCU can not handle 14 volts. 5 is the max. You can use a voltage divider to bring the voltage down though. Do a 3 to 1.Output is 10 to 14 volts.
To tighten the readings up you can add a VREF value to the MCU via voltage dividers.
Yes, the decimal constants are converted to whole numbers for calculating.But, then in the code you multiple m by 10,000 and b by 100, what does this do for the values? Is that simple to prevent truncation in the program?
I will suggest setting up a test board with some pots and play with the ADC some to get a feel for it.





Bookmarks