完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有一个在子目录中有MCC生成代码的项目。我想访问在父目录中的代码中声明的变量。为什么不承认或接受对外声明?当我试图编译MCC代码时,我得到以下文件:干净的成功(总时间:51毫秒)c:\程序文件(x86)Microchip xC16v1.32 bin xC16 gcc.exe“MCCI”。MyPo.MePux/McPU=24FJ128GA610-MMD -MF“构建/默认/生产/ MCCH生成的文件/ Pin管理器.O.D”-MNO EDS警告-G-OMF=ELF-DXPRJIOUTY =默认-没有遗留LIBC-O0-MSMARI IO=1墙-MSFR警告= OB-NBPt/MaGeFieldList.MK:302:目标“构建/默认/生产/ MCCH生成文件/ Pin管理器”的配方。O'FrestMcCyPrimeDyFrase/Pin管理器。C:54:16:错误:在“SyrWorkFrase'McCyPrimeAddioStudio/Pin管理器”之前的预期“=”、“、”、“ASM”或“AY属性”。错误:“SunRoSurror”未声明(在这个函数中首次使用)McCyPrimeAddixFixs/PixMealth.C:223:13:注意:每个未声明的标识符只对其出现的每个函数只报告一次:**[Bug/Deule/Mutux/McCyPrimeAdxFixs/PixMaung.O]错误255构建失败(退出值2,总时间:445毫秒)
以上来自于百度翻译 以下为原文 I have a project that has MCC generated code in a subdirectory. I want to access a variable that is declared in code in the parent directory. Why is the extern declaration not recognized or accepted? file.c with uint8_t sensor_fail declaration uint8_t sensor_fail; pin_manager.c (see below) When I try to compile the MCC code, I get the following: CLEAN SUCCESSFUL (total time: 51ms) "C:Program Files (x86)Microchipxc16v1.32binxc16-gcc.exe" mcc_generated_files/pin_manager.c -o build/default/production/mcc_generated_files/pin_manager.o -c -mcpu=24FJ128GA610 -MMD -MF "build/default/production/mcc_generated_files/pin_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -no-legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off nbproject/Makefile-default.mk:302: recipe for target 'build/default/production/mcc_generated_files/pin_manager.o' failed mcc_generated_files/pin_manager.c:54:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sensor_fail' mcc_generated_files/pin_manager.c: In function '_IOCInterrupt': mcc_generated_files/pin_manager.c:223:13: error: 'sensor_fail' undeclared (first use in this function) mcc_generated_files/pin_manager.c:223:13: note: each undeclared identifier is reported only once for each function it appears in make: *** [build/default/production/mcc_generated_files/pin_manager.o] Error 255 BUILD FAILED (exit value 2, total time: 455ms) /** System Interrupts Generated Driver File @Company: Microchip Technology Inc. @File Name: pin_manager.c @Summary: This is the generated manager file for the MPLAB(c) Code Configurator device. This manager configures the pins direction, initial state, analog setting. The peripheral pin select, PPS, configuration is also handled by this manager. @Description: This source file provides implementations for MPLAB(c) Code Configurator interrupts. Generation Information : Product Revision : MPLAB(c) Code Configurator - 4.26 Device : PIC24FJ128GA610 The generated drivers are tested against the following: Compiler : XC16 1.32 MPLAB : MPLAB X 3.61 Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved. Microchip licenses to you the right to use, modify, copy and distribute Software only when embedded on a Microchip microcontroller or digital signal controller that is integrated into your product or third party product (pursuant to the sublicense terms in the accompanying license agreement). You should refer to the license agreement accompanying this Software for additional information regarding your rights and obligations. SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. */ /** Section: Includes */ #include #include "pin_manager.h" extern uint8_t sensor_fail; /** void PIN_MANAGER_Initialize(void) */ void PIN_MANAGER_Initialize(void) { /**************************************************************************** * Setting the Output Latch SFR(s) ***************************************************************************/ LATA = 0x0012; LATB = 0x0000; LATC = 0x0000; LATD = 0x050A; LATE = 0x0000; LATF = 0x0124; LATG = 0x0000; /**************************************************************************** * Setting the GPIO Direction SFR(s) ***************************************************************************/ TRISA = 0x864C; TRISB = 0xFFFF; TRISC = 0x1000; TRISD = 0x7200; TRISE = 0x0000; TRISF = 0x104B; TRISG = 0x700F; /**************************************************************************** * Setting the Weak Pull Up and Weak Pull Down SFR(s) ***************************************************************************/ IOCPDA = 0x0000; IOCPDB = 0x0000; IOCPDC = 0x0000; IOCPDD = 0x0000; IOCPDE = 0x0000; IOCPDF = 0x0000; IOCPDG = 0x0000; IOCPUA = 0x0000; IOCPUB = 0x0000; IOCPUC = 0x0000; IOCPUD = 0x0000; IOCPUE = 0x0000; IOCPUF = 0x0000; IOCPUG = 0x0000; /**************************************************************************** * Setting the Open Drain SFR(s) ***************************************************************************/ ODCA = 0x0000; ODCB = 0x0000; ODCC = 0x0000; ODCD = 0x0002; ODCE = 0x0000; ODCF = 0x0000; ODCG = 0x0000; /**************************************************************************** * Setting the Analog/Digital Configuration SFR(s) ***************************************************************************/ ANSA = 0x0600; ANSB = 0x1FFC; ANSC = 0x0000; ANSD = 0x0000; ANSE = 0x0000; ANSG = 0x0000; /**************************************************************************** * Set the PPS ***************************************************************************/ __builtin_write_OSCCONL(OSCCON & 0xbf); // unlock PPS RPOR5bits.RP10R = 0x0008; //RF4->SPI1:SCK1OUT; RPINR18bits.U1RXR = 0x002A; //RD12->UART1:U1RX; RPOR2bits.RP5R = 0x0007; //RD15->SPI1:SDO1; RPOR11bits.RP22R = 0x0003; //RD3->UART1:U1TX; RPOR15bits.RP31R = 0x000D; //RF13->OC1:OC1; RPOR15bits.RP30R = 0x000F; //RF2->OC3:OC3; RPINR20bits.SDI1R = 0x002B; //RD14->SPI1:SDI1; RPINR3bits.T2CKR = 0x0020; //RF12->TMR2:T2CK; RPOR1bits.RP2R = 0x0005; //RD8->UART2:U2TX; RPINR19bits.U2RXR = 0x0023; //RA15->UART2:U2RX; __builtin_write_OSCCONL(OSCCON | 0x40); // lock PPS /**************************************************************************** * Interrupt On Change for group IOCFA - flag ***************************************************************************/ IOCFAbits.IOCFA6 = 0; // Pin : RA6 /**************************************************************************** * Interrupt On Change for group IOCNA - negative ***************************************************************************/ IOCNAbits.IOCNA6 = 1; // Pin : RA6 /**************************************************************************** * Interrupt On Change for group IOCPA - positive ***************************************************************************/ IOCPAbits.IOCPA6 = 0; // Pin : RA6 /**************************************************************************** * Interrupt On Change for group IOCFF - flag ***************************************************************************/ IOCFFbits.IOCFF0 = 0; // Pin : RF0 IOCFFbits.IOCFF1 = 0; // Pin : RF1 /**************************************************************************** * Interrupt On Change for group IOCNF - negative ***************************************************************************/ IOCNFbits.IOCNF0 = 1; // Pin : RF0 IOCNFbits.IOCNF1 = 1; // Pin : RF1 /**************************************************************************** * Interrupt On Change for group IOCPF - positive ***************************************************************************/ IOCPFbits.IOCPF0 = 0; // Pin : RF0 IOCPFbits.IOCPF1 = 0; // Pin : RF1 /**************************************************************************** * Interrupt On Change for group IOCFG - flag ***************************************************************************/ IOCFGbits.IOCFG0 = 0; // Pin : RG0 IOCFGbits.IOCFG1 = 0; // Pin : RG1 IOCFGbits.IOCFG12 = 0; // Pin : RG12 IOCFGbits.IOCFG13 = 0; // Pin : RG13 IOCFGbits.IOCFG14 = 0; // Pin : RG14 /**************************************************************************** * Interrupt On Change for group IOCNG - negative ***************************************************************************/ IOCNGbits.IOCNG0 = 1; // Pin : RG0 IOCNGbits.IOCNG1 = 1; // Pin : RG1 IOCNGbits.IOCNG12 = 1; // Pin : RG12 IOCNGbits.IOCNG13 = 1; // Pin : RG13 IOCNGbits.IOCNG14 = 1; // Pin : RG14 /**************************************************************************** * Interrupt On Change for group IOCPG - positive ***************************************************************************/ IOCPGbits.IOCPG0 = 0; // Pin : RG0 IOCPGbits.IOCPG1 = 0; // Pin : RG1 IOCPGbits.IOCPG12 = 0; // Pin : RG12 IOCPGbits.IOCPG13 = 0; // Pin : RG13 IOCPGbits.IOCPG14 = 0; // Pin : RG14 /**************************************************************************** * Interrupt On Change for group PADCON - config ***************************************************************************/ PADCONbits.IOCON = 1; IEC1bits.IOCIE = 1; // Enable IOCI interrupt } /* Interrupt service routine for the IOCI interrupt. */ void __attribute__ (( interrupt, no_auto_psv )) _IOCInterrupt ( void ) { if(IFS1bits.IOCIF == 1) { // Clear the flag IFS1bits.IOCIF = 0; // interrupt on change for group IOCAF if(IOCFAbits.IOCFA6 == 1) { IOCFAbits.IOCFA6 = 0; // Add handler code here for Pin - RA6 (ST5) sensor_fail |= 1<<4; } // interrupt on change for group IOCFF if(IOCFFbits.IOCFF0 == 1) { IOCFFbits.IOCFF0 = 0; // Add handler code here for Pin - RF0 (ST1) sensor_fail |= 1<<0; } if(IOCFFbits.IOCFF1 == 1) { IOCFFbits.IOCFF1 = 0; // Add handler code here for Pin - RF1 (ST2) sensor_fail |= 1<<1; } // interrupt on change for group IOCGF if(IOCFGbits.IOCFG0 == 1) { IOCFGbits.IOCFG0 = 0; // Add handler code here for Pin - RG0 (ST4) sensor_fail |= 1<<3; } if(IOCFGbits.IOCFG1 == 1) { IOCFGbits.IOCFG1 = 0; // Add handler code here for Pin - RG1 (ST3) sensor_fail |= 1<<2; } if(IOCFGbits.IOCFG12 == 1) { IOCFGbits.IOCFG12 = 0; // Add handler code here for Pin - RG12 (ST6) sensor_fail |= 1<<5; } if(IOCFGbits.IOCFG13 == 1) { IOCFGbits.IOCFG13 = 0; // Add handler code here for Pin - RG13 (ST7) sensor_fail |= 1<<6; } if(IOCFGbits.IOCFG14 == 1) { IOCFGbits.IOCFG14 = 0; // Add handler code here for Pin - RG14 (ST8) sensor_fail |= 1<<7; } } } Attachment(s) 1000Hub.zip (158.82 KB) - downloaded 22 times |
|
相关推荐
2个回答
|
|
不包含StInt.h头,因此Unt8It TyPulf对于编译器来说是不可见的。
以上来自于百度翻译 以下为原文 The stdint.h header is not included, so the uint8_t typedef is not visible to the compiler. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5158 浏览 9 评论
1997 浏览 8 评论
1926 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3168 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2222 浏览 5 评论
722浏览 1评论
605浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
492浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
619浏览 0评论
518浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-18 21:39 , Processed in 1.148355 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号