Value help!?

Another possibility is to divide the returned value by some number to get a smaller set of returned values. E. g. let's say the range was from 0-127. If we divide the returned value by 16, then the result would be a number in the range of 0-7. It's easy to set up a switch statement to handle that:

switch (x/16) {
case 0:
// do whatever at zero (or 0-15 values of x)
break;
case 1:
// do whatever at zero (or 16-31 values of x)
break;
case 2:
// do whatever at zero (or 32-47 values of x)
break;
...
}

Jim.