Interrupt
Super Member
- Total Posts : 205
- Reward points : 0
- Joined: 2008/07/06 05:16:55
- Location: Australia
- Status: offline
I can’t get this code to compile/link please assist.
I don’t understand why the symbol «printVal» is undefined??!!
void displayVoltage(void)
{
while(PIR1bits.ADIF == 1) //(wait for conversion to complete )
{
/*varibles*/
unsigned int ADCcovt =0;
unsigned char printVal[6]; //static
unsigned char *ptrPrintVal; //static
ptrPrintVal = &printVal;PIR1bits.ADIF = 0;
ADCcovt = ADRESH<<8; //adc conversion concatenation
ADCcovt = ADCcovt |ADRESL;
itoa (ptrPrintVal, ADCcovt, 10); //change int to char str
lcd_CMD(ClearDisplay);
lcd_WriteString(ptrPrintVal);
__delay_ms(Delay100);}
return;
}
after reading this post (wont let me post it…please take my word I’ve tried to research this error! )
I thought I had it cracked but changing
unsigned char printVal[];
to
unsigned char printVal[6];
didn’t help???
:0: error: (499) undefined symbol:
_printVal(dist/default/productionADC3I2Clcd.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:215: recipe for target 'dist/default/production/ADC3I2Clcd.X.production.hex' failed
make[2]: Leaving directory 'F:/PIC16F1824aug2015/ADC3I2Clcd/ADC3I2Clcd.X'
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed
make[1]: Leaving directory 'F:/PIC16F1824aug2015/ADC3I2Clcd/ADC3I2Clcd.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/ADC3I2Clcd.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2BUILD FAILED (exit value 2, total time: 11s)
post edited by Interrupt — 2015/08/24 18:02:28
cobusve
Super Member
- Total Posts : 495
- Reward points : 0
- Joined: 2012/04/02 16:15:40
- Location: Chandler
- Status: offline
Re: :0: error: (499) undefined symbol:
2015/08/24 18:17:11
(permalink)
Your code cannot compile without a «main» function, so we are guessing here with half of your project.
That said, array identifiers ARE pointers, but the compiler is nice about it so doing ptrPrintVal = &printVal; or doing ptrPrintVal = printVal; is exactly the same thing.
I took your program, added a main which calls this function and commented out all the functions for which you did not supply the code (e.g. lcd_CMD and lcd_WriteString(ptrPrintVal)) and it compiles just fine.
My guess is that you are attempting to access printVal from scope where it is not defined, and that the bug is not in the part of the code which you have posted here.
ric
Super Member
- Total Posts : 35931
- Reward points : 0
- Joined: 2003/11/07 12:41:26
- Location: Australia, Melbourne
- Status: online
Re: :0: error: (499) undefined symbol:
2015/08/24 18:22:47
(permalink)
Interrupt
…
I thought I had it cracked but changingunsigned char printVal[];to
unsigned char printVal[6];didn’t help???
Certainly, not declaring the buffer size would be a bug.
As cobusve stated, we can only guess if you don’t show the complete test code.
That snippet by itself can’t be compiled, and your problem is probably elsewhere.
post edited by ric — 2015/08/24 18:23:52
I also post at: PicForum
To get a useful answer, always state which PIC you are using!
Interrupt
Super Member
- Total Posts : 205
- Reward points : 0
- Joined: 2008/07/06 05:16:55
- Location: Australia
- Status: offline
Re: :0: error: (499) undefined symbol:
2015/08/24 18:32:40
(permalink)
Thanks Guys
I found it! I was trying to split my code into modules and I had a global variables of the same name in on of the header files …..thanks for the assistance!
NKurzman
A Guy on the Net
- Total Posts : 20056
- Reward points : 0
- Joined: 2008/01/16 19:33:48
- Location: 0
- Status: offline
Re: :0: error: (499) undefined symbol:
2015/08/25 07:03:52
(permalink)
You should not be defining variables in header files.
I’m trying to use a globalVar.h to get my main.c cleaner and tidied up.
But I get many errors that me and my colleagues can’t understand or solve.
Would some please be so kind and give me a hint what I could have done wrong?
I’m using MPLAB X IDE 3.60 and MPLAB XC8 for my PIC12F1572.
// main.c
#include "mcc_generated_files/mcc.h"
#include "globalVar.h"
void SDiagnose(sd_state_t SD_STATE);
void main(void)
{
// Initialize the device
SYSTEM_Initialize();
INTERRUPT_GlobalInterruptEnable();
INTERRUPT_PeripheralInterruptEnable();
while (1)
{
if (gFlag_SDAktiv) // Selbstdiagnose wird alle 180 Sekunden aktiviert
{
switch(gCnt_SD)
{
case 180:
SD_STATE = START;
SDiagnose(SD_STATE); //SD-PIN auf LOW ziehen, Laden starten
break;
case 190:
SD_STATE = STARTMESSEN;
SDiagnose(SD_STATE); //Messung des Wertes während des Ladens und der Rekuperation starten
break;
default:
break;
}
}
}
}
void SDiagnose(sd_state_t SD_STATE)
{
switch(SD_STATE)
{
case START:
PIN_SDIAGNOSE_SetDigitalOutput();
PIN_SDIAGNOSE_SetLow();
break;
case STARTMESSEN:
ADC1_StartConversion();
break;
default:
break;
}
}
//globalVar.h
#include <xc.h> // include processor files - each processor file is guarded.
#ifndef EXTERN
#define EXTERN extern
#endif
typedef enum {START, STOP, STARTMESSEN, MESSEN1, MESSEN2, FREIGEBEN}
sd_state_t;
EXTERN volatile sd_state_t SD_STATE;
EXTERN volatile unsigned char gFlag_AdcReady = 0;
EXTERN volatile unsigned char gFlag_SDAktiv = 0;
EXTERN volatile unsigned char gCnt_SD = 0;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef __cplusplus
}
#endif /* __cplusplus */
//tmr1.c
#include <xc.h>
#include "tmr1.h"
#include "../globalVar.h"
// ...
// MCC-Generated standard code..
// ...
void TMR1_DefaultInterruptHandler(void){
// add your TMR1 interrupt custom code
// or set custom function using TMR1_SetInterruptHandler()
gCnt_SD++;
if (gCnt_SD == 180)
{
gFlag_SDAktiv = 1;
}
#include <xc.h>
#include "adc1.h"
#include "mcc.h"
#include "../globalVar.h"
void ADC1_ISR(void)
{
// Clear the ADC interrupt flag
PIR1bits.ADIF = 0;
gFlag_AdcReady = 1; // Flag setzen, AD-Wandlung abgeschlossen
}
CLEAN SUCCESSFUL (total time: 125ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/AS/Desktop/MPLAB_Projekte/MINIMAL_CO_Sensor_V04.X'
make -f nbproject/Makefile-default.mk dist/default/production/MINIMAL_CO_Sensor_V04.X.production.hex
make[2]: Entering directory 'C:/Users/AS/Desktop/MPLAB_Projekte/MINIMAL_CO_Sensor_V04.X'
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/mcc_generated_files/mcc.p1 mcc_generated_files/mcc.c
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/mcc_generated_files/interrupt_manager.p1 mcc_generated_files/interrupt_manager.c
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/mcc_generated_files/pin_manager.p1 mcc_generated_files/pin_manager.c
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/mcc_generated_files/tmr0.p1 mcc_generated_files/tmr0.c
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/mcc_generated_files/tmr1.p1 mcc_generated_files/tmr1.c
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/main.p1 main.c
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --pass1 --chip=12F1572 -Q -G --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/mcc_generated_files/adc1.p1 mcc_generated_files/adc1.c
mcc_generated_files/../globalVar.h:17: warning: (339) initializer in extern declaration
mcc_generated_files/../globalVar.h:19: warning: (339) initializer in extern declaration
mcc_generated_files/../globalVar.h:21: warning: (339) initializer in extern declaration
globalVar.h:17: warning: (339) initializer in extern declaration
globalVar.h:19: warning: (339) initializer in extern declaration
mcc_generated_files/tmr1.c:87: warning: (373) implicit signed to unsigned conversion
globalVar.h:21: warning: (339) initializer in extern declaration
mcc_generated_files/tmr1.c:96: warning: (2030) a data pointer cannot be used to hold the address of a function
pointer to function with no arguments returning void -> pointer to void
mcc_generated_files/tmr1.c:118: warning: (373) implicit signed to unsigned conversion
mcc_generated_files/tmr1.c:179: warning: (2029) a function pointer cannot be used to hold the address of data
pointer to void -> pointer to function with no arguments returning void
mcc_generated_files/../globalVar.h:17: warning: (339) initializer in extern declaration
mcc_generated_files/../globalVar.h:19: warning: (339) initializer in extern declaration
mcc_generated_files/../globalVar.h:21: warning: (339) initializer in extern declaration
mcc_generated_files/adc1.c:113: warning: (373) implicit signed to unsigned conversion
mcc_generated_files/adc1.c:119: warning: (373) implicit signed to unsigned conversion
mcc_generated_files/adc1.c:140: warning: (373) implicit signed to unsigned conversion
mcc_generated_files/../globalVar.h:17: warning: (339) initializer in extern declaration
mcc_generated_files/../globalVar.h:19: warning: (339) initializer in extern declaration
mcc_generated_files/../globalVar.h:21: warning: (339) initializer in extern declaration
mcc_generated_files/tmr0.c:75: warning: (373) implicit signed to unsigned conversion
mcc_generated_files/tmr0.c:90: warning: (2030) a data pointer cannot be used to hold the address of a function
pointer to function with no arguments returning void -> pointer to void
mcc_generated_files/tmr0.c:133: warning: (2029) a function pointer cannot be used to hold the address of data
pointer to void -> pointer to function with no arguments returning void
"C:Program Files (x86)Microchipxc8v1.42binxc8.exe" --chip=12F1572 -G -mdist/default/production/MINIMAL_CO_Sensor_V04.X.production.map --double=24 --float=24 --opt=+asm,+asmfile,-speed,+space,-debug,-local --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" --memorysummary dist/default/production/memoryfile.xml -odist/default/production/MINIMAL_CO_Sensor_V04.X.production.elf build/default/production/mcc_generated_files/adc1.p1 build/default/production/mcc_generated_files/mcc.p1 build/default/production/mcc_generated_files/pin_manager.p1 build/default/production/mcc_generated_files/interrupt_manager.p1 build/default/production/mcc_generated_files/tmr1.p1 build/default/production/mcc_generated_files/tmr0.p1 build/default/production/main.p1
Microchip MPLAB XC8 C Compiler (Free Mode) V1.42
Build date: Apr 12 2017
Part Support Version: 1.42
Copyright (C) 2017 Microchip Technology Inc.
License type: Node Configuration
:: warning: (1273) Omniscient Code Generation not available in Free mode
mcc_generated_files/adc1.c:103: advisory: (1510) non-reentrant function "_ADC1_StartConversion" appears in multiple call graphs and has been duplicated by the compiler
mcc_generated_files/adc1.c:95: warning: (520) function "_ADC1_SelectChannel" is never called
mcc_generated_files/adc1.c:110: warning: (520) function "_ADC1_IsConversionDone" is never called
mcc_generated_files/adc1.c:116: warning: (520) function "_ADC1_GetConversionResult" is never called
mcc_generated_files/adc1.c:122: warning: (520) function "_ADC1_GetConversion" is never called
mcc_generated_files/pin_manager.c:89: warning: (520) function "_PIN_MANAGER_IOC" is never called
mcc_generated_files/tmr1.c:108: warning: (520) function "_TMR1_StopTimer" is never called
mcc_generated_files/tmr1.c:114: warning: (520) function "_TMR1_ReadTimer" is never called
mcc_generated_files/tmr1.c:123: warning: (520) function "_TMR1_WriteTimer" is never called
mcc_generated_files/tmr1.c:145: warning: (520) function "_TMR1_Reload" is never called
mcc_generated_files/tmr1.c:152: warning: (520) function "_TMR1_StartSinglePulseAcquisition" is never called
mcc_generated_files/tmr1.c:157: warning: (520) function "_TMR1_CheckGateValueStatus" is never called
mcc_generated_files/tmr0.c:94: warning: (520) function "_TMR0_ReadTimer" is never called
mcc_generated_files/tmr0.c:103: warning: (520) function "_TMR0_WriteTimer" is never called
mcc_generated_files/tmr0.c:109: warning: (520) function "_TMR0_Reload" is never called
Non line specific message:: warning: (2028) external declaration for identifier "_SD_STATE" doesn't indicate storage location
:0: error: (499) undefined symbol:
_SD_STATE(dist/default/productionMINIMAL_CO_Sensor_V04.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:227: recipe for target 'dist/default/production/MINIMAL_CO_Sensor_V04.X.production.hex' failed
make[2]: Leaving directory 'C:/Users/AS/Desktop/MPLAB_Projekte/MINIMAL_CO_Sensor_V04.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/AS/Desktop/MPLAB_Projekte/MINIMAL_CO_Sensor_V04.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/MINIMAL_CO_Sensor_V04.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 3s)
I hope, you can help me!
Thanks in advance!
Добрый день.
Задача.
Имею заведомо работающую программу, которую нужно залить в пик 874.
Имею небольшой опыт работы с MPLAB и программирования, пользовался MPLAB IDE v8.56.
Попробовал использовать эту программу для моей задачи — получил много ошибок в синтаксисе, сидел исправлял всё подряд — всё равно ничего не скомпилил.
Тогда обратил внимание на коментарии к моей программе, а они следующие:
* Generation Information :
* Device : PIC16F874A
* Compiler : XC8 v1.38
* MPLAB : MPLAB X IDE v3.26
То есть я использовал не тот компилятор и программу. Хорошо.
Установил xc8-v1.45 и MPLAB X IDE v4.15. Но и тут ничего не взлетело:(
Пишет:
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: (499) undefined symbol:
_slowCircleProc(dist/default/productionw1824ssa.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:131: recipe for target ‘dist/default/production/w1824ssa.X.production.hex’ failed
make[2]: Leaving directory ‘C:/project/W1824SSA/MPLABX/w1824ssa.X’
nbproject/Makefile-default.mk:90: recipe for target ‘.build-conf’ failed
make[1]: Leaving directory ‘C:/project/W1824SSA/MPLABX/w1824ssa.X’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failed
make[2]: *** [dist/default/production/w1824ssa.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 752ms)
Я не могу понять, что он от меня хочет. Есть идеи?
Заранее спасибо.
First of all let me say: awesome to have this project and give newbies a got starting point for XC8 in combination with fatfs, I was so happy to find this porject!
Unfortunately I have an issue with the code.
When follwoing your video tutorial step by step (even chose the exact same PIC model), I have an issue compiling the project.
:0: error: (499) undefined symbol: _SPI_Open(dist/default/production/Test.X.production.obj)
I am using the following IDE and Compiler Verisons:
Product Version: MPLAB X IDE v3.30
Java: 1.8.0_65; Java HotSpot(TM) 64-Bit Server VM 25.65-b01
Runtime: Java(TM) SE Runtime Environment 1.8.0_65-b17
System: Mac OS X version 10.11.4 running on x86_64; UTF-8; en_EN
XC-8 Compiler in Verison 1.37
In the Tutorial was one step which I could not do, which is the part where you change the SPI Port to be used to 0, since this line does not exist in the diskio.c file in the git repo.
Any ideas how to fix this issue?
Here is the full stack:
`make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory ‘/Users/someuser/MPLABXProjects/Test.X’
make -f nbproject/Makefile-default.mk dist/default/production/Test.X.production.hex
make[2]: Entering directory ‘/Users/someuser/MPLABXProjects/Test.X’
«/Applications/microchip/xc8/v1.37/bin/xc8» —chip=18F25K20 -G -mdist/default/production/Test.X.production.map —double=24 —float=24 —emi=wordwrite —opt=default,+asm,+asmfile,-speed,+space,-debug —addrqual=ignore —mode=free -P -N255 —warn=-3 —asmlist —summary=default,-psect,-class,+mem,-hex,-file —output=default,-inhx032 —runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib —output=-mcof,+elf:multilocs —stack=compiled:auto:auto:auto «—errformat=%f:%l: error: (%n) %s» «—warnformat=%f:%l: warning: (%n) %s» «—msgformat=%f:%l: advisory: (%n) %s» —memorysummary dist/default/production/memoryfile.xml -odist/default/production/Test.X.production.elf build/default/production/mcc_generated_files/spi.p1 build/default/production/mcc_generated_files/mcc.p1 build/default/production/mcc_generated_files/pin_manager.p1 build/default/production/main.p1 build/default/production/_ext/1307105986/diskio.p1 build/default/production/_ext/1307105986/ff.p1
Microchip MPLAB XC8 C Compiler (Free Mode) V1.37
Build date: Mar 10 2016
Part Support Version: 1.37
Copyright (C) 2016 Microchip Technology Inc.
License type: Node Configuration
:: advisory: (1233) Employing 18F25K20 errata work-arounds:
:: advisory: (1234) * No stopping on H/W breakpoints after NOP2
:: warning: (1273) Omniscient Code Generation not available in Free mode
mcc_generated_files/spi.c:91: warning: (520) function «_SPI_Exchange8bitBuffer» is never called
mcc_generated_files/spi.c:130: warning: (520) function «_SPI_IsBufferFull» is never called
mcc_generated_files/spi.c:135: warning: (520) function «_SPI_HasWriteCollisionOccured» is never called
mcc_generated_files/spi.c:140: warning: (520) function «_SPI_ClearWriteCollisionStatus» is never called
mcc_generated_files/pin_manager.c:68: warning: (520) function «_PIN_MANAGER_IOC» is never called
/Users/someuser/MPLABXProjects/Test.X/ff.c:2590: warning: (520) function «_f_read» is never called
mcc_generated_files/spi.c:107: warning: (1498) pointer (SPI_Exchange8bitBuffer@dataOut) in expression may have no targets
mcc_generated_files/spi.c:119: warning: (1498) pointer (SPI_Exchange8bitBuffer@dataOut) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/diskio.c:219: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:220: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:221: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:222: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:223: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:332: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:353: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:395: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:434: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:484: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:486: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:497: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:505: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:528: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:836: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:846: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:852: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:890: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:894: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:899: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:906: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:907: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:914: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:1257: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:1258: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2029: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2130: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2243: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2265: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2233: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2247: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2266: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2474: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2505: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2612: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2617: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2645: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2669: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2674: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2603: warning: (1498) pointer (f_read@br) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2629: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2630: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2631: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2634: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2641: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2667: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2673: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2615: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2718: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2760: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2787: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2792: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2842: warning: (752) conversion to shorter data type
:0: error: (499) undefined symbol:
_SPI_Open(dist/default/production/Test.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:205: recipe for target ‘dist/default/production/Test.X.production.hex’ failed
make[2]: Leaving directory ‘/Users/someuser/MPLABXProjects/Test.X’
nbproject/Makefile-default.mk:84: recipe for target ‘.build-conf’ failed
make[1]: Leaving directory ‘/Users/someuser/MPLABXProjects/Test.X’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failed
make[2]: *** [dist/default/production/Test.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 9s)`
Receiving “undefined symbols” error with XC8 concerning plib I2C functions on PIC18
I’ve been trying to resolve an issue all evening and I just can’t seem to get through to it. I have a problem very similar to this one : Receiving «undefined symbols» error with XC8 concerning plib I2C functions
The thing is, the recommended action for the previous post was to change to a PIC18 in order to resolve the problem. I’m already working with a PIC18!
My setup is as follows:
MPLAB: Product Version: MPLAB X IDE v3.50 Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b14 Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b14 System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (mplab)
XC8: Version 1.40
Also installed : peripheral-libraries-for-pic18-v2.00rc3-windows-installer.exe
Here is the «offending code». note that this does not generate any errors in my main.c file (no functions underlined in red). At first the I2C functions were underlined in red, but when I added the #define I2C_V1 at the beginning of my code, that worked itself out. however I do keep getting the following error :
:0: error: (499) undefined symbol: _OpenI2C(dist/default/productionLab2.X.production.obj)
And here is the log (verbose) :
I have checked the «Link in peripheral library» box in the linker options. Also, in case it got lost in the whole log somewhere, there’s the following warning that I’m getting :
I’ve looked into it but couldn’t find any information as to what I might be missing/doing wrong.
As for a little extra context, I’m teaching a course on microprocessors and PIC programming and I’m picking up everything from someone else who was giving the course last year. Apparently the I2C module worked last year. I’m checking with my colleague to see what’s changed since then. Maybe the compiler version.
Come to think of it, I didn’t restart my computer after I installed the library. don’t think it should make a difference but I’ll try anyways.
Источник
Compiler Issue / undefined symbol [XC8] #1
Comments
pkerspe commented Jun 1, 2016 •
First of all let me say: awesome to have this project and give newbies a got starting point for XC8 in combination with fatfs, I was so happy to find this porject!
Unfortunately I have an issue with the code.
When follwoing your video tutorial step by step (even chose the exact same PIC model), I have an issue compiling the project.
:0: error: (499) undefined symbol: _SPI_Open(dist/default/production/Test.X.production.obj)
I am using the following IDE and Compiler Verisons:
Product Version: MPLAB X IDE v3.30
Java: 1.8.0_65; Java HotSpot(TM) 64-Bit Server VM 25.65-b01
Runtime: Java(TM) SE Runtime Environment 1.8.0_65-b17
System: Mac OS X version 10.11.4 running on x86_64; UTF-8; en_EN
XC-8 Compiler in Verison 1.37
In the Tutorial was one step which I could not do, which is the part where you change the SPI Port to be used to 0, since this line does not exist in the diskio.c file in the git repo.
Any ideas how to fix this issue?
Here is the full stack:
`make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory ‘/Users/someuser/MPLABXProjects/Test.X’
make -f nbproject/Makefile-default.mk dist/default/production/Test.X.production.hex
make[2]: Entering directory ‘/Users/someuser/MPLABXProjects/Test.X’
«/Applications/microchip/xc8/v1.37/bin/xc8» —chip=18F25K20 -G -mdist/default/production/Test.X.production.map —double=24 —float=24 —emi=wordwrite —opt=default,+asm,+asmfile,-speed,+space,-debug —addrqual=ignore —mode=free -P -N255 —warn=-3 —asmlist —summary=default,-psect,-class,+mem,-hex,-file —output=default,-inhx032 —runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib —output=-mcof,+elf:multilocs —stack=compiled:auto:auto:auto «—errformat=%f:%l: error: (%n) %s» «—warnformat=%f:%l: warning: (%n) %s» «—msgformat=%f:%l: advisory: (%n) %s» —memorysummary dist/default/production/memoryfile.xml -odist/default/production/Test.X.production.elf build/default/production/mcc_generated_files/spi.p1 build/default/production/mcc_generated_files/mcc.p1 build/default/production/mcc_generated_files/pin_manager.p1 build/default/production/main.p1 build/default/production/_ext/1307105986/diskio.p1 build/default/production/_ext/1307105986/ff.p1
Microchip MPLAB XC8 C Compiler (Free Mode) V1.37
Build date: Mar 10 2016
Part Support Version: 1.37
Copyright (C) 2016 Microchip Technology Inc.
License type: Node Configuration
:: advisory: (1233) Employing 18F25K20 errata work-arounds:
:: advisory: (1234) * No stopping on H/W breakpoints after NOP2
:: warning: (1273) Omniscient Code Generation not available in Free mode
mcc_generated_files/spi.c:91: warning: (520) function «_SPI_Exchange8bitBuffer» is never called
mcc_generated_files/spi.c:130: warning: (520) function «_SPI_IsBufferFull» is never called
mcc_generated_files/spi.c:135: warning: (520) function «_SPI_HasWriteCollisionOccured» is never called
mcc_generated_files/spi.c:140: warning: (520) function «_SPI_ClearWriteCollisionStatus» is never called
mcc_generated_files/pin_manager.c:68: warning: (520) function «_PIN_MANAGER_IOC» is never called
/Users/someuser/MPLABXProjects/Test.X/ff.c:2590: warning: (520) function «_f_read» is never called
mcc_generated_files/spi.c:107: warning: (1498) pointer (SPI_Exchange8bitBuffer@dataOut) in expression may have no targets
mcc_generated_files/spi.c:119: warning: (1498) pointer (SPI_Exchange8bitBuffer@dataOut) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/diskio.c:219: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:220: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:221: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:222: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:223: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:332: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:353: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:395: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:434: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:484: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:486: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:497: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/diskio.c:505: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:528: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:836: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:846: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:852: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:890: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:894: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:899: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:906: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:907: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:914: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:1257: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:1258: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2029: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2130: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2243: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2265: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2233: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2247: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2266: warning: (759) expression generates no code
/Users/someuser/MPLABXProjects/Test.X/ff.c:2474: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2505: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2612: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2617: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2645: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2669: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2674: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2603: warning: (1498) pointer (f_read@br) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2629: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2630: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2631: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2634: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2641: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2667: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2673: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2615: warning: (1498) pointer (f_read@fp) in expression may have no targets
/Users/someuser/MPLABXProjects/Test.X/ff.c:2718: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2760: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2787: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2792: warning: (752) conversion to shorter data type
/Users/someuser/MPLABXProjects/Test.X/ff.c:2842: warning: (752) conversion to shorter data type
:0: error: (499) undefined symbol:
_SPI_Open(dist/default/production/Test.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:205: recipe for target ‘dist/default/production/Test.X.production.hex’ failed
make[2]: Leaving directory ‘/Users/someuser/MPLABXProjects/Test.X’
nbproject/Makefile-default.mk:84: recipe for target ‘.build-conf’ failed
make[1]: Leaving directory ‘/Users/someuser/MPLABXProjects/Test.X’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failed
make[2]: *** [dist/default/production/Test.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 9s)`
The text was updated successfully, but these errors were encountered:
Источник
0 error 499 undefined symbol
Добрый день.
Задача.
Имею заведомо работающую программу, которую нужно залить в пик 874.
Имею небольшой опыт работы с MPLAB и программирования, пользовался MPLAB IDE v8.56.
Попробовал использовать эту программу для моей задачи — получил много ошибок в синтаксисе, сидел исправлял всё подряд — всё равно ничего не скомпилил.
Тогда обратил внимание на коментарии к моей программе, а они следующие:
* Generation Information :
* Device : PIC16F874A
* Compiler : XC8 v1.38
* MPLAB : MPLAB X IDE v3.26
То есть я использовал не тот компилятор и программу. Хорошо.
Установил xc8-v1.45 и MPLAB X IDE v4.15. Но и тут ничего не взлетело:(
Пишет:
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: (499) undefined symbol:
_slowCircleProc(dist/default/productionw1824ssa.X.production.obj)
(908) exit status = 1
nbproject/Makefile-default.mk:131: recipe for target ‘dist/default/production/w1824ssa.X.production.hex’ failed
make[2]: Leaving directory ‘C:/project/W1824SSA/MPLABX/w1824ssa.X’
nbproject/Makefile-default.mk:90: recipe for target ‘.build-conf’ failed
make[1]: Leaving directory ‘C:/project/W1824SSA/MPLABX/w1824ssa.X’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failed
make[2]: *** [dist/default/production/w1824ssa.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 752ms)
Я не могу понять, что он от меня хочет. Есть идеи?
Заранее спасибо.
Реклама |
driver_gv |
|||||||||||||||||||||||||||||||||||||||||
Карма: 11 |
|
Нужна помощь в программировании
-
Ответить
-
Создать новую тему
- Назад
- 1
- 2
- 3
- Далее
- Страница 1 из 3
Рекомендуемые сообщения
-
- Поделиться
Добрый день. Прошу помочь разобраться с PIC12F629. Работаю в MPLAB 8.30, язык СИ. Хочу с GP0 и GP1 получить сигнал в противофазе , частотой 1 кГц. Но что- то пишу не так. Выдает Ошибки. Направляю проект для анализа.
Вот прога в файле .с: #include <pic.h> __CONFIG(0x03FFF); PORTGP=0xFF; DDRGP=0xFF; Int i=0; void main(void) { while (1) { { int n; { n=0; m1; // Частота 1кГц. PORTGP.0 = 1; PORTGP.1 = 0; delay_us(500); //Задержка в мкс. PORTGP.0=0; PORTGP.1 = 1; delay_us(500); //Задержка в мкс. n++; if (n<5000) goto m1; }
Pro3.rar
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
Ответов
68 -
Создана
3 г -
Последний ответ
3 г
Топ авторов темы
-
13
-
15
-
5
-
29
Изображения в теме
-
- Поделиться
12 минуты назад, Starina48 сказал:
Выдает Ошибки
Тут экстрасенсов нет. Показывайте.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Выдаваемые ошибки:
Build C:Program FilesMicrochipRaboch SIPro3Pro3 for device 12F629
Using driver C:Program FilesHI-TECH SoftwarePICCPRO9.60binpicc.exe
Make: The target "C:Program FilesMicrochipRaboch SIPro3Pro3.p1" is up to date.
Executing: "C:Program FilesHI-TECH SoftwarePICCPRO9.60binpicc.exe" -oPro3.cof -mPro3.map --summary=default --output=default Pro3.p1 --chip=12F629 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C PRO for the PIC10/12/16 MCU family (Lite) V9.60PL5
Copyright (C) 1984-2009 HI-TECH SOFTWARE
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [499] ; 0. undefined symbol:
_main(startup.obj)
********** Build failed! **********
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
LIMF – источники питания High-End от MORNSUN со стандартным функционалом на DIN-рейку
На склад Компэл поступили ИП MORNSUN (крепление на DIN-рейку) с выходной мощностью 240 и 480 Вт. Данные источники питания обладают 150% перегрузочной способностью, активной схемой коррекции коэффициента мощности (ККМ; PFC), наличием сухого контакта реле для контроля работоспособности (DC OK) и возможностью подстройки выходного напряжения. Источники питания выполнены в металлическом корпусе, ПП с компонентами покрыта лаком с двух сторон, что делает ее устойчивой к соляному туману и пыли. Изделия соответствуют требованиям ANSI/ISA 71.04-2013 G3 на устойчивость к коррозии, а также нормам ATEX для взрывоопасных зон.
Подробнее>>
-
- Поделиться
Выкиньте HI-TECH на свалку и поставьте XC8 от Микрочипа. Стандартной (халявной) лицензии Вам хватит за глаза.
HI-TECH — динозвар, им уже никто не пользуется.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
Выгодные LED-драйверы для решения любых задач
КОМПЭЛ представляет со склада и под заказ широкий выбор LED-драйверов производства MEAN WELL, MOSO, Snappy, Inventronics, EagleRise. Линейки LED-драйверов этих компаний, выполненные по технологии Tunable White и имеющие возможность непосредственного встраивания в систему умного дома (димминг по шине KNX), перекрывают практически полный спектр применений: от простых световых указателей и декоративной подсветки до диммируемых по различным протоколам светильников внутреннего и наружного освещения.
Подобрать LED-драйвер>>
- Автор
-
- Поделиться
Меня интересует , как исправить мою ошибку с 12 пиком, а XC8 — это обновление для наборов инструментов PICC и PICC18 пока меня не интересует. Возможно со временем и поменяю. А пока люди и с HI работают. Вы лучше подскажите, где у меня ошибка?
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
ER10450 – литий-тионилхлоридная батарейка FANSO EVE Energy формата ААА
Компания FANSO EVE Energy расширила номенклатуру продукции, разработав новый химический источник тока (ХИТ) – батарейку литий-тионилхлоридной электрохимической системы (Li-SOCl2; номинальное напряжение 3,6 В) типоразмера ААА – ER10450. Батарейка имеет бобинную конструкцию (тип Energy) и предназначена для долговременной работы при малых токах.
Батарейка может применяться в приборах учета ресурсов, в различных датчиках, устройствах IoT и в других приборах и устройствах, в которых требуется компактный ХИТ соответствующей емкости.
Подробнее >>
-
- Поделиться
Вот у вас ошибка :
2 часа назад, Starina48 сказал:
Error [499] ; 0. undefined symbol: _main(startup.obj)
Линкер не находит функцию main.
В чём ошибка — хз. Вариантов 100500. По этому я и посоветовал сменить компилятор. Его поменять — 10 минут. И всё у Вас запустится. Причём, помощи будет гораздо больше, чем с hi-tech.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Реклама
-
- Поделиться
45 минут назад, Starina48 сказал:
где у меня ошибка?
1.не совпадает кол-во открытых и закрытых скобок
2. данных типа Int , в си не существует если вы конечно не определили его сами, есть int !
3.
2 часа назад, Starina48 сказал:
m1;
что это?
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
3 часа назад, Starina48 сказал:
m1;
Тогда поставить двоеточие.
- Цитата
Я не раздаю удочки. Я продаю рыбу.
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
#include <htc.h> //подключим файл заголовков HI-TECH PICC
#define _XTAL_FREQ 4000000 // частота генератора в Гц
//слово конфигурации микроконтроллера
__CONFIG ( CPD & PROTECT & BOREN & MCLRDIS & PWRTEN & WDTDIS & INTIO);
void main (void)
{
INTCON=0;
CMCON=0b00000111;
TRISIO=0x00;//
GPIO=0;
while(1)
{
GP0=1;
GP1=0;
__delay_us(500); //Задержка в мкс.
GP0=0;
GP1=1;
__delay_us(500); //Задержка в мкс.
}
}
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Спасибо большое Members. Все принял , кроме GP0 и GP1. Я пытался дописать впереди PORTGP0 , тоже выдает ошибку. Тут наверно двух буквенное обозначение порта прогу смущает.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Прошу прощения — batir74, за ошибку в Нике.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Спасибо UVV. Только правая часть страницы не открывается. Сейчас попробую найти этот файл в инете.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Нашел .rar в инете, тот же эффект. Правая часть справки не открывается.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
попробуй открыть с вот так
галочку сними
Изменено 11 февраля, 2019 пользователем UVV
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Я так и делаю. Правая часть не открывается.
Я так и делаю. Галку снять не подумал даже. Снял все заработало. Спасибо.
Я так и делаю. Галку снять не подумал даже. Снял все заработало. Спасибо.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
для PIC12F629 можно было и асм воспользоватся.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Друзья мои. Я ведь просил ПОМОЩЬ в корректировке программы . Для чего и выложил весь проект. А большинство дает просто советы, то по смене аппаратных средств, то языка программирования, а вопрос не решается. Единственный batir74 предложил свой вариант программы. Спасибо ему за это. Поэтому прошу не обижаться, я всех уважаю, но мне время жалко, все таки уже 70 с хвостиком. Да и голова уже не та , что в 40.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
@Starina48 MPLAB 8.30 на HI-TECH PICC или как там просто не кто не знает и не пользуется.
@Starina48 ждите может кто и зайдёт знающий HI-TECH PICC.
Я когда начинал изучать МК то первым делом начал с HI-TECH PICC но потыкав эту среду понял что уж очень всё замудрённо. Начал искать альтернативу.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
В 10.02.2019 в 21:20, Starina48 сказал:
Все принял , кроме GP0 и GP1.
блин ну детский сад какой-то… открываете папку где у вас лежит хайтек, находите папку include , в ней находите хедер с описанием всех регистров и битов на нужный вам МК. открываете любым текстовым редактором(можете его даже в мплабовский проект добавить) и в у себя в коде ставите нужное обозначение, вангую что название хедера будет что-то типа 12f6x.h
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Автор
-
- Поделиться
Вот теперь ошибок нет. Однако предупреждения не дают запустить проект. Проект 5.rar прикреплен.
5.rar
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
можете его не крипить, вы наверно единственный кто пользует связку мплаб8.30 и хайтек9.60про , первый по причине беззаветной старости , второй из-за глючности. для остальных ваш проект бесполезен.
вангую
1. Error[499] : undefined symbol:
___delay_us (C:Program FilesMicrochipRaboch SI9.8155.obj)
хайтек понятия не имеет що це таке __delay_us(500) пока в заголовке не подключите ему нужный хедер
2. Warning[361] C:Program FilesMicrochipRaboch SI9.8155.c 22 : function declared implicit int
хайтек вас предупреждает что выбранный размер задержки (int) может не соответствует ожиданиям компилятора (unsigned char) и может приведен к нужному путем обрезания выступающих частей.
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
-
- Поделиться
8 часов назад, Starina48 сказал:
А большинство дает просто советы, ……….
@Starina48 , Вы обижайтесь, а просто поверьте — специалист видит наперёд все грабли. По этому Вам и был сразу же, первым постом, совет по смене компилятора. Ибо было очевидно, что ничего, кроме шишек, Вы не добьётесь.
Но нет же, мы не хотим, гордость ….
PS: Хайтеком уже давно никто не пользуется. И шанс получить совет по нему, на этом форуме, стремится к нулю…
- Цитата
Ссылка на комментарий
Поделиться на другие сайты
- Назад
- 1
- 2
- 3
- Далее
- Страница 1 из 3
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже.
Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.
Примечание: Ваш пост будет проверен модератором, прежде чем станет видимым.
-
Последние посетители
0 пользователей онлайн
- Ни одного зарегистрированного пользователя не просматривает данную страницу
-
Сообщения
-
-
Автор
Antonych85 · Опубликовано 7 минут назад
Всем доброго времени суток. Пришёл тут аппарат, то ли музыкальный центр, то ли магнитола. Суть не в этом.
В общем не работает функционал проигрывателя CD-дисков (И открывание-закрывание сдвижной крышки тоже, вообще ничего) и чтения USB/SD флэшек.
Также в наличии проблема со звуком, микросхема усилителя скорее всего живая (Всё равно менял три разных), судя по хлопкам при подключении акустики. Предусилитель менял, все также в левом канале ничего, а в правом негромко подхрипывает музыка.
Усилитель выполнен на м/с TA8207K, пред на TM2313, Управление дисками завязано на SA9259. Центральный процессор — ALI M5673. Конденсатор на питании заменил, т.к. было всего 3900 мкф вместо нужных 4700, остальные в норме.
Куда копнуть дальше, что проверить? нужны подсказки.PS: За аппарат сильно не волнуемся в плане окончательной поломки, отнести к мастеру — засмеёт…
-
-
-
-
Автор
Sukhanov · Опубликовано 19 минут назад
Дурак тот кто не следует правильным советам (ну или он гений, типа он не знает , что так делать нельзя ( или знает (ему об этом сказали более сведующие )), но делает (всё равно делает), и у него получается)!….
Дистрофик, Ваша просьба о помощи здесь, в довольно простом по сути вопросе, равносильна типа если бы я например, на форуме хирургов просил помощи в операции по удалению аппендикса (что для профильного специалиста, тоже не простой, рядовой случай)…
С уважением, Сергей.
-
Автор
ChePay · Опубликовано 25 минут назад
OSC – это выход гетеродина. Используется или для цифровой шкалы или синтезатором частот, чтобы отслеживать частоту настройки.
Vref – опорное напряжение микросхемы. При точной настройке на станцию напряжение AFC совпадает с Vref. При расстройке AFC получается меньше или больше Vref. Можно поставить стрелочный вольтметр с 0 посерединке и получить индикатор точной настройки. Такие раньше популярны были в стационарных тюнерах.
Судя по внутренней схеме LA1140, это же напряжение используется и для БШН. При неточной настройке сигнал приглушается.
-
Skip to main content
Welcome to EDAboard.com
Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals… and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
-
Digital Design and Embedded Programming
-
Microcontrollers
You should upgrade or use an alternative browser.
[PIC] error :undefined symbol
-
Thread starterbeauty world
-
Start dateJun 22, 2015
- Status
- Not open for further replies.
-
#1
- Joined
- Jun 22, 2015
- Messages
- 8
- Helped
- 0
- Reputation
-
0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
-
46
:: warning: (1273) Omniscient Code Generation not available in Free mode
:0: error: (499) undefined symbol:
_DelayFor18TCY(dist/default/productionlcd_voltmeter.X.production.obj)
make[2]: *** [dist/default/production/lcd_voltmeter.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
(908) exit status = 1
nbproject/Makefile-default.mk:119: recipe for target ‘dist/default/production/lcd_voltmeter.X.production.hex’ failed
make[2]: Leaving directory ‘D:/PIC MICRO/my prj/lcd voltmeter/lcd voltmeter.X’
nbproject/Makefile-default.mk:78: recipe for target ‘.build-conf’ failed
make[1]: Leaving directory ‘D:/PIC MICRO/my prj/lcd voltmeter/lcd voltmeter.X’
nbproject/Makefile-impl.mk:39: recipe for target ‘.build-impl’ failedBUILD FAILED (exit value 2, total time: 1s)
what should I do?
Last edited by a moderator: Jun 22, 2015
-
#2
- Joined
- Apr 1, 2013
- Messages
- 2,524
- Helped
- 540
- Reputation
-
1,078
- Reaction score
- 524
- Trophy points
- 1,393
- Activity points
-
0
-
#3
Brian.
-
#4
- Joined
- Jun 22, 2015
- Messages
- 8
- Helped
- 0
- Reputation
-
0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
-
46
-
#5
The error message says it can’t find «DelayFor18TCY()» but the function you have created is:
//this function creat 18cycle delay for xlcd library
void Delay[B][COLOR=#FF0000]f[/COLOR][/B]or18TCY(void){
Delay10TCYx(20);
}
Brian.
-
#6
- Joined
- Jun 22, 2015
- Messages
- 8
- Helped
- 0
- Reputation
-
0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
-
46
ny code is this:
#include<xc.h>
#include<delays.h>
#include<stdlib.h>
#include<xlcd.h>
#include<adc.h>
#define _XTAL_FREQ 8000000
#pragma config MCLRE=EXTMCLR,FOSC=HSHP,WDTEN=OFF
void Delay_second(unsigned char s){
unsigned char i,j;
for(j=0;j<s;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){ //15ms delay
Delay1KTCYx(30);
}
void DelayXLCD(void){ //5ms delay
}
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 char vin,mv;
char op[10];
TRISB=0; //PORT B CONFIGUR AS OUTPUT
TRISAbits.RA0=1; //PIN A0 configure as input
ANSELB=0; //PORT B config as digital
ANSELA=1;
Delay_second(1);
OpenXLCD(FOUR_BIT&&LINE_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 the lcd is busy
WriteCmdXLCD(DON); //desplay lcd on
while( BusyXLCD()); //wait if the lcd is busy
WriteCmdXLCD(0x06);
putrsXLCD("VOLTMETER");
Delay_second(2);
LCD_Clear();
for(;;){
LCD_Clear();
SelChanConvADC(ADC_CH0);
while( BusyXLCD());
vin=ReadADC();
mv=(vin*5000)>>10;
LCD_Move(1,1);
putrsXLCD("mv=");
mv=(vin*5000)>>10;
itoa(op,mv,10);
LCD_Move(1,6);
putrsXLCD(op);
Delay_second(1);
}
}
Last edited by a moderator: Jun 23, 2015
-
#7
-
#8
- Joined
- Jun 22, 2015
- Messages
- 8
- Helped
- 0
- Reputation
-
0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
-
46
the code that I use is this:
[CODE]
#include<xc.h>
#include<delays.h>
#include<stdlib.h>
#include<xlcd.h>
#include<adc.h>
#define _XTAL_FREQ 8000000
#pragma config MCLRE=EXTMCLR,FOSC=HSHP,WDTEN=OFF
void Delay_second(unsigned char s){
unsigned char i,j;
for(j=0;j<s;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){ //15ms delay
Delay1KTCYx(30);
}
void DelayXLCD(void){ //5ms delay
__delay_ms(5);
}
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 char vin,mv;
char op[10];
TRISB=0; //PORT B CONFIGUR AS OUTPUT
TRISAbits.RA0=1; //PIN A0 configure as input
ANSELB=0; //PORT B config as digital
ANSELA=1;
Delay_second(1);
OpenXLCD(FOUR_BIT&&LINE_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 the lcd is busy
WriteCmdXLCD(DON); //desplay lcd on
while( BusyXLCD()); //wait if the lcd is busy
WriteCmdXLCD(0x06);
putrsXLCD("VOLTMETER");
Delay_second(2);
LCD_Clear();
for(;;){
LCD_Clear();
SelChanConvADC(ADC_CH0);
while( BusyXLCD());
vin=ReadADC();
mv=(vin*5000)>>10;
LCD_Move(1,1);
putrsXLCD("mv=");
mv=(vin*5000)>>10;
itoa(op,mv,10);
LCD_Move(1,6);
putrsXLCD(op);
Delay_second(1);
}
}
[/CODE]
-
#9
- Status
- Not open for further replies.
Similar threads
-
Digital Design and Embedded Programming
-
Microcontrollers
-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
I am new to coding in C and I cannot figure out the proper way to link my files together so that I can use code from one class in another. I’m working on a project which will likely become a very long program so I am trying to avoid cluttering my main class with a bunch of functions. Instead, I would like to keep them separate and make it easy to transfer the code into any future project.
From looking up similar issues I am assuming this is somewhat simple and that I am probably struggling so much with it because I’m missing the basics of coding in C.
This is what is shown in the terminal:
> Executing task in folder Led-Pot_Circuit_Test: .Build.cmd 16f887 <
C:Usersraymu_000DocumentsProgrammingVisualStudioCodePIC_C++_on_VSCodeLed-Pot_Circuit_Test>mkdir output-files
A subdirectory or file output-files already exists.
C:Usersraymu_000DocumentsProgrammingVisualStudioCodePIC_C++_on_VSCodeLed-Pot_Circuit_Test>C:Progra~1Microchipxc8v2.32binxc8.exe --chip=16f887 --outdir=".output-files" ".main.c"
C:Progra~1Microchipxc8v2.32picbinpicc --chip=16f887 --outdir=.output-files .main.c
Microchip MPLAB XC8 C Compiler V2.32
Build date: Feb 1 2021
Part Support Version: 2.32
Copyright (C) 2021 Microchip Technology Inc.
License type: Node Configuration
0: (499) undefined symbol:
_adc_convert(output-filesmain.obj)
(908) exit status = 1
(908) exit status = 1
C:Usersraymu_000DocumentsProgrammingVisualStudioCodePIC_C++_on_VSCodeLed-Pot_Circuit_Test>C:Progra~1Microchipxc8v2.32binxc8.exe --chip=16f887 --outdir=".output-files" ".ProjectInitApp.c"
C:Progra~1Microchipxc8v2.32picbinpicc --chip=16f887 --outdir=.output-files .ProjectInitApp.c
Microchip MPLAB XC8 C Compiler V2.32
Build date: Feb 1 2021
Part Support Version: 2.32
Copyright (C) 2021 Microchip Technology Inc.
License type: Node Configuration
Non line specific message: (1091) main function "_main" not defined
(908) exit status = 1
(908) exit status = 1
The terminal process "C:WINDOWSSystem32WindowsPowerShellv1.0powershell.exe -Command .Build.cmd 16f887" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
My main class:
//main.c
// CONFIG1
#pragma config FOSC = INTRC_NOCLKOUT// Oscillator Selection bits (INTOSCIO oscillator: I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // RE3/MCLR pin function select bit (RE3/MCLR pin function is digital input, MCLR internally tied to VDD)
#pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
#pragma config BOREN = OFF // Brown Out Reset Selection bits (BOR disabled)
#pragma config IESO = OFF // Internal External Switchover bit (Internal/External Switchover mode is disabled)
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled)
#pragma config LVP = OFF // Low Voltage Programming Enable bit (RB3 pin has digital I/O, HV on MCLR must be used for programming)
// CONFIG2
#pragma config BOR4V = BOR21V // Brown-out Reset Selection bit (Brown-out Reset set to 2.1V)
#pragma config WRT = OFF // Flash Program Memory Self Write Enable bits (Write protection off)
#define _XTAL_FREQ 8000000 // 8Mhz
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#include <pic16f887.h>
#include "Projectuser.h"
void main(void) {
//InitApp();
unsigned short adc_value; // variable to hold ADC conversion result in/* Configure the oscillator for the device
ANSELbits.ANS0 = 0; // Disable analog on pin RA0
TRISAbits.TRISA0 = 0; // Set pin RA0 as output
while(1) {
PORTAbits.RA0 = 0; // Set RA0 to LOW
// calculate wait time
adc_value = adc_convert(1); // perform A/D conversion using input from channel 1 (AN1)
__delay_ms(500); // Right shift adc_value two spaces to convert to milliseconds
PORTAbits.RA0 = 1; // Set RA0 to HIGH
adc_value = adc_convert(1);
__delay_ms(500);
}
}
This is my attempt at making a library so that I can «easily» transfer some useful code later onto another project:
//user.h
#ifndef USER_H
#define USER_H
void init_adc(void);
unsigned short adc_convert(unsigned char);
#endif
Useful code:
//InitApp.c
#include <xc.h>
#include <pic16f887.h>
#include "user.h"
/*
Initialize the Analog to Digital Converter
*/
void init_adc(void) {
TRISAbits.TRISA1 = 0b1; // Set pin RA1 as Input
//ANCON0bits.ANSEL1 =0b1;
ADCON1bits.VCFG0 = 0; // set v+ reference to Vdd
ADCON1bits.VCFG1 = 0; // set v- reference to Vss (Gnd)
ADCON1bits.ADFM = 1; // right justify the output
ADCON0bits.ADCS = 0b01; // use Fosc/8 for clock source
ADCON0bits.ADON = 1; // turn on the ADC
}
/*
Preform an analog to digital conversion.
@param channel The ADC input channel to use.
@return The value of the conversion.
*/
unsigned short adc_convert(unsigned char channel) {
ADCON0bits.CHS = channel; // select the given channel
ADCON0bits.GO = 1; // start the conversion
while(ADCON0bits.GO_DONE); // wait for the conversion to finish
return(ADRESH<<8)|ADRESL; // return the result
}
Pic for reference:
Here are the contents of the «output-files» Folder, when I run the «Build.cmd» task all the files from the compiler go here, but I am missing a few (like «.hex» file) since the program cannot compile properly.
Do I need to have a main class inside of InitApp.c class?
How does one properly compile and link C files together??
I would appreciate amy help and advice, thanks.
Skip to main content
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.
-
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.
-
Electronics Forums
-
Microcontrollers
You should upgrade or use an alternative browser.
Hi-Tech C Compiler: What am I doing wrong?
-
Thread startermicro571
-
Start dateJun 28, 2009
- Status
- Not open for further replies.
-
#1
I am trying to do an led blink program using the Hi-Tech C Compiler. I have it specified as the tool chain in MPLab.
Here is my code:
#include <pic.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include «delay.h»
//#include «delay.c»
//void delay(void);
//#define _16F877
// __CONFIG(UNPROTECT|BODEN|FOSC1|BKBUG|WRT);
//__CONFIG( XT & WDTDIS & PWRTDIS & BORDIS & LVPDIS & WRTEN & DEBUGDIS & UNPROTECT );
void main (){
ADCON1 =0x06 ; // Changes PORTA to digital
CMCON = 0x07 ; // Disable analog comparators
PORTA = 0x00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
TRISA = 0x00 ; // Configure PORTA as output
TRISB = 0X00 ;
TRISC = 0X00 ;
TRISD = 0X00 ;
TRISE = 0X00 ;
while(1){
PORTA = 0XFF ;
PORTB = 0XFF ;
PORTC = 0XFF ;
PORTD = 0XFF ;
PORTE = 0Xff ;
DelayMs(500);
PORTA = 0X00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
DelayMs(500);
}
}
The code compiles, but nothing happens when I load the hex file.
It’s a simple program. I must be missing something small. Any suggestions?
-
#2
Last edited: Jun 28, 2009
-
#4
#include <htc.h> // Required to interface with delay routines
#ifndef _XTAL_FREQ
// Unless already defined assume 4MHz system frequency
// This definition is required to calibrate __delay_us() and __delay_ms()
#define _XTAL_FREQ 4000000
#endif
void main(void){
ADCON1 =0x06 ; // Changes PORTA to digital
CMCON = 0x07 ; // Disable analog comparators
PORTA = 0x00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
TRISA = 0x00 ; // Configure PORTA as output
TRISB = 0X00 ;
TRISC = 0X00 ;
TRISD = 0X00 ;
TRISE = 0X00 ;
while(1){
PORTA = 0XFF ;
PORTB = 0XFF ;
PORTC = 0XFF ;
PORTD = 0XFF ;
PORTE = 0Xff ;
__delay_ms(100);
PORTA = 0X00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
__delay_ms(100);
}
}
-
#5
As is, the new code produces an error:
Error [499] ; . undefined symbol:
___delay_ms (877.obj)
I’m using the Hi-Tech C compiler, v9.60.
At the top of the delay.h file I was referencing in my code, I had defined:
#define PIC_CLK 20000000
-
#6
#include <pic.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#define _16F877
__CONFIG( HS & WDTDIS & PWRTDIS & BORDIS & LVPDIS & WRTEN & DEBUGDIS & UNPROTECT );
#define XTAL_FREQ 20MHZ
#include "delay.c"
void main (){
ADCON1 =0x06 ; // Changes PORTA to digital
CMCON = 0x07 ; // Disable analog comparators
PORTA = 0x00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
TRISA = 0x00 ; // Configure PORTA as output
TRISB = 0X00 ;
TRISC = 0X00 ;
TRISD = 0X00 ;
TRISE = 0X00 ;
while(1){
PORTA = 0XFF ;
PORTB = 0XFF ;
PORTC = 0XFF ;
PORTD = 0XFF ;
PORTE = 0Xff ;
DelayMs(500);
PORTA = 0X00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
DelayMs(500);
}
}
Mike.
Last edited: Jun 28, 2009
-
#7
I have v9.65 and it wouldn’t build your code
-
#8
Error [482] ; . symbol «_DelayMs_interrupt» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayS» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayMs» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayBigMs» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayBigUs» is defined more than once in «877.obj»
Error [482] ; . symbol «_delayus_variable» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayMs_interrupt» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayS» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayMs» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayBigMs» is defined more than once in «877.obj»
Error [482] ; . symbol «_DelayBigUs» is defined more than once in «877.obj»
Error [482] ; . symbol «_delayus_variable» is defined more than once in «877.obj»
I changed «delay.c» to «delay.h» and compiled…
It worked! I’ve got a blinking led now.
Thanks for your help. I’m guessing it’s the config parameter that did it.
I had tried it with this config earlier:
__CONFIG( XT & WDTDIS & PWRTDIS & BORDIS & LVPDIS & WRTEN & DEBUGDIS & UNPROTECT );
but that didn’t work.
Thanks again for your speedy responses!
Now it’s time to upgrade blinky led program to something more useful.
-
#9
-
#10
14.2.1 OSCILLATOR TYPES
The PIC16F87XA can be operated in four different
oscillator modes. The user can program two configuration
bits (FOSC1 and FOSC0) to select one of these four
modes:
• LP Low-Power Crystal
• XT Crystal/Resonator
• HS High-Speed Crystal/Resonator
• RC Resistor/Capacitor
-
#11
1) you will need to make sure that the fuses are set in a way consistent with your circuit. do you use the internal rc oscillator? for example.
2) I am assuming that the port settings are right. but you typically set TRISA/B… registers before you set the ports.
3) the errors with regarding to delay() is due to the header files.
how about this one?
#include <pic.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "delay.h"
//#include "delay.c" // you may or may not be able to comment out this. depending on what's in delay.h and delay.c
//void delay(void); // it is always a good idea to declare functions explicitly
//#define _16F877
// __CONFIG(UNPROTECT|BODEN|FOSC1|BKBUG|WRT);
//__CONFIG( XT & WDTDIS & PWRTDIS & BORDIS & LVPDIS & WRTEN & DEBUGDIS & UNPROTECT );
void main (){
ADCON1 =0x06 ; // Changes PORTA to digital
CMCON = 0x07 ; // Disable analog comparators
TRISA = 0x00 ; // Configure PORTA as output
TRISB = 0X00 ;
TRISC = 0X00 ;
TRISD = 0X00 ;
TRISE = 0X00 ;
PORTA = 0x00 ;
PORTB = 0X00 ;
PORTC = 0X00 ;
PORTD = 0X00 ;
PORTE = 0X00 ;
while(1){
DelayMs(500);
PORTA = ~PORTA ;
PORTB = ~PORTB ;
PORTC = ~PORTC ;
PORTD = ~PORTD ;
PORTE = ~PORTE ;
}
}
Last edited: Jun 29, 2009
-
#12
while(1){
DelayMs(500);
PORTA = ~PORTA ;
PORTB = ~PORTB ;
PORTC = ~PORTC ;
PORTD = ~PORTD ;
PORTE = ~PORTE ;
}
}
3v0
Coop Build Coordinator
-
#13
LATA=~LATA;
-
#14
Use the port latches rather then the ports. The latches return what was written.LATA=~LATA;
Where that on a 16f877a not a 18fchip
3v0
Coop Build Coordinator
-
#15
Where that on a 16f877a not a 18fchip
That’s what I get for only reading one post down, but it illustrates the point, and a good reason to use an 18F.
On the 16F you need to toggle a variable and write it to the port
char toggleMe;
....
toggleMe = 0x00;
...
while(1)
{
toggleMe = ~toggleMe;
PORTA = toggleMe;
}
-
#16
void main (){
ANSEL = 0; // makes PORTC digital
PORTC = 0; // Initialize PORTC
TRISC = 0; // Configure PORTC as output
while(1){
Delay_Ms(100);
PORTC = ~PORTC;
}
}
works find like this LOL
-
#17
1. You have the pins still set to analogue as pointed out by Burt.
2. You have overloaded the pins and this is forcing them high/low. Normally by connecting LEDs without series resistors.
3. You forgot to switch the pins to output.
4. The pins are configured for some other peripheral.
5. One of the other reasons for pics not working — not programmed, no oscillator, no power etc.
Mike.
Last edited: Jun 29, 2009
-
#18
I am curious about this as well. I have never encountered an example where PORTA=~PORTA; does not work.
3v0, do you have an actual code where this is known to not work?
3v0
Coop Build Coordinator
-
#19
I was thinking about the Read-Modify-Write problem on the 16F’s.
Burt said PORT=~PORT did not work. According to his post it did not work on any of the ports. I did not suspect he had not configured the port correctly.
-
#20
the fact using an intermediate variable can toggle a port suggests that the port itself is in the right mode.I am curious about this as well. I have never encountered an example where PORTA=~PORTA; does not work.
3v0, do you have an actual code where this is known to not work?
Try it on any pic chip with analogue pins. Any pins that are analogue work well as digital outputs but when you read them they always return zero. Hence why a copy will work.
Mike.
- Status
- Not open for further replies.
Similar threads
-
Electronics Forums
-
Microcontrollers
-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.