embedded - PIC Capture mode not triggering interrupt -


I am trying to use the capture module on PIC 16 LF 1827, but the ISR has never been entered . I started with a basic falling interrupt (work), then the timer was added to 1 configuration (still working), then the IOC was interrupted and configured / disabled, the relevant CCP interrupt (ISR never entered) has been done). Code is given below: The comment section is the original original IoC setup.

I have verified with the MPLB debugger that ISR has not been filed, and this argument is being put on the argument analyzer and confirming it is Rb1.

  #include "htc.h" // config1 // internal OSC, not wdt, use power-up timer, reset // enable any code security, enable brown-out reset, Clkout Jeepiaio, // internal-external Svichovr off, __CONFIG (FOSC_INTOSC & amp; WDTE_OFF & amp; PWRTE_ON & amp; MCLRE_ON & amp; Seepiafaf & amp; amp; amp; Seepeediaff & amp; Boaran_on & amp; Clokaanff & amp; IESO_OFF Failure clock monitor on & amp; FCMNAFF; / Config2 (debugger running after complaints MPLab) // Low Voltage Programming off, debug, reset outside brown 2.7 V / Stack over / under flow reset trigger, a 4x pll, // no Flash Write Protection __CONFIG ( LVP_OFF ​​and DEBUG_ON and BORV_27 and STVREN_ON and PLLEN_OFF and WRT_OFF); Zero Interrupt ISR (Zero) {// Bounce Pin 1 LATB ^ = 0b10; LATB ^ = 0b10; If (IOCIF and IOCBF 0) {IOCBF0 = 0; IOCIF = 0; } If (CCP1iF) {CCP1iF = 0; }} Void main (void) configured {// Internal oscillator: // PLL = 0, 1 configuration, frequency source = 4 MHz / 0b0: SPLLEN_OFF OSCCONbits.SPLLEN = 0b0; // B00: Use Config Word 1 OSCCONbits.SCS = 0b00; // 0b1101: 4 MHz frequency OSCCONbits.IRCF = 0b1101; // Configurable peripheral // port A: LEDs (output), digital TRISA = 0x00; ANSELA = 0; // port b: digital, 0 = input, 1 = output, do not care about rest TRISB = 0b11111101; ANSELB = 0; Disable // Configure timer 1 (not required for basic IOC) // source = instruction clock, Prescale = 1: 1, LP OSC, click Synchronize (DC) // 0 B 00: Instruction clock T1CONbits.TMR1CS = 0b00; // 0: 00: 1: 1T1CONbits.T1CKPS = 0b00; // 0b0: LAP OSC off T1OSCEN = 0b0; // 0b0: Making Contemporary (Ignored) nT1SYNC = 0b0; // difference / / / enabled on the decline of IO port B IOCBB 0 = 0BC000001; IOCIE = 1; Capture the falling edge of port b / // Notes in 23.1 / DP / DP: Disable, disable in the middle, set operating mode, clear flag, CCP1 IE = 0b; // 0b100: each falling CCP1CONbits.CCP1M = 0b100; CCP1IF = 0b0; CCP1 IE = 0b1; // Enable Peripheral Interrupt, Global Interrupt PEIE = 1; GEE = 1; // Start timer 1 TMR1ON = 1; While (1) {// toggle lead 0LATA ^ = 0b1; }}   

I am using hi-tech c compiler (light), running in MPLab.

Any suggestions would be greatly appreciated. If I apologize for the butcher terminology, then this is my first project on a PIC.

According to the datasheet, your capture settings for TRISB1 are in the form of input, Must configure as. For Jeepiaiai pin, setting Tiarais bit 0 output, 1 input Edit: Forgive the early stupid answer because I did not know that its scope Were using POTB1 as PPITI 1

Capture pin correct (using IOC)? Capture module uses a different GPIO port for its input (PORTB3 for CCP1) Did you transfer the connection to PORTB3 for your capture source?

Edit: The PIC data after seeing something on the lookout sheet I saw that the CCP can be moved PORTB3 the Jeepiaio pin 1 to PORTB0 But how do I do not see any reference to APFCON0. CCP1SEL bit set will be something else to check it.

Comments