Hi,
(OK, just an idea here - worth a try)
With the AD result set to 8 bits your result will vary from 0 to 255. Try changing the line:
toCode:i = 256 - adval
and see what happends. Even at full scale (adval=255) your i variable will be 10 if you subtract adval from 256. You will probably still get short glitches but hopefully you will end up closer to what you want.Code:i = 255 - adval
/Henrik Olsson.
Bookmarks