From danni debouce code:
TCNT0 = (u8)(s16)-(XTAL / 1024 * 10e-3 + 0.5); // preload for 10ms
XTAL is 1MHz. I understand that this takes the 8-bit timer counter and subtracts from zero (because this runs during the overflow interrupt) enough ticks so that it will overflow at about 10ms again.
The numbers math:
1000000/1024 * .01 + .05 = 10.266
I have no problems with that
If you subtract from u8 you will "flip" back to 255 and go down from there, I get that.
My Question: What purpose does the s16 server in this macro?