• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

IC1IF register not recognized by XC8 compiler

Status
Not open for further replies.

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.

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.
 

NorthGuy

Well-Known Member
There's no IC1BUF on this chip. Perhaps CAP1BUF is what you're looking for.

You also need to set up a timer you wish to capture.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top