From: "Andrew Warren" Sent: Wednesday, August 18, 2004 5:05 PM > It's easier to divide by 4 to get 0-255... And if you then map 0-30 > to 1, 31-230 to 1-200, and 231-255 to 200, you'll be sure to have the > entire range even if your pot doesn't quite go to the ends of its > travel. When I said divide by 5, I didn't mean throwing away information; for example 633 would become 126.6Hz which is a different result than 634 which is 126.8. I could use your way and then have my values rounded to the nearest 0.25 instead of 0.2, but I don't know that it will be that important to compensate for a pot that doesn't let me get to the end of the range. Especially if I'm using a 10-turn pot which should be of generally higher quality and much more likely to get to the end of its range of travel. > Don't use floating-point math for this... Use a lookup table. That would be easiest, but are their shortcuts if I go that route? I'll have 1000 input values, and I'll need 2 bytes to output for each one (number for 100uS and number of 10mS to delay). That means a 2000 value lookup table. Jason -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu