完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,MPLABX 4.01 +MCC 3.36 +XC81.44如何在MCC生成的中断例程中调用“Meal.C”中的函数?对于定时器,有一个名为“TMRxStEnsithTraceDunter(Vule*Cuffththand)”的函数,它可以正常工作,但对于其他外围没有这样的函数。如果您试图从(只是示例)ZCD.ISR中调用“Meal.C”中的函数,编译器给出如下:Maul.C:70:错误:(1098)变量“AxTxx块”的冲突声明(McCyPrimeAddixFields/ZCD.C: 83),这是真正的方式,有什么想法吗?
以上来自于百度翻译 以下为原文 Hi, MPLABX 4.01 + MCC 3.36 + XC8 1.44 How to call a function in "main.c" within MCC generated interrupt routine? For timer there is a function named "TMRx_SetInterruptHandler(void* InterruptHandler)" and works ok but for other periperals no such a function. If you try to call a function in "main.c" from the (just for an example) zcd.c file, in ZCD_ISR, compiler gives this: main.c:70: error: (1098) conflicting declarations for variable "_TX_block" (mcc_generated_files/zcd.c:83) What is the true way of doing this , have any thoughts ? |
|
相关推荐
5个回答
|
|
是的,这是一个旧版本的XC8的问题,我认为已经完全解决了一段时间前。你尝试的是不可能的标准XC8设置(“编译堆栈”)。如果代码大小不是问题,我建议创建一个从ISR调用的函数的副本,用“ISRZ”预先装入函数名。这样你就可以编译了。
以上来自于百度翻译 以下为原文 Yep. This was an issue with older versions of XC8 I thought had been solved completely starting some time ago. What you try is not possible with the standard XC8 settings ("compiled stack"). If code size is no issue, I'd suggest to create a copy of the function(s) to be called from the ISR, prefixing the function name with "ISR_". This way you should be able to compile. |
|
|
|
寻找另一种方式。中断是不理想的。
以上来自于百度翻译 以下为原文 Find another way. calling funcs. from interrupts is not ideal. |
|
|
|
谢谢你的回复。好吧,接受你必须在ISR中快速,并调用一个函数不是一个好方法。那么你的建议是什么?(结构设计明智)尝试制作一个发射机,调频,发送20×150个不同的频率包。吨跳过细节,为开始35US发送默认FRQ,但为每一个150美元时隙设置一个新的FRQ。这个发送应该在ZC(零交叉)和ZC之后(用Time2)完成。
以上来自于百度翻译 以下为原文 Thank you for your replies. Ok, accept that you have to be quick in an ISR and calling a function is not a good way. Then what is your proposal for this: ( structural design wise ) Trying to make a transmitter, FM, sending 20 x 150us different frequency packets. Here is the funstions in the main.c, just skip the details, for the starting 35us sending default freq but for each 150us slot setting a new freq. This sending should be done on ZC (zero cross) and after ZC ( with timer2 ). void TX_block(){ if (flags.tx_enb==1){ TMR1H = 251; TMR1L = 224; //35us TMR1_StartTimer(); CCP1CONbits.EN = 1; tx_nbl_cnt=0; flags.tx_enb=0; } } //1st TX-slot void ZCD_int(){ TX_block(); } //after ZCD 6ms, 2nd TX-slot void TMR2_int(){ TX_block(); } //tx - next nibble - 150us void TMR1_int(){ ++tx_nbl_cnt; if(tx_nbl_cnt <= packets_tosend){ if(tx_nbl_cnt==1) TMR1H = 238; TMR1L = 128; //150us T4PR = tx_packet[tx_nbl_say-1] + 64; } else if (tx_nbl_cnt>packets_tosend) { CCP1CONbits.EN = 0; TMR1_StopTimer(); } } /* Main application */ void main(void) { // initialize the device SYSTEM_Initialize(); TMR2_SetInterruptHandler(TMR2_int); TMR1_SetInterruptHandler(TMR1_int); ZCD_SetInterruptHandler(ZCD_int); // Enable the Global Interrupts INTERRUPT_GlobalInterruptEnable(); // Enable the Peripheral Interrupts INTERRUPT_PeripheralInterruptEnable(); while (1) { delay_10ms (200); IO_RC3_SetHigh(); flags.tx_enb=1; delay_10ms(2); IO_RC3_SetLow(); } } |
|
|
|
你并不总是需要中断。启动计时器并等待定时器标志设置。“你的建议是什么?”你可能已经花了好几个小时了,我无法用一个回复来解决这个问题。我甚至不知道你是如何传输OTA的。你发送的是24/7吗?如果我在做广播的话,我不会为8位而烦恼,但这是我的观点。
以上来自于百度翻译 以下为原文 You don't always need interrupts. Start the timer and wait for the timer flag to be set. "What is your proposal?" You may have spent hours on it, I can't fix that with one reply. I don't even know how you are transmitting ota. Are you transmitting 24/7? If I was doing radio stuff, I wouldn't bother with 8bit but that is my opinion. |
|
|
|
2个不同时期的阶段同步?这是另一个整数倍吗?否则,这是不可能的。
以上来自于百度翻译 以下为原文 2 different periods constantly in phase?? Is the one an integer multiple of the other? Otherwise this would not be possible. |
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
597浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 02:25 , Processed in 1.335699 second(s), Total 85, Slave 69 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号