完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
您好,在中断功能中,我使用增加IPL位,只是为了确保任何其他具有较高优先级的中断将中断重要的计算(例如,以DSP引擎),我的代码看起来是这样的(我存储当前层并在计算之后恢复它)DSPYS115YYTAB(1)=Sq115Err;Sq115ycom=DSPE-EQDIM(XYTAB,YYTAB,3);YyTab[1]=Sq115ycom;YyTab[4]=YyTab[1 ];SrButs.IPL= UCHARAL IPL;我还没有对该方法有任何问题。但是今天,在相同的中断函数中,我想做两次。第一,这个代码工作:DSPIS.IPL=7;Sq115PoPiFLT=DSPE-EQDIM(XY-FIPLATA,YY-FIPLAB,DIMFIR FIR);Unti*CMPt++;SrPix.IPL=UCHARAL IPL;但这不起作用:DSPQS115UCHARAL IPL=SrPoS.IPL;SrPix.IPL=7;Sq115PoPiftt=DSPE-EQDIM(XY-FiTabl,YY-FiTabl,Dimi-FIR);SrPix.IPL=UcAuthIPL;uTunthCMPT++;当与DE运行时Sq115 uCARAL IPL=SRITEBGGER,MPLABX说:“目标因用户代码中的软件断点而停止”有人能帮助我吗?谢谢你,文森特
以上来自于百度翻译 以下为原文 Hello, In Interrupt functions, I use to increase the IPL bits, just to make sure that any other interrupt, with higher priority, will interrupt an important calculation (with the DSP Engine for instance) My code looks like that (I store the current layer and restore it after the calculation) uchar_ipl=SRbits.IPL; SRbits.IPL=7; DSP_SQ115 y_tab[1]=sq115_err; sq115_com=DSP_EQDIM(x_tab,y_tab,3); y_tab[0]=sq115_com; y_tab[2]=y_tab[1]; SRbits.IPL=uchar_ipl; I did not have any problem with this method yet. But today, in a same interrupt function, I wanted to do it twice. For the first, this code works: DSP_SQ115 uchar_ipl=SRbits.IPL; SRbits.IPL=7; sq115_PosFilt=DSP_EQDIM(x_FIRtab,y_FIRtab,DIM_FIR); uint_cmpt++; SRbits.IPL=uchar_ipl; But this doesn't work: DSP_SQ115 uchar_ipl=SRbits.IPL; SRbits.IPL=7; sq115_PosFilt=DSP_EQDIM(x_FIRtab,y_FIRtab,DIM_FIR); SRbits.IPL=uchar_ipl; uint_cmpt++; When runing with the debugger, MPLABX says : "Target halted due to Software Breakpoint in user code" Can anyone help me ? Thank you. Vincent |
|
相关推荐
10个回答
|
|
我用一种更合适的方法解决了IPL位的问题:UTIN SRMASSK=SR和AMP;0x00 E0;//SouValARDE位IPL SRPITS。IPL=7;Ce 0 LES位(餐厅经理PUIS)
以上来自于百度翻译 以下为原文 I resolved my problem with a more appropriate method to restore the IPL bits: uint_SRMask=SR&0x00E0; // sauvegarde des bits IPL SRbits.IPL=7; // élévation du niveau courant sq115_PosFilt=DSP_EQDIM(x_FIRtab,y_FIRtab,DIM_FIR); SR=(SR&0xFF1F)|uint_SRMask; // restauration des bits IPL (on force à 0 les bits à restaurer puis on restaure) |
|
|
|
很高兴你有一个工作解决方案,但我更感兴趣的是,为什么你觉得你需要玩ISR内的优先位?为什么不设置ISR向量的优先级,让它为您处理处理器优先级?苏珊
以上来自于百度翻译 以下为原文 Glad you have a working solution but I'm more interested in why you feel you need to play with the priority bits inside an ISR? Why not just set the priority of the ISR vector and let that handle the processor priority for you? Susan |
|
|
|
对不起,苏珊,我没看到你的答案!(我刚登录到另一个问题)我修改当前的级别,因为DSPJEQDIM是一个汇编程序函数,它必须不被中断。例如,如果在这个函数中出现另一个中断函数,它可能会改变WX和重复寄存器的内容。这些寄存器将不会被反驳。
以上来自于百度翻译 以下为原文 Sorry Susan, I didn't see your answer !! (I 've just logged to post another issue) I Modify the current level because DSP_EQDIM is an assembler function, which has to be not interrupted. For instance, if another Interrupt function appears during this function, it may change the contents of Wx and REPEAT registers. These registers will not be retored. |
|
|
|
那么为什么不把这个中断作为开始的最高优先级呢?
以上来自于百度翻译 以下为原文 So why not give this interrupt the highest priority to start with? |
|
|
|
不可能在我的程序:其他汇编函数出现在其他中断功能(对不起我的英语…我是法国人,和许多法国人一样,我不会很好地说其他语言。
以上来自于百度翻译 以下为原文 Not possible in my programm: other assembler function appear in other Interrupt functions (sorry for my english ... I'm french, and as many french people I do not speak other languages very well) |
|
|
|
我怀疑有什么大的误解(与英语或法语无关)。你到底在设计哪个设备?如果你说的是IPL位,我猜想它必须是一个DSIC33或PIC24家庭设备。如果是这样的话,那么每个中断源都有它自己的优先级,这就是我们需要设置的设置来实现你想要的。寄存器可能被称为“IPCX”或类似的东西。这也是设备本身的能力,与您的代码在汇编程序(或任何其他语言)中没有任何关系。另一种选择是我们完全误解了您是如何编写应用程序的,因此显示了一些代码。你的代码对我们有帮助。苏珊
以上来自于百度翻译 以下为原文 I suspect there is a major misunderstanding somewhere (and nothing to do with english or French). Exactly which device are you programming? I suspect it must be a dsPIC33 or PIC24 family device if you are talking about the IPL bits. If that is the case then each interrupt source has its own priority and this is the setting that we say you need to set to achieve what you want. The registers are probably called 'IPCx' or something similar. Also this is a capability of the device itself, and nothing to do with your code being written in assembler (or any other language). The other alternative is that we completely misunderstand how you have coded your app and so showing some of your code would help us there. Susan |
|
|
|
什么原因你不想保存/恢复必要的W寄存器和RCUTE进入中断?另外,一些DSPIC有影子寄存器集,所以不需要保存W寄存器。也许,你的就是其中之一。
以上来自于百度翻译 以下为原文 What is the reason you don't want to save/restore the necessary W registers and RCOUNT upon entering the interrupt? Also, some dsPICs have shadow registers sets, so you don't need to save W registers. Perhaps, yours is one of them. |
|
|
|
你好,苏珊和“NothGee”在附件中,我展示了我的程序的原理(对于DSPIC33 FJ)-主函数不做任何事情,只是初始化-有一个使用DSP引擎的函数。在任何计算之前,必须配置DSP(宏A=无符号整数)-有2个中断功能:ADC(优先级=3)和PWM匹配(优先级=6)。这两个函数也使用DSP引擎,但使用另一个配置(宏B=符号分号SQL 1.15),并调用上述f。如果在宏之前,我不把IPL放在7(在DSP计算之后恢复它),中断可能发生在宏A之后。在中断中,DSP将被配置为宏B,并且良好的配置将不会在函数W中恢复。有了这个配置问题,我必须承认,在任何DSP计算(在汇编文件中)之前,我将禁用中断,因为我不确定RCUT和工作寄存器将在中断返回时恢复。你能准确地告诉我在中断返回时编译器(XC16)恢复了什么吗?下面是我的中断函数原型的一个例子:ValueyAtAtditTeX((α-BythtType,Y.No.AutoPosivpSviz))
以上来自于百度翻译 以下为原文 Hello Susan and "NorthGuy" Here in attached file I show the principle of my programm (for DSPIC33FJ) - the main function does not do anything but initializations - there is a function which uses the DSP engine. Before any computation, the DSP must be configured (Macro A = unsigned integer) - there are 2 Interrupt functions: ADC (priority = 3) and PWM Match (Priority = 6) These two functions use the DSP engine too, but with another configuration (Macro B= signed fractionnal SQ1.15), and call the mentioned function If I don't put the IPL at 7 in the function before the macro (I restore it after the DSP computation), an interrupt may occur after the Macro A. In the interrupt, the DSP will be configured with the Macro B, and the good configuration will not be restore for the computation in the function. Without this configuration issue, I must admit that I would disable interruptions before any DSP computation (in anassembler file), because I'm not sure that RCOUNT and Working Registers will be restored at the return of an interruption. Can you tell me exactly what is restored by the compiler (XC16) at the return of an interruption ? Down here an example of my interrupt function prototypes: void __attribute__((__interrupt__,__no_auto_psv__)) _CNInterrupt(void); |
|
|
|
我建议您重新设计您的代码,因为它可能是ISRs需要执行一段时间-尤其是您必须执行DSP功能。一般来说,调用ISR内的函数将强制编译器保存/恢复所有寄存器,因为它不知道(因为它正在编译)。ISR代码)调用函数将使用哪些寄存器。我不能确切地告诉您RCUT或任何其他特定寄存器是否被保存,但请查看生成的汇编器,您将看到生成的前同步码和后同步码。标志或执行非常短/简单的操作。执行冗长的代码序列最好留给主循环。苏珊
以上来自于百度翻译 以下为原文 I would suggest that you redesign your code as it could well be that the ISRs are taking a while to execute - especially of you have to perform DSP functions. In general, calling a function within an ISR will force the compiler to save/restore all registers because it has no idea (as it is compiling the ISR code) what registers will be used by the called function. I can't tell you exactly whether the RCOUNT or any other specific register is saved but have a look at the generated assembler and you will see the pre-amble and post-amble code that is generated. Personally I use the ISR code to set flags or perform very short/simple operations. Performing lengthy code sequences is best left for the main loop. Susan |
|
|
|
你好,苏珊,我一直犹豫着要在我的程序中做这样的改变。我想我会做的,我真的很感激与你交谈。你总是很有钱。我希望你能尽快开口。文森特(来自法国)
以上来自于百度翻译 以下为原文 Hello Susan, I've been hesitating to do such changes in my programm. I think I will do so I really do appreciate to talk with you. You are always hepful. Speak you soon I hope. Vincent (from France) |
|
|
|
只有小组成员才能发言,加入小组>>
5139 浏览 9 评论
1987 浏览 8 评论
1917 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3158 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2215 浏览 5 评论
706浏览 1评论
597浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
480浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
609浏览 0评论
505浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-8 08:25 , Processed in 1.373640 second(s), Total 97, Slave 80 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号