Greetings folks -
This question has its roots in a hardware question so lets start there.
This involves my M328P accelerometer/data logger system that I sell. At the present time, I just allow it to die when the battery runs down. This can potentially result in the loss of up to 24 hours of data as the data file on a uSD card is closed, and a new one opened, every 24 hours. Also, however, there IS the potential for faulty card operation if the supply voltage drops below the spec'd minimum and this could lead to invalid data being stored; in many ways, this is even worse than data loss.
So, my plan is to save a reading of the reference taken with a known good battery and 3.3V supply (as ADC reference) during manufacture, and save that in EEPROM. When the battery discharges, Vcc will decrease. Since it is the ADC conversion reference, Vref READINGS will increase. I will choose some arbitrary threshold, perhaps (3.3/3.0 = 1.1) of the original reading as the cutoff point. Since there are tolerances involved (esp for the reference), I want the cuttoff value to be a proportion of the original reading, not some fixed number.
So, we finally get to the programming question. Is there some process other than floating point, that I can use to compute the cuttoff value? I can get close enough if the ratio is 1.1 but what if I want the cuttoff to be 2.9V? Then, the ratio becomes 1.138. Maybe 1.125 would be close enough and that would be easy to do. But, is there something more general that does not involve floating point? Note that I plan to store in EEPROM the scaled value, so that it does not have to be computed over and over.
Ideas/suggestions/etc. are thus solicited.