I have a Microschip Curiosity-board with a PIC16F1619 microcontroller. I use this board for school but I am struggeling to understand some of the basic functions. I am trying to light up some leds when I touch the button (RC1 - Touchbutton)
I have seen that there are alot of code which uses some easier library for controlling th button, but we are only allowed to import the htc.h as I understand.
Can anyone help me correct my code so that I can get something to react to the touchbutton.
I have seen that there are alot of code which uses some easier library for controlling th button, but we are only allowed to import the htc.h as I understand.
Can anyone help me correct my code so that I can get something to react to the touchbutton.
Code:
#include <htc.h>
#define _XTAL_FREQ 500000
void main(void){
OSCCON = 0b00111000;
TRISA =0;
TRISB=0;
TRISC=0b00000010;
OPTION_REG = 0b00000110;
LATCbits.LATC1 = 1;
INTCONbits.IOCIE = 1;
IOCCNbits.IOCCN1 = 1;
GIE=1;
while(1){
LATA =0;
LATB=0;
}
}
void interrupt ISR(void){
if(IOCCFbits.IOCCF1){
IOCCFbits.IOCCF1=0;
__delay_ms(5);
LATA=1;
LATB=1;
LATC=0b11111101;
}
}