完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我是新的MPLAB X和24F微控制器,但我用PIC16F和一个18F的项目,所有与旧IDE。我用MPLAX和24FJ64 GB00启动了一个新的项目,在模拟中发现了以下问题:当我用分频器8启动定时器时,看起来好像缺少了一个指令周期。预分频器=1,没有问题。在附图中,你可以看到我的样本。周期设置为10(PR1=9),预分频器为8。断点设置为中断time1,PIN是为了调试目的而切换的。正如你在逻辑分析仪中看到的(i缩放标记区域精确地设置它们),10个切换周期采用790个指令,正确的是800。秒表也显示了ISRs之间的79条指令。在我的代码中有错误吗?还是在模拟器中只是bug?如果有bug,有可能解决吗?旧IDE模拟器更好吗?这个错误本身并不是那么糟糕,但是我驾驶的是2个不同时间的SEP马达,它们必须是同步的。所以我想在模拟中测试长时间的行为。谢谢和问候,Aleksandar。
以上来自于百度翻译 以下为原文 Hi there, I am new with MPLAB X and 24F microcontrollers, but I made a caouple of projects with PIC16F and one with 18F, all with old IDE. I started a new project with MPLAB X and 24FJ64GB002 and found following problem in simulation: When I start timer with prescaler 8, it looks like one instruction cycle is missing. With prescaler = 1, there are no problems. In the attached image YOu can see my sample. Period is set to 10 (PR1=9), prescaler to 8. Breakpoint is set to interrupt Timer1, Pin is toggled for debug purposes. As You can see in Logic Analyzer (I zoomed marker areas to exactly set them), 10 toggle cycles are taking 790 instructions, correct would be 800. Stopwatch also shows 79 instructions between ISRs. Is there any error in my code or is it just bug in simulator? If there is a bug, is there any possibility to workaround? Is simulator in old IDE better? The error itself is not so bad, but I am driving 2 sep motors with different timings and they have to be synchronous. So I wanted to test long time behaviour in simulation. void PIN_MANAGER_Initialize(void) { /**************************************************************************** * Setting the Output Latch SFR(s) ***************************************************************************/ LATA = 0x0000; LATB = 0x0000; /**************************************************************************** * Setting the GPIO Direction SFR(s) ***************************************************************************/ TRISA = 0x001F; TRISB = 0xEFBB; /**************************************************************************** * Setting the Weak Pull Up and Weak Pull Down SFR(s) ***************************************************************************/ CNPU1 = 0x0000; CNPU2 = 0x0000; /**************************************************************************** * Setting the Open Drain SFR(s) ***************************************************************************/ ODCA = 0x0000; ODCB = 0x0000; /**************************************************************************** * Setting the Analog/Digital Configuration SFR(s) ***************************************************************************/ AD1PCFG = 0x001C; } uint8_t g_nextPinVal = 0; void __attribute__ ( ( interrupt, no_auto_psv ) ) _T1Interrupt ( ) { PORTBbits.RB2 = g_nextPinVal; g_nextPinVal = (g_nextPinVal==0)?1:0; IFS0bits.T1IF = false; } int16_t main(void) { /* Initialize IO ports and peripherals */ PIN_MANAGER_Initialize(); //TMR1 0; TMR1 = 0x0000; //Period = 0.00004 s; Frequency = 2000000 Hz; PR1 10; PR1 = 10-1; //TCKPS 1:8; TON enabled; TSIDL disabled; TCS FOSC/2; TSYNC disabled; TGATE disabled; T1CON = 0x0000; T1CONbits.TCKPS = 0b01; // prescaler = 8 IFS0bits.T1IF = false; IEC0bits.T1IE = true; T1CONbits.TON = 1; while(1) { } } Thanks and greetings, Aleksandar Attached Image(s) |
|
相关推荐
2个回答
|
|
谢谢你报告这个问题。是的,这是模拟器中的一个bug。当使用值大于1的预分频器时,定时器会提前错误地翻转一个周期。我们现在修复错误。由于我们已经为V4.20发布了分支,这个修复将在V4.20版本之后发布。
以上来自于百度翻译 以下为原文 Thank you for reporting this issue. Yes, this is a bug in Simulator. When you use prescaler with a value greater than 1, the Timer does incorrectly rollover one cycle earlier. We now fix the bug. Since we already branched for the v4.20 release, this fix will be available in the release version after v4.20. |
|
|
|
JackZhao,我接触到任何与微芯片模拟器开发相关的人。我的威廉希尔官方网站
支持案例00282543已经解决了将近3个月,但支持人员看不到任何来自微芯片模拟器开发人员的回复来解决我的问题。请尝试他。如果你能的话,查尔斯。
以上来自于百度翻译 以下为原文 @JackZhao, I am reaching to anyone involved with the Microchip simulator development. My technical support case #00282543 has been unresolved for almost 3 months but the support staff does not seen to be able to get any reply from the Microchip simulator developers to resolve my issue. Please try to help if you can. Charles. |
|
|
|
只有小组成员才能发言,加入小组>>
5305 浏览 9 评论
2069 浏览 8 评论
1972 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3242 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2279 浏览 5 评论
827浏览 1评论
719浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
664浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
716浏览 0评论
615浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-24 21:13 , Processed in 1.364363 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号