XC8错误未定义的符号

时间:2016-05-02 09:21:35

标签: c timer microchip xc8

我已经完成了已经提出的问题,但似乎无法找到与之相关的问题。

我正在尝试使用PIC18F8722上的定时器中断并继续发出错误:

:: advisory: (1233) Employing 18F8722 errata work-arounds:
:: advisory: (1234)  * Corrupted fast interrupt shadow registers
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: (500) undefined symbols:
_ReadTimer0(dist/default/production\ultrasound.X.production.obj)       _OpenTimer0(dist/default/production\ultrasound.X.production.obj) _CloseTimer0  (dist/default/production\ultrasound.X.production.obj) 
nbproject/Makefile-default.mk:135: recipe for target 'dist/default/production/ultrasound.X.production.hex' failed
make[2]: Leaving directory 'C:/Users/MPLABXProjects/ultrasound.X'
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/MPLABXProjects/ultrasound.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
(908) exit status = 1
make[2]: *** [dist/default/production/ultrasound.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED(退出值2,总时间:1秒)

不确定是什么原因导致它没有给出明确的解决方案,并且它在我编写的第二个程序上运行pwm完全正常,该程序在同一系统上使用相同的计时器和编译器。

非常感谢任何帮助。这是代码

#include "p18f8722.h"
#include <stdio.h>
#include <stdlib.h>
#include <timers.h>
#include <delays.h>

/*
 * 
 */
int z,b=0;signed char val=0;

void interrupt time(){
    if(INTCONbits.INT0IF){
        INTCONbits.INT0IF=0;
        z = ReadTimer0();
        CloseTimer0();
        b = 1;
    }
}

void en_int(){
    INTCONbits.GIE = 1;
    INTCONbits.PEIE = 1;
    INTCONbits.INT0IE = 1;
    INTCON2bits.INTEDG0 = 1;
}

void con_timer(){
    OpenTimer0(TIMER_INT_OFF & T0_16BIT & T0_SOURCE_INT & T0_PS_1_8);
}

void main(void){
    ADCON1 = 0x0F;
    TRISBbits.RB0 = 1;
    TRISF = 0x00;
    TRISA = 0x00;
    LATAbits.LATA4 = 1;
    en_int();
    while(1){
        LATAbits.LATA2 = 0;
        Delay1TCYx(5);
        LATAbits.LATA2 = 1;
        Delay1TCYx(25);
        LATAbits.LATA2 = 0;
        con_timer();
        while(!b);
        b = 0;
        val = (char)(z/58.3);
        LATF = val;
    }
}

0 个答案:

没有答案