
immediately, because the counter runs continuously. The buttons are checked, and
the compare register value incremented or decremented to change the output pe-
riod if one of them is pressed. A check is also made for zero at the upper and lower
end of the period adjustment range, to prevent the compare value rolling over or
under between 00 00 and FF FF. This would cause the output frequency to jump
between the minimum and maximum value, which is undesirable in this case.
The 1 ms pulse period is generated as a software delay, which runs in paral-
lel with the hardware timer count. After 1 ms, the output is cleared to zero, but
the hardware count continues ...