完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,目前我在使用MPLAB X IDE V3.45模拟器和PIC18F67 K40环境和系统描述时遇到一些意想不到的行为。--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------T有真实的PCB,所以我尝试使用MPLAB X IDE V3.45中包含的模拟器来调试源代码,但是我有一些奇怪的行为,我并不真正理解。我一直在寻找这个论坛中的相关信息,我没有得到任何明确的答案。SW本身并不是非常复杂,它只是使用一些外围设备和它们的一些关联中断:time0,Ioc,2比较器,PWM,EUSAT和I2C。我已经启用了中断优先级特性和它。问题描述----------------------当我执行SW时,它似乎工作得相当好,只要它不需要执行任何ISR。例如,EUSAT在Tx工作得很好,但在RX中却没有(两个通信方向都有关联中断)。在执行流之后,它不能检测程序何时进入定义的ISR(有2个,一个用于高优先级,另一个用于低优先级)。我只使用了Time0和Time2的新项目。当我用模拟器执行这个项目时,定时器2中断标志被正确地激活,但是它被自动地清除,而不是跳转到ISR,在这个ISR中有这个中断。另一方面,我看不到计时器0增加其值。ISR被声明为:空隙中断高优先级ISRH高(空隙)空隙中断在其主体内的低优先级ISRL低空(空隙),检查中断使能位和标志以知道哪个是触发中断。我使用的USAT源代码是从PIC18F66 J11中使用的源代码改编的,当我执行这个SW时,执行流作为预期来进入ISR函数/例程。PIC18F67 K40是由MPLAB X IDE V3.45模拟器支持的吗?我找不到任何支持特定文档的设备,只是非常通用的信息(即:PIC18核心和大多数外围设备都支持一些限制……)希望我的描述足够好。
以上来自于百度翻译 以下为原文 Hi all, Currently I am struggling with some unexpected behavior when using MPLAB X IDE v3.45 Simulator with a PIC18F67K40 Environment and system description ------------------------------------------- I have prepared some SW that needs to be run on a custom PCB with a PIC18F67K40, for the moment I don't have the real PCB so I am trying to debug the source code by using the Simulator included in MPLAB X IDE v3.45, but I got some strange behavior that I do not really understand. I have been searching for related info within this forum and I didn't get any clear answer. The SW itself is not very complex, it just uses some peripherals and some of their associated interrupts: Timer0, IOC, 2 comparators, PWM, EUSART and I2C. I have enabled the interrupt priority feature and it is being used. Problem description ----------------------- When I executed the SW, it seems to work reasonably well as far as it does not need to execute any ISR. For example, EUSART works well in Tx but not in Rx (both communication directions have interrupts associated). Following the execution flow, it cannot detect when the program enters in the defined ISR (there are 2, one for high priority and other for low priority). After this behavior, I created a simplified new project where I only use Timer0 and Timer2. When I execute this project with the simulator, Timer 2 interrupt flag is activated properly, but it is cleared automatically, instead of jumping to the ISR where this interrupt is attended. On the other hand, I cannot see the Timer 0 increasing its value. The ISR are declared as: void interrupt high_priority ISR_high(void) void interrupt low_priority ISR_low(void) Inside their bodies, the interrupt enable bits and flags are checked in order to know which is the triggered interrupt. The EUSART source code that I am using is adapted from a source code that is used in a PIC18F66J11 and when I execute this SW, the execution flows enters the ISR functions/routines as expected. Questions ------------ Is the described behavior the one that I should expect? Is PIC18F67K40 supported by the simulator within MPLAB X IDE v3.45? I could not find any documentation specific devices that are supported, only very generic info (i.e.: "PIC18 core and most of the peripherals are supported with some limitations...") I hope the description is good enough. Thanks in advance |
|
相关推荐
3个回答
|
|
展示你的代码,让我们看一看(通常SIM工作)
以上来自于百度翻译 以下为原文 Show your code, let's take a look (usually SIM does work) |
|
|
|
您可以为18F67K40创建一个模拟器项目,这意味着v3.45确实支持该设备。而中断服务确实起作用(据我们所知)。也许代码不为非中断外围设备设置中断使能位?或者,如果事件链是由IOC或比较器触发的,那么可能需要使用SCL或Stimulus将值注入适当的管脚以触发中断条件?您可能需要发布您的代码,以便人们能够检查它,或者弄清楚正在发生什么。或者更好的方法是创建第二个项目,它一次只运行一个外围设备,以最简单的方式,看看是否能够让它工作。你也可以用'67K40'来规划一个简单的电路,以验证你对单个外围设备的简单代码测试。
以上来自于百度翻译 以下为原文 The fact that you could create a simulator project for 18F67K40 means that v3.45 does indeed have simulator support for that device. And interrupt services do indeed work (to the best of our knowledge). Perhaps the code doesn't set the interrupt enable bits for the non-interrupting peripherals? Or if a chain of events is being triggered by IOC or the comparator, then likely you would need to use SCL or Stimulus to inject values onto the appropriate pins to trigger the interrupt condition? You may need to post your code so that folks can check it out and maybe figure out what's going on. Or perhaps a better approach would be to create a second project that is only exercising one of the peripherals at a time, in the simplest way possible, to see if you can get it to work. You could also breadboard a simple circuit using the '67K40 to validate your simple code testing of the individual peripherals. |
|
|
|
谢谢你指出这个问题,并发布你的代码。我确实看到了你提到的V3.45和V3.51的问题。我们已经为V3.55分支,并建立了V3.55.RC1(发布候选1)。我用V3.55.RC1再次测试了你的代码,并且两个定时器中断都被正确地处理了,这意味着我们已经解决了这个问题,并且修复将在下一个版本MPLAB X V3.55中获得。
以上来自于百度翻译 以下为原文 Thank you for pointing out the issue and posting your code. I did see the issue you mentioned with v3.45 and v3.51. We have branched for v3.55 and built v3.55.RC1 (release candidate 1). I tested you code again with v3.55.RC1, and both Timer interrupts were handled correctly which means we already got this issue fixed and the fix would be available in the next release MPLAB X v3.55. |
|
|
|
只有小组成员才能发言,加入小组>>
5157 浏览 9 评论
1997 浏览 8 评论
1925 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3168 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2222 浏览 5 评论
721浏览 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 10:22 , Processed in 1.287568 second(s), Total 52, Slave 45 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号