Cantafford
Member
I wrote this simple piece of code in which I'm supposed to read the value of the IC1BUF register upon falling edge detection and write it to portC. I'm using PIC18f2431.
If I run this I get: main.c:14: error: (192) undefined identifier "IC1BUF"
How can I fix this? Thanks.
Code:
/*
* File: main.c
* Author: Paul
*
* Created on May 25, 2016, 8:24 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include "header.h"
void interrupt IC1interrupt()
{
LATC = IC1BUF;
IC1IF = 0; // clear interrupt flag
}
void main()
{
OSCCON = 0x7F;
TRISAbits.RA2 = 1; // button is here
TRISC = 0; // leds are here
CAP1CON = 0x41; // capture every falling edge
GIE = 1; // enable global interrupts
PEIE = 1; // enable pheripheral interrupts
IC1IE = 1; // enable input capture1 interrupt
IC1IF = 0; // clear interrupt flag
while(1)
{}
}
If I run this I get: main.c:14: error: (192) undefined identifier "IC1BUF"
How can I fix this? Thanks.