Simple Code

GoForSmoke:
For resistor testing wouldn't it be more correct to add 1/2 step to the output to at least put the stairs through the slope and make the error +/- instead of --?

That actually increases the overall error by 1/2 step. The values are more accurate if you use the front corners or back corners (zero offset or 1 offset). However, a 1 step offset eliminates zero as a possible value. I suspect not having a zero will cause problems with some control algorithms and will simply be pointless with the rest.