
based on the assumption that the sensor input and control output are updated
on a periodic, regular basis. You will typically implement this with an interrupt.
Implementing these examples in a microcontroller is often more difficult than
on a larger microprocessor. Microcontrollers, especially 8-bit microcontrollers,
often do not have good mechanisms to handle negative values, multiplication, or
division. You can sometimes get around these problems by using binary values.
For example, when averaging values to filter out noise, always filter 2, 4, 8, or
some other binary number of samples. This allows the division to be simple shift
operations. If