I have a logarithmic single turn pot. I am pumping the value into a 10 bit ADC converter on my mega88pa, writing in GCC, C.
When I take the output value (0-1023) and divide by 100, I can make 10 steps which will be used as 10 settings for my project. 0 through 99 / 100 = 0 (mode 0). 100-199 output from the adc would correlate to mode 1 since 199/100 = 1, and so on and so forth.
If my pot were linear, a tenth of a twist would be mode one. a second tenth of a twist would be mode 2, etc.
Changing a pot to linear is not an option. The log pot needs a quarter twist to give me 100 or greater value, a eighth twist to give me a 200, a 16th to give me 300 (so on and so forth more or less). Do I have to use Switch/Case statements and say if ADC value is 0-200, then 0, if 200-300, mode 1, if 300-350 mode 2, 350-380 mode three, etc etc so that the dial will switch linearly in between modes.
Is this my only option? Please give me hints, I havn't had to include math.h yet, don't really want to, was thinking some smarty on here would know another work around, I can't think of any.