1.4.4 IOC With Timer

Table 1-14. IOC with Timer Code Calculations
Modules Limit High Resolution
IOC/INT 1 ms 250 ns
TimerX

This method is cheap in terms of hardware modules used, but at a cost of accuracy. This method uses the pulse measurement within section Interrupt-On-Change (IOC) With Timer.

OVERVIEW

This method is similar to what the CCP module does, except it cannot latch the timer value when an event is detected (rising/fall edge). This introduces further deviation in the calculation, since software must now save the timer. Some PIC microcontrollers can specify rising and falling edge triggers, while others cannot differentiate between the two. The INT pins can be used, as well as any of the PORTB pins, if the device supports IOC. Refer to Figure   2 for a picture of what is being measured.

SETUP

After executing the setup in section Interrupt-On-Change (IOC) With Timer, the duty cycle percentage is then:

Equation 1-6. Duty Cycle Percentage Equation
D u t y c y c l e ( % ) = W T * ( 100 )

LIMITATIONS

This is the same resolution as the pulse measurements.