Code: Select all
INTCON = 0b00001000;
IOCAP4_bit = 1; // Interrupt on Pin A4 Rising edge
IOCAN4_bit = 0; // No Interrupt on falling edge
IOCAF = 0; // Interrupt flag cleared
void interrupt() { // Sub Routine for Interrupt
if (IOCIF_bit) { // Check Interrupt Flag on A4, if ON
pr++; // Increase Product gone out
IOCAF = 0; // Clear Interrupt Flag
}
}