The sample value received through
icp_rx is in the form
of a fraction of the value of
ICP_SCALE. The notion is analogous to
a percentage, but the scale used here is different from 100.
ICP_SCALE should be set to a power of 2. This setting affects
the storage and CPU cost of computing and storing samples. If
ICP_SCALEis greater than 256, samples are stored as a 16-bit
quantity, and otherwise as an 8-bit quantity. This also helps in easy display of
duty cycle through the output LEDs by just sending the duty cycle value to the
respective PORT. Following figure shows how the duty cycle is computed.
Figure 1. Flowchart for
icp_duty_compute()