Im trying to take an 8 bit value from the ADC of an ATTINY48 and convert it into a number between 1 and 23 - I suppose you could say I was converting the number into a number of base 23. Im looking for the fastest way of doing this - im not very experienced with embedded stuff - I have tried using repeated if - else statements - which is slow - and containing all 256 different possible outcomes in an array - which uses up all my memory. What is the best / fastest way of doing this? Might it be an algorithm to sort the number into a base 23 number? Or is there something easier i have missed?
Joined: Mon. Apr 9, 2012
Posts: 76 View posts