完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,盖伊,我用PIC18F25K40启动了一个新的项目,但是我有一个我无法解释的问题。我开发:当我关闭电源并重新启动我的卡时,PIC不会重置。我的变量保持不变。我看了医生,我没有找到解决方案。我使用MPLAB V3.61和XC8。你能帮助我吗????我向您展示主配置寄存器:
以上来自于百度翻译 以下为原文 Hi guy, I started a new Projet with a PIC18F25K40 but I have a problem that I can't explain. I develop : When I shut-off the supply and restart my card the PIC doesn't reset. My variables stays identical. I looked in doc and I didn't find the solution. I use MPLAB v3.61 with XC8. Can You help me ??? I show you the master config register: // CONFIG1L #pragma config FEXTOSC = OFF // External Oscillator mode Selection bits (Oscillator not enabled) #pragma config RSTOSC = HFINTOSC_64MHZ// Power-up default value for COSC bits (HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1) // CONFIG1H #pragma config CLKOUTEN = OFF // Clock Out Enable bit (CLKOUT function is disabled) #pragma config CSWEN = OFF // Clock Switch Enable bit (The NOSC and NDIV bits cannot be changed by user software) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled) // CONFIG2L #pragma config MCLRE = INTMCLR // Master Clear Enable bit (If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR) #pragma config PWRTE = OFF // Power-up Timer Enable bit (Power up timer disabled) #pragma config LPBOREN = OFF // Low-power BOR enable bit (ULPBOR disabled) #pragma config BOREN = ON // Brown-out Reset Enable bits (Brown-out Reset enabled according to SBOREN) // CONFIG2H #pragma config BORV = VBOR_245 // Brown Out Reset Voltage selection bits (Brown-out Reset Voltage (VBOR) set to 2.45V) #pragma config ZCD = OFF // ZCD Disable bit (ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON) #pragma config PPS1WAY = OFF // PPSLOCK bit One-Way Set Enable bit (PPSLOCK bit can be set and cleared repeatedly (subject to the unlock sequence)) #pragma config STVREN = OFF // Stack Full/Underflow Reset Enable bit (Stack full/underflow will not cause Reset) #pragma config DEBUG = OFF // Debugger Enable bit (Background debugger disabled) #pragma config XINST = OFF // Extended Instruction Set Enable bit (Extended Instruction Set and Indexed Addressing Mode disabled) // CONFIG3L #pragma config WDTCPS = WDTCPS_12// WDT Period Select bits (Divider ratio 1:131072) #pragma config WDTE = OFF // WDT operating mode (WDT Disabled) // CONFIG3H #pragma config WDTCWS = WDTCWS_6// WDT Window Select bits (window always open (100%); no software control; keyed access required) #pragma config WDTCCS = HFINTOSC// WDT input clock selector (WDT reference clock is the 31.2kHz HFINTOSC output) // CONFIG4L #pragma config WRT0 = OFF // Write Protection Block 0 (Block 0 (000800-001FFFh) not write-protected) #pragma config WRT1 = OFF // Write Protection Block 1 (Block 1 (002000-003FFFh) not write-protected) #pragma config WRT2 = OFF // Write Protection Block 2 (Block 2 (004000-005FFFh) not write-protected) #pragma config WRT3 = OFF // Write Protection Block 3 (Block 3 (006000-007FFFh) not write-protected) // CONFIG4H #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers (300000-30000Bh) not write-protected) #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected) #pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM not write-protected) #pragma config SCANE = OFF // Scanner Enable bit (Scanner module is NOT available for use, SCANMD bit is ignored) #pragma config LVP = OFF // Low Voltage Programming Enable bit (HV on MCLR/VPP must be used for programming) // CONFIG5L #pragma config CP = OFF // UserNVM Program Memory Code Protection bit (UserNVM code protection disabled) #pragma config CPD = OFF // DataNVM Memory Code Protection bit (DataNVM code protection disabled) // CONFIG5H // CONFIG6L #pragma config EBTR0 = OFF // Table Read Protection Block 0 (Block 0 (000800-001FFFh) not protected from table reads executed in other blocks) #pragma config EBTR1 = OFF // Table Read Protection Block 1 (Block 1 (002000-003FFFh) not protected from table reads executed in other blocks) #pragma config EBTR2 = OFF // Table Read Protection Block 2 (Block 2 (004000-005FFFh) not protected from table reads executed in other blocks) #pragma config EBTR3 = OFF // Table Read Protection Block 3 (Block 3 (006000-007FFFh) not protected from table reads executed in other blocks) // CONFIG6H #pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot Block (000000-0007FFh) not protected from table reads executed in other blocks) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. |
|
相关推荐
9个回答
|
|
你确定没有其他东西泄漏到你的照片里了吗?调试器仍然连接吗?
以上来自于百度翻译 以下为原文 Are you sure nothing else is leaking power into your PIC? Is a debugger still connected? |
|
|
|
是的,在第一次,我执行初始化。在第二次,我执行一个循环程序,其中IL检查系统的输出电流。当我创建一个缺省电流时,我切换到一个错误例程。你还好吗?通常,当我重新启动我的系统时,我会看到它重新启动,然后它将执行正常的例程。但是我看到它重新启动错误例程。星期五我试图切断电源,星期一早上我重新连接,我看到了相同的配置。我很好。这不正常。我不明白!????
以上来自于百度翻译 以下为原文 Yes, I do. In first time, I execute my initialisation. In seconde time, I execute a cycle program where il check the out current of my system. When I create a default of the out current I switch on a error routine. Are you OK? Normally, when I restart my system I would see it restart and after it would execute the normal routine. But I see it to restart on the error routine. I tried to disconnect the supply Friday and I reconnected Monday morning and I saw the identical comportment. I'm OK with you. It's not normal. I don't understand!!?? |
|
|
|
你是说RAM内存吗?(GPR寄存器)未定义复位值,因此需要在使用前初始化每个寄存器。复位值可以是复位前的值,也可以是随机值。
以上来自于百度翻译 以下为原文 Are you talking about RAM memory? (GPR registers) The value on reset is not defined so you need to initialize each register before use. The value on reset can be the value it was before reset or it can also be something random. |
|
|
|
你必须对变量初始化进行修改,因为勘误表中的bug:“3.1 TBRD需要NVMREG值指向内存”。
以上来自于百度翻译 以下为原文 And you have to be carfull with the variable initialisation because of the Bug in the errata sheet: "3.1 TBLRD Requires NVMREG Value to Point to Memory" |
|
|
|
谢谢大家,我用“LVP= ON”来解决我的问题。
以上来自于百度翻译 以下为原文 Thank Everybody, I resolve my problem with put "LVP = ON". |
|
|
|
|
|
|
|
这可能比我的问题的原因更复杂,但之后我的问题解决了。如果你有解释,那么我想拥有它。
以上来自于百度翻译 以下为原文 It's possible than the reason of my problem is more complicated but after that my problem is resolved. If you have the explaining then I would like to have it. |
|
|
|
改变该设置的唯一原因将产生影响,因为它重写了这样的设置:{ Trac-PracMaMeReC:McRe= InMcLr//MistCar允许位(如果LVP=0,MCLR PIN函数是端口定义函数;如果LVP=1,Re3引脚函数是MCLR)。
以上来自于百度翻译 以下为原文 The only reason changing that setting would have an effect, is because it overrides THIS setting: #pragma config MCLRE = INTMCLR // Master Clear Enable bit (If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin function is MCLR) |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5198 浏览 9 评论
2016 浏览 8 评论
1940 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3188 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2243 浏览 5 评论
753浏览 1评论
639浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
526浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
651浏览 0评论
552浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-3 15:09 , Processed in 1.402233 second(s), Total 92, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号