Hello, i am having a problem. I will try to describe the best i can.
My project is measuring the voltage of a buttoncellbattery, under no load and under load. It then calculates the internal resistance of the battery.
At the end of the measurement i want to display on an LCD screen if the battery is OK, or the battery is not OK. But the terms of a bad battery and good battery can difference.
For instance,
Open voltage from battery > 3.18V, voltage from loaded battery <3V, Internal resistance < 20Ohm = GOOD BATTERY
Open voltage from battery > 3.18V, voltage from loaded battery <3V, Internal resistance > 20Ohm = BAD BATTERY
Open voltage from battery < 3.18V, voltage from loaded battery <3V, Internal resistance < 20Ohm = GOOD BATTERY
Open voltage from battery < 3.18V, voltage from loaded battery >3V, Internal resistance < 20Ohm = BAD BATTERY
Open voltage from battery > 3.18V, voltage from loaded battery >3V, Internal resistance < 20Ohm = BAD BATTERY.
But after the measurement is done i do not want to design my software like this:
if(
Open voltage from battery > 3.18V, voltage from loaded battery <3V, Internal resistance < 20O){
LCDPrint("GOOD");
}
else if(Open voltage from battery > 3.18V, voltage from loaded battery <3V, Internal resistance > 20Ohm){
LCDPrint("BAD");
}
else if(Open voltage from battery < 3.18V, voltage from loaded battery <3V, Internal resistance < 20Ohm_{
LCDPrint("GOOD");
How can i handle this? Is it possible to use a lookup table where i store al the values and write all the possible outcomes?
Perhaps a switch/case?
I have no idea how to do this. Thats the reason i came to you fokes.