Hello Peter,

The best way to get started, is probably to make a few interrupt routines with Darrel's Instant Interrupts. He has made them pretty easy. Here is his page for DT_INTS-14 which will be compatible with your 16f877. The newest version is 1.0, to which there is a download at the bottom left of this page: http://www.darreltaylor.com/DT_INTS-14/intro2.html Then check out the blinky examples and such, and have some fun setting up different interrupts.

Here is a very nice example of hardware capture CCP1 interrupts by Bruce: http://www.picbasic.co.uk/forum/show...3605#post83605

Only "problem" is that he does not use DT_INTS, and I think for most people, DT_INTS should be used.

Here is an example I had for detecting pulse width using DT_INTS: http://www.picbasic.co.uk/forum/show...2990#post82990 but mine uses an 18F in this example. Since it is only detecting pulse width of one channel, it is a bit easier read than my pwmpassthrough.

I must admit that my PWMpassthrough example is a bit exhausting to look at. Here is basically what it does: It looks for 6 transitions, starting with a rise. This is the first part of the first pulse. The timer value is grabbed at that moment, and put in CCPR1H and CCPR1L (high and low 8 bit registers for the 16 bit timer). It is next interrupted at what I call "falltime" when the pulse goes low. This falltime is set in CCPR1H and CCPR1L. To get the width, you must subract falltime from risetime. It collects all of these, and does the subtraction to find the pulse width.

Then values are read to ouput to the servos, and software pwm pulses these out. And all this is done before the next round of inputs need to be measured.

For your application, you would only need to read the pulse width for channels 1 and 3. You could determine the width of radio ch2 by subtracting rise ch3 from fall ch1. If that makes any sense. See the diagram below.

Code:
; The input signal should look something like this:- 
;
;        |<------------------ 1 frame (~20mS) -------------->|
;        |<1~2mS>                                 
;         ______        ______        ______                  ______
; _______|      |______|      |______|      |________________|      |____
;   gap    ch1    ch2    ch3    ch4    ch5      sync  gap      ch1    etc
The funny part is, that I did not know I could use some PBP statements in an interrupt routine of type "ASM". So what could have been cleaner to read (and write) was done in assembly.