完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我在为DSPIC33 EP265MU806和PIC24FJ256GB106微处理器编译的通用定时器例程。因此,我开始在两种情况下测试计时器的结果,这两种情况下都是用XC16 v1.26编译器编译的。锿。因此,为了测试我启动定时器,并立即驱动一个输出引脚高(端口引脚3在两个uC)现在所有过期功能做的是翻转位“LATEbits.LATE3=~LATEbits.LATE3”,这一切都完美地工作在dsPIC33上,我用连接到引脚E3的范围检查了我的定时器。输出是一个简单的脉冲,这对PIC24FJ256GB106不起作用!我得到了我的到期函数调用,并切换引脚E3,但它立即切换。因此,我能够看到计时脉冲的结束,但引脚立即被驱动。我已经看过定时器代码,中断代码,没有发现任何问题,所以我决定编译器会产生垃圾。我试图查看调试输出,但是即使启用了调试输出,编译器实际上也不会生成任何调试输出。在MPLABX的Project属性中,调试似乎是一个很好的复选框。这是一个很棒的复选框。所以无论如何没有调试输出来查看生成的程序集,我决定从优化级别0到1。你知道什么能治愈这个问题,所以XC16显然是不可信的。也许我对优化的理解不是芯片的理解。
以上来自于百度翻译 以下为原文 I'm working on general timer routines compiled for both the dsPIC33EP265MU806 and the PIC24FJ256GB106 micros. So I started to test the results of my timers on both, in both cases compiled with the XC16 v1.26 compiler. I should mention how I'm testing my timers: My timers are asynchronous so I start the Timer 1 and the ISR calls an expiry function passed into the timer creation function, when the timer expires. So to test I start the timer and immediately drive an output pin high (PORTE Pin 3 in both uC) now all the expiry function does is flip that bit "LATEbits.LATE3 = ~LATEbits.LATE3" This all works perfectly on the dsPIC33 and I checked my timers with the scope connected to Pin E3. Output was a simple pulse. This did NOT work on the PIC24FJ256GB106! I was getting my expiry function called and toggled the Pin E3 but it immediately toggled again. So I was able to see the end of the timing pulse but the pin being driven high immediately. So I've been through timer code, Interrupt code, And found no problems so I decided that the compiler is producing rubbish. I tried to look at debug output, but even though debug output is enabled the compiler doesn't actually produce any debug output. Debug appears to be a nice check box in the project properties of MPLABx. It is a great checkbox. So anyhow no debug output to look at the assembly produced, I decided that I'd go from optimisation level 0 up to 1. What do you know that cures the problem, so obviously XC16 is not to be trusted. Or maybe my understanding of optimisation ain't Microchip's understanding. |
|
相关推荐
1个回答
|
|
您的症状可能是XC16版本中的一个问题(您没有列出)。是否启用生成并查看List文件?通过降低优化级别来解决问题可能是代码错误和未初始化变量的标志,或者应该声明为易失性的。这个LATEbits.LATE3=~LATEbits.LATE3"可能是危险的,因为它是R-M-W。
以上来自于百度翻译 以下为原文 Your symptoms could be a problem in the version of XC16 (that you did not list). Did you enable the generation and look at the List file? Fixing issue by dropping the optimization level can be the sign of a code bug like and uninitialized variable, or something that should have been declared volatile. This LATEbits.LATE3 = ~LATEbits.LATE3" may be risky since it is R-M-W |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
734浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
506浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 23:24 , Processed in 0.981239 second(s), Total 46, Slave 40 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号