完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
请参阅附上的代码。当我运行调试代码时,进程首先在设置断点的任何地方中断。然而,随后PIC将停止在主函数的随机位置,在顶部附近。关于如何排除故障的任何技巧都将有很大帮助:PIC18F45 K20MPLABX IDE 4.35XC8 1.38皮克特3程序员
以上来自于百度翻译 以下为原文 See the code attached. When I run the code for debugging, the process first breaks wherever I set the breakpoint. However, afterwards the PIC will halt at a random location in the Main function, near the top. Any tips on how to troubleshoot would be of much help :) PIC18F45K20 MPLABX IDE 4.35 XC8 1.38 PICkit 3 Programmer Attachment(s) main.c (4.37 KB) - downloaded 6 times |
|
相关推荐
5个回答
|
|
有没有一个原因你没有指定所有的配置保险丝,比如MCLRE和NSIST?什么连接到MCLR?可能与您的问题无关,而是浮点延迟例程?编译器的延迟例程是高效和精确的,而你的例程也不是这些事情。
以上来自于百度翻译 以下为原文 Is there a reason you haven't specified all of the configuration fuses, such as MCLRE and XINST? What is connected to MCLR? Probably not related to your problem, but a floating point delay routine? The compiler has delay routines that are efficient and accurate, and your routine is neither of those things. |
|
|
|
我看不出你的代码中有什么明显的问题会造成这种情况。你有没有好的电源轨道到两套Vdd&Vss引脚,和一个好的低ESR旁路帽尽可能接近每对Vdd&Vss引脚?一般来说,我会删除include
以上来自于百度翻译 以下为原文 I can't see any obvious problems in your code that could cause that. Do you have good power tracks to both sets of Vdd & Vss pins, and a good low ESR bypass cap as close as possible to each pair of Vdd & Vss pins? Just in general, i'd remove both of #include #include You rarely use stdio.h in embedded systems, and you're not using anything from stdint.h. So long as you don't have heavy interrupt use, it's cleaner to use the built in delay routines. Replace void ms_delay(int N){ T1CON = 0x8030; // configure timer float x; TMR1 = 0; x = (float) N * 62.5; // set ms delay while(TMR1 < x); } with void ms_delay(int N){ do __delay_ms(1); while (--N); } Also, your code has a weakness most people have the first time they try to implement I2C. You are not checking the ACK value after each write to the slave. At the very least, you should check it after sending the slave address byte, to see if it is responding. |
|
|
|
我想X3.45 A类似的bug发生在我身上,使用了3.50个调试器bug,我的意思是…
以上来自于百度翻译 以下为原文 I suppose X 3.45 A similar bug happened to me using 3.50 - a debugger bug I mean... |
|
|
|
谢谢大家。虽然我执行了JQUES和QHB所说的,但是解决不了这个问题。44引脚演示板,我从微芯片只有一个在Vdd和VCC之间的4个引脚中的2个引脚。稍后再尝试:D
以上来自于百度翻译 以下为原文 Thanks all. Couldn't solve the problem, although I implemented what jtemples and qhb said. The 44-pin demo board I have from Microchip only has one cap between Vdd and Vcc on 2 of the 4 pins. Will try again later :D |
|
|
|
我猜您的代码在某个时候会丢失,并开始执行随机内存位置,并且恰好在主目录开头附近的随机地址出现“中断”。可能由于WDT溢出或断电等原因而被迫复位。
以上来自于百度翻译 以下为原文 My guess would be that your code gets lost at some point and begins executing random memory locations and just happens to appear to "break" at a random address near the beginning of main. There might be a forced reset due to WDT overflow, or brownout, etc. |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2230 浏览 5 评论
740浏览 1评论
626浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
512浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
638浏览 0评论
536浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 17:50 , Processed in 1.851650 second(s), Total 87, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号