Have you set GIE to 1 (global interrupt enable)? /Ruben > Device: PIC16F690. > = > I want to trigger an interrupt when the comparator on my PIC changes from > OFF to ON. The +input of the comparator is connected to a divider which > produces approximately 300mV. The -input is connected to a PAL video > signal, the hope being that the comparator can act as a cheap sync > separator. > = > So here is my initial code, in C, for the Hi-Tech C compiler: > = > /* > * Interrupt service routine. > * > * This is only triggered by the comparator input and it is here where we > * handle the video... > */ > interrupt isr() > { > PORTC =3D 0x01; > PORTC =3D 0x00; > clear_interrupt: > // Clear interrupt flag and return. > PIR2 &=3D ~CFG_C1IF; > PIR2 &=3D ~CFG_C2IF; > return; > } > = > /* > * Main routine. > */ > int main() > { > // set up comparator > VRCON =3D 0b00000000; // voltage ref: off > // comparator enable, inverted polarity, + connected to external > reference (pin 19), - to RA1 (pin 18.) > CM1CON0 =3D CFG_C1ON | CFG_C1POL_INV | CFG_C1CH_0; > // enable all peripheral interrupts > INTCON =3D CFG_PEIE; > PIE2 =3D CFG_C1IE | CFG_C2IE; > TRISC =3D 0b00000000; // tristate for C, all outputs. > PORTC =3D 0b00000000; // output zero > // Idle. > while(1) ; > } > = > PORTC never gets toggled. What is it that I am doing wrong? > = > Thanks. > = > -- = > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124, 200 39 Malm=F6, Sweden TEL INT +46 40142078 FAX INT +46 40947388 ruben@pp.sbbs.se =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist