So, it turns out, I'm an idiot (as I figured I would be). After 24 hours of cogitating and trial-and-error, I discovered that in order to successfully use the capture mode, it is *very* important to disable the external clock oscillator circuit. Would have been nice for the PIC to do that for me, if I set Timer 1 to internal, but alas, it doesn't. That coupled with my misunderstanding of just what that clock oscillator was (I was thinking: of course I want the oscillator enabled, how else will Timer 1 increment?), and I kept overlooking it. One simple bit. Well, if anyone had the answer, sorry to have beaten you to the punch, but thanks anyway! > Hi. I've been working on this all day, and I have no idea what I'm doing > wrong. > > I want to capture falling edges on a PIC16F877 using CCP2 on pin PORTC:1. In > an effort to narrow down why it wasn't working, I came up with this code: > > Loop > movfw PORTC > movwf PORTD > goto Loop > > This code works, if the PIC is minimally configured. PORTD is a bunch of LEDs, > PORTC is configured as b'11000010' (three inputs, the rest outputs, 7:0). > > If, however, I attempt to write a value to CCP2CON before executing this code, > PORTC:1 is never read properly (always reads as 0). I've tried setting CCP2CON > to b'00000100', capture every falling edge. > > If anyone has any insight, I'd really appreciate it. BTW, I've checked and > re-checked things like proper bank, and so forth. I also tried multiple PICs. > > TIA, -- Rick -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu