• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: 執行過程中,程式會自動暫停
#7
版主
版主


查看用戶資訊
沒想到是看門狗沒栓好。

前面所提供的 NMI 控制程式是一但發生 NMI 後程式直接跳到 NMI 中斷程式,這時就不知道程式跳到哪裡執行了? 只要按一下 Halt Icon 就可以知道程式是田在哪一個 NMI 裡的 while (1); 迴圈。

發表於: 2021/6/5 16:22
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 執行過程中,程式會自動暫停
#6
新會員
新會員


查看用戶資訊
謝謝S大跟版主的回覆。
因為我沒有看到程式有跳出錯誤訊息,所以後來我選擇將WDT關閉,就不會重啟了。

發表於: 2021/6/3 22:27
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 執行過程中,程式會自動暫停
#5
版主
版主


查看用戶資訊
NMI 中斷是屬於系統嚴重的錯誤中斷,中斷層級從 Level 8 ~ Level 15。參考一下貼圖及底下 dsPIC30F 攔截 NMI 的程式。

/*********************************************************************
*                                                                    *
*                       Software License Agreement                   *
*                                                                    *
*   The software supplied herewith by Microchip Technology           *
*   Incorporated (the "Company") for its dsPIC controller            *
*   is intended and supplied to you, the Company's customer,         *
*   for use solely and exclusively on Microchip dsPIC                *
*   products. The software is owned by the Company and/or its        *
*   supplier, and is protected under applicable copyright laws. All  *
*   rights are reserved. Any use in violation of the foregoing       *
*   restrictions may subject the user to criminal sanctions under    *
*   applicable laws, as well as to civil liability for the breach of *
*   the terms and conditions of this license.                        *
*                                                                    *
*   THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION.  NO           *
*   WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING,    *
*   BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND    *
*   FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE     *
*   COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,  *
*   INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.  *
*                                                                    *
*********************************************************************/

/********************************************************************
*
*  Filename:   traps.c
*  Purpose:    Boilerplate file for handling traps.
*              If any trap is taken, the program will "dead lock"
*              in the trap handler.  The following traps are
*              covered (primary and alternate):
*                 OscillatorFail
*                 AddressError
*                 StackError
*                 MathError
*
*********************************************************************/

/* Header Files */
#include "p30fxxxx.h"

/* Function Prototypes */
void _ISR _OscillatorFail(void);
void _ISR _AddressError(void);
void _ISR _StackError(void);
void _ISR _MathError(void);
void _ISR _AltOscillatorFail(void);
void _ISR _AltAddressError(void);
void _ISR _AltStackError(void);
void _ISR _AltMathError(void);


/* ************************************************************** */
/* Standard Exception Vector handlers if ALTIVT = 0, INTCON2<15> */
/* ************************************************************** */

void _ISR _OscillatorFail(void)
{

    
INTCON1bits.OSCFAIL 0;
    while(
1);     
}

void _ISR _AddressError(void)
{

    
INTCON1bits.ADDRERR 0;
    while(
1);     
}

void _ISR _StackError(void)
{

    
INTCON1bits.STKERR 0;
    while(
1);     
}

void _ISR _MathError(void)
{

    
INTCON1bits.MATHERR 0;
    while(
1);     
}


/* ************************************************************** */
/* Alternate Exception Vector handlers if ALTIVT = 1, INTCON2<15> */
/* ************************************************************** */


void _ISR _AltOscillatorFail(void)
{

    
INTCON1bits.OSCFAIL 0;
    while(
1);     
}

void _ISR _AltAddressError(void)
{

    
INTCON1bits.ADDRERR 0;
    while(
1);     
}

void _ISR _AltStackError(void)
{

    
INTCON1bits.STKERR 0;
    while(
1);     
}

void _ISR _AltMathError(void)
{

    
INTCON1bits.MATHERR 0;
    while(
1);     
}

Attach file:



jpg  擷取.JPG (81.44 KB)
16_60b8693945d0d.jpg 737X564 px

發表於: 2021/6/3 13:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 執行過程中,程式會自動暫停
#4
新會員
新會員


查看用戶資訊
可以先檢查是否開啟Watchdog,是否因為Watchdog導致重置

發表於: 2021/6/3 8:44
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 執行過程中,程式會自動暫停
#3
新會員
新會員


查看用戶資訊
謝謝版主回覆
想請問我的程式中沒有使用中斷,也會發生NMI嗎?

發表於: 2021/6/2 20:07

Edited by Redjackson on 2021年06月02日 20:55:23
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 執行過程中,程式會自動暫停
#2
版主
版主


查看用戶資訊
會不會發生了係統上的錯誤產生了 NMI 的錯誤中斷。一但發生了 NMI 中斷,程式會跳到 NMI 中斷向量點直接就執行 Reset 了。

發表於: 2021/5/31 12:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


執行過程中,程式會自動暫停
#1
新會員
新會員


查看用戶資訊
先進您好,我是使用Pic24fj128g106這顆晶片。

在執行Debug的途中,程式會自動暫停,我原本以為是因為Debug模式的緣故,但是我將程式載入至晶片時也會不斷暫停,即便之後會自動重啟,也對於我正在執行的計畫有很大的影響,想請問是有什麼設定會造成這樣的現象嗎?

由於程式較多,所以先不放上來。主要有使用到的是UART、OC1、Timer2、A/D 這些功能,程式內並無設定中斷,所以初步判斷不是中斷引起的暫停(也可能有地方沒檢查到),想請問如何解決這個問題?

謝謝

發表於: 2021/5/30 17:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------