2.2 PWM Variations

Another encoding method, which is related to PWM is Pulse Width Coding (PWC). This also uses a pulse train to convey encoded information, but its encoding is different. For a PWC pulse, the information is encoded in the raw (timed) width of the pulse itself, and the cycle period is (within some limits) irrelevant. Perhaps, the simplest comparison between PWM and PWC is that, if a PWM period is doubled, the pulse width is also doubled, but if a PWC period is doubled, the pulse width is unaffected. The AVR’s PWM generation unit may be used to generate a valid PWC signal.

PWC is perhaps most visibly used in the control of RC servomotors. Typically, the pulse width is varied between 1ms and 2ms to position the servo mechanism; the refresh rate (PWC cycle period), however, may be freely chosen between 50Hz and 2kHz, with some variation between units.

PWC is also used to convey digital information in the MD5 and RECS80 protocols used by infrared-based television remote controls. While these protocols are different, both depend on the raw pulse width, and thus a calibrated clock, to discern between bits 0 and 1. The PWC cycle time, which includes the time between bits, is not defined and thus may (in theory) be arbitrarily long.

While some of the techniques used in this Application Note may also apply to PWC, discussion on implementation will be limited to PWM.