Hi, The capture module can be configured as one rising edge detector. If TMR1 is running free and the capture module is armed, CCPx can take two snapshots of TMR1. The pulse width can be calculated applying 16 bit unsigned math: PULSE_WDTH = NEW_CAPT - OLD_CAPT TMR1 is configured in a way that each unit values one microsecond. Since I don't have a stable wave generator to test it, I've done a simple ON-OFF 50% duty oscillator with a 16F873. Using Andy Warren loop generator (625 Inst-cy) achieves full precision in MPLAB simulator, so I use some crystals to change the frequency and I've obtained these captures: 20Mhz = 250 and 251 (us) 10Mhz = 500 and 501 4Mhz =1250 and 1251 Q1: What means that jumping from 0 to 1 and 1 to 0? Q2: If it is normal, has a name? Q3: CCPx has lost one pulse from TMR1? Configuration: 16mhz crystal TMR1 1:4 CCP2 prescaler 1:1 CCP2 rising edge The whole process is fired once every 100ms, by now. ;====================================================================== ; CCP2 ISR : PIE2,CCP2IE bandera en PIR2,CCP2IF ;====================================================================== PIR2_CCP2IF_Handler: BSF STATUS,RP0 BCF PIE2,CCP2IE BCF STATUS,RP0 BCF PIR2,CCP2IF ;Test if it is the first pulse btfsc PWMErrorFlags,SnapOnGo goto SndSnap ;First pulse BSF PWMErrorFlags,SnapOnGo movfw CCPR2H movwf CCP_H_OLD movfw CCPR2L movwf CCP_L_OLD BSF STATUS,RP0 BSF PIE2,CCP2IE BCF STATUS,RP0 GOTO _Interrupt_handler SndSnap: BCF INTCON,PEIE BCF PWMErrorFlags,SnapOnGo movfw CCPR2H movwf CCP_H_NEW movfw CCPR2L movwf CCP_L_NEW ;Measure the width movf CCP_L_OLD, w subwf CCP_L_NEW, f btfss STATUS, C decf CCP_H_NEW, f movf CCP_H_OLD, w subwf CCP_H_NEW, f bsf PWMErrorFlags,SnapNewCap GOTO _Interrupt_handler Thank you in advance. Dennis Crawley Argentina -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics