Fred Bailey wrote: >I'm having trouble with the capture input CCP1. I have capture input CCP2 >working (finally). >I have tested the Port C - I/O by disabling both capture modules and reading >port C. > All bits work OK (Hi and Low). But, I can't get CCP1 (RC2 input) to capture. I >have also tried >using CCP1 and CCP2 together and separately Only CCP2 works. > >I initialize the CCP1 as follows: >Setup_capture ; RC1input pulse, 50uSec wide every 16.6mSec, use capture2 (CCP2) > BANK0 > movlw 0x3D > movwf T1CON ; set up timer1 for internal clock,1:8 >Prescale,timer Enabled > BANK1 > bcf PIE2, CCP2IE ; dissable interrupt from capture > BANK0 > clrf CCP1CON > clrf CCP2CON ; Clear prescaler, turn off CCP2 module > movlw 0x05 > movwf CCP2CON ; set up Capture Mode on every rising edge > BANK1 > bsf PIE1,CCP2IE ; enable interrupts from capture > BANK0 > clrf CCPR2L ; clear capture registers > clrf CCPR2H > >I run the program an the interrupt never occurs. The input voltage is 5.0 volts >when the pulse is high. > There is about 25usec rise and 25usec fall time. > Hi Fred, I have some suggestions here. 1 - I don't see you configuring the port direction bits. 2 - I don't see you doing a global interrupt enable, or resetting the relevant intr flag. 3 - I would not turn on Timer 1 until everything else was setup and ready to go. You do this in your first couple statements. 4 - Timer 1 is going to clock out very fast, probably < 1 sec, depending upon the xtal in use, so you have to get right on the job with your input signal soon as you run this code, else you will miss the event. 5 - You also have to jump thru a few hoops in order to avoid false captures, as detailed in the spec sheet. 6 - During development, I would first get this code working correctly in polled mode rather than interrupt mode - ie, simply poll the interrupt flag, and read the register. Fewer things to get confused about. hope this helps, - dan michaels www.oricomtech.com ================== -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body