Microchip
直播中

周棠亨

7年用户 1047经验值
擅长:可编程逻辑 电源/新能源
私信 关注
[问答]

为什么我收到了这些错误?

我收到了几个警告:(520)函数“……”从来没有被称为错误。下面是我的代码。谁能告诉我哪里出了问题?这里是我收到的错误:::warning:(1273)Free modeLCDVoltmeter.c:23:warning:(520)function“_DelayFor18TCY”从不被调用LCDVoltmeter.c:33:warning:(520)function“_DelayPORXLCD”从不被调用LCDVoltmeter.c:39:warning:(520)function“_DelayFor18TCY”。“ayXLCD”从未被称作:0:错误:(500)未定义的符号:_SetDDRamAddr(dist/default/./LCDVoltmeter.X...obj)_WriteCmdXLCD(dist/default/./LCDVoltmeter.X...obj)_ReadADC(dist/default/./LCDVoltmeter.X...obj)_OpenADC(dist/default/./LCDVololPUTYADC(DIST/Deal/Deult/LCDValMig.x.Outual.Objo)PUTRSXLCD(DIST/Deal/Deult/LCDValMex.x.Outual.Obj.x).XXLCD(DIST/Deult/Deult/LCDValMex.x.Outual.Obj.)BuxYLCD(DIST/Deal/Studio/LCDValMex.x.Deal.Obj.PoxxLCD)(DIST)/默认/生产/ LCDValt.xOut.Obj.O.SelChhanValdC(DIST/Deult/Deult/LCDValMex.x.Sudio.Obj.)(908)退出状态=1nbPosi/MaFaCuff.DEFA.MK:125:目标“DIST/Deule/Deule/LCDValMex.x.Engult.HEX”FultDead [2 ]的配方:离开目录'/home /史提夫/mPLABXProjects/LCDVoltmeter.X'nbproject/Makefile-default.mk:84:target'.build-conf'failedmake的配方[1]:Leaving directory'/home/steve/MPLABXProjects/LCDVoltmeter.X'nbproject/Makefile-impl.mk:39:target'.build-impl'failedmake的配方[2]:***[dist/default/./LCDVoltmeter.X.produc.produc.error 1make[1]: ***[.build-conf]Error 2make: ***[.build-impl]Error 2BUILD FAILED(退出值2,总时间:2s)谢谢。

以上来自于百度翻译


      以下为原文

    I'm receiving several warning: (520) function ".............." is never called errors.

Below is my code. Can anyone tell me where I'm going wrong?

#include
#include
#include
#include
#include
#include
#pragma config MCLRE = EXTMCLR, WDTEN = OFF, FOSC = HSHP
#define _XTAL_FREQ 8000000

void Delay_Seconds(unsigned char s)
{
    unsigned char i,j;
   
    for(j=0;j     {
        for(i=0;i<100;i++)__delay_ms(10);
    }
   
}

void DelayFor18TCY(void)
{
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();Nop();Nop();
Nop();Nop();
return;
}


void DelayPORXLCD(void)
{
  __delay_ms(15);
return;
}

void DelayXLCD(void)
{
__delay_ms(5);
  return;
}

void LCD_Clear()
{
    while(BusyXLCD());
    WriteCmdXLCD(0x01);
}

void LCD_Move(unsigned char row, unsigned char column)
{
    char ddaddr = 40*(row - 1)+ column;
    while(BusyXLCD());
    SetDDRamAddr( ddaddr );
}

void main()
{
    unsigned long Vin, mV;
    char op[10];
   
    ANSELB = 0; //Configure port B as digital
    ANSELA = 1; //Configure port A out analog
    TRISB = 0; //Configure port b as output
    TRISA = 1; //Configure port A as input
   
    Delay_Seconds(1);
    OpenXLCD(FOUR_BIT & LINES_5X7);
   
    OpenADC(ADC_FOSC_2 & ADC_RIGHT_JUST & ADC_20_TAD,
            ADC_CH0 & ADC_INT_OFF,
            ADC_TRIG_CTMU & ADC_REF_VDD_VDD & ADC_REF_VDD_VSS);
   
    while(BusyXLCD()); //Wait if LCD is busy
    WriteCmdXLCD(DON); //Turn display on
    while(BusyXLCD()); //wAIT IF LCD IS BUSY
    WriteCmdXLCD(0x06); //Move cursor right
    putrsXLCD("VOLTMETER"); //Display heading
    Delay_Seconds(2);
    LCD_Clear();
   
    for(;;)
    {
        LCD_Clear();
        SelChanConvADC(ADC_CH0);
        while(BusyADC());
        Vin = ReadADC();
        mV = (Vin * 5000)>>10;
        LCD_Move(1,1);
        putrsXLCD("mV = ");
        mV = (Vin * 5000)>>10;
        itoa(op,mV,10);
        
        LCD_Move(1,6);
        putsXLCD(op);
        Delay_Seconds(1);
    }
}

Here are the errors I receive:


:: warning: (1273) Omniscient Code Generation not available in Free mode
LCDVoltmeter.c:23: warning: (520) function "_DelayFor18TCY" is never called
LCDVoltmeter.c:33: warning: (520) function "_DelayPORXLCD" is never called
LCDVoltmeter.c:39: warning: (520) function "_DelayXLCD" is never called
:0: error: (500) undefined symbols:
_SetDDRamAddr(dist/default/production/LCDVoltmeter.X.production.obj) _WriteCmdXLCD(dist/default/production/LCDVoltmeter.X.production.obj) _ReadADC(dist/default/production/LCDVoltmeter.X.production.obj) _OpenADC(dist/default/production/LCDVoltmeter.X.production.obj) _BusyADC(dist/default/production/LCDVoltmeter.X.production.obj) _putrsXLCD(dist/default/production/LCDVoltmeter.X.production.obj) _OpenXLCD(dist/default/production/LCDVoltmeter.X.production.obj) _BusyXLCD(dist/default/production/LCDVoltmeter.X.production.obj) _putsXLCD(dist/default/production/LCDVoltmeter.X.production.obj) _SelChanConvADC(dist/default/production/LCDVoltmeter.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:125: recipe for target 'dist/default/production/LCDVoltmeter.X.production.hex' failed
make[2]: Leaving directory '/home/steve/MPLABXProjects/LCDVoltmeter.X'
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory '/home/steve/MPLABXProjects/LCDVoltmeter.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/LCDVoltmeter.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)


Thank you.

回帖(2)

tijing忽忽

2019-7-19 13:58:18
你使用的是XC8编译器的版本?你安装了周边图书馆吗?(它是XC8新版本中的单独下载)。您正在使用库中的函数,所以如果没有安装,就会发生这种情况。还要确保您已经选择在项目属性的编译器选项中使用外围库。

以上来自于百度翻译


      以下为原文

    What version of XC8 compiler are you using? Do you have the peripheral libraries installed? (it is a separate download in newer versions of XC8). You are using functions from the library so if it is not installed then this is what happens.
 
Also make sure you have selected to use the peripheral libraries in the compiler options of the project properties.
举报

李明

2019-7-19 14:12:24
谢谢您。我忘了在外围图书馆打勾链接。感谢你的帮助。史提夫

以上来自于百度翻译


      以下为原文

    Thank you. I had forgot to tick 'Link in peripheral libraries'.
 
Appreciate the help.
 
Steve
举报

更多回帖

发帖
×
20
完善资料,
赚取积分