Re: USB IR Toy update
Reply #4 –
I need to spend some more time with the datasheet to be sure. My assumption was that I could use the timer (counter..) or CPP interrupt on the first edge to do what I want. For example the CCP offers these options:
15.2 Capture Mode
In Capture mode, the CCPRxH:CCPRxL register pair
captures the 16-bit value of the TMR1 or TMR3
registers when an event occurs on the corresponding
CCPx pin. An event is defined as one of the following:
• every falling edge
• every rising edge
• every 4th rising edge
• every 16th rising edge
The event is selected by the mode select bits,
CCPxM3:CCPxM0 (CCPxCON<3:0>). When a capture
is made, the interrupt request flag bit, CCPxIF, is set; it
must be cleared in software. If another capture occurs
before the value in register CCPRx is read, the old
captured value is overwritten by the new captured value.
So the first X edge triggers one capture that measures the period, then we get an interrupt (it doesn't look like first-edge interrupt is an option), then we could take the 3 x 100uS counts using timer 1 as a counter and timer 0, 2, or 3 as a timer. If we want everything to begin absolutely on the first edge, then we should start with an interrupt INT1 or something. All three pins would be connected to the detector output.