www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁 > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]  Watchdog is a very necessary module for embedded system. Someone said that embedded system operates without watchdog enabled just like the car without air bag. You should always enabled watchdog a

  Watchdog is a very necessary module for embedded system. Someone said that embedded system operates without watchdog enabled just like the car without air bag. You should always enabled watchdog as possible as you can.


  The PIC32MZ Watchdog Timer (WDT), when enabled, operates from the internal Low-Power RC (LPRC) Oscillator clock source which is 32.768 KHz. The WDT can be used to detect system software malfunctions by resetting the device if the WST is not cleared periodically in software. The WDT can be configured in Windowed mode or non-Windowed mode. Various WDT time-out periods can be selected using the WDT postscaler. The WDT can also be used to wake the device from Sleep or Idle mode.


  At the moment, I implement the primary function of the WDT is to reset the processor in the event of a software malfunction. I enable WDT with Non-Windowed mode, and the WDT will increment until it overflows or "times out". A WDT time-out will force a device Reset, except during Sleep or Idle modes. To prevent a WDT time-out Reset, my application always periodically clear the WDT by writing a key word 0x5743 to the WDTCLEKEY (WDTCON<31:16>) through a single 16-bit write (for some other devices, or by setting the WDTCLR (WDTCON<0>).


  The WDT is enabled or disabled by the device configuration bits or controlled through software by writing to the WDTCON register. In my application I just set the device configuration bits like below.


#pragma config WDTPS = PS32 // Watchdog Timer Postscaler (1:32)

#pragma config WDTSPGM = STOP // Watchdog Timer Stop During Flash Programming (WDT stops during Flash programming)

#pragma config WINDIS = NORMAL // Watchdog Timer Window Mode (Watchdog Timer is in non-Window mode)

#pragma config FWDTEN = OFF // Watchdog Timer Enable (WDT Disabled)

#pragma config FWDTWINSZ = WINSZ_25 // Watchdog Timer Window Size (Window size is 25%)

  The setting as above, the postscaler of Watchdog Timer is 32. It determines the period of Watchdog Timer overflow is 32ms. The FWDTEN Configuration bit is clear, so I need enable Watchdog Timer by software, and I also need a function to clear Watchdog and call this function periodically in the main loop. Below is my implementation of them.


  


void Wdt_Init(void)

{

WDTCONSET = 0x8000;

}


void Wdt_Refresh(void)

{

unsigned short *pWdtClear = (unsigned short *)0xBF800800 + 1;

*pWdtClear = 0x5743;

}


本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

Microchip公司的PIC32MZ EF系列是高達(dá)250MHz的集成浮點(diǎn)單元(FPU),具有廣泛的外設(shè)和包括局域網(wǎng)(CAN)的極好的連接選擇,工作電壓2.1V到 3.6V,DSP增強(qiáng)核具有四

關(guān)鍵字: Microchip pic32mz 處理器

使用的是STM32F407的板子,程序參考的是STM32F4xx固件庫的DAC_SignalsGeneration文件夾下的程序。官方例程分別使用了DAC的禁止生成波(DAC_WaveGeneration_None)的E...

關(guān)鍵字: dac dma STM32 timer 輸出正弦波

  An interrupt is an internal or external event that requires quick attention from the controller. The PIC32MZ...

關(guān)鍵字: interrupt pic32mz timer tutorial

  In my last post I implement "Key Debounce" with port polling, port polling is not very efficient....

關(guān)鍵字: pic32mz tutorial change notification

型號(hào):Watchdog,8XC552關(guān)鍵字:Watchdog,87C552單片機(jī),監(jiān)視定時(shí)器簡(jiǎn)介:介紹了以Philips公司的8XC552單片機(jī)為主控芯片開發(fā)的智能配電監(jiān)測(cè)儀硬件電路的組成和系統(tǒng)工作原理

關(guān)鍵字: Philips watchdog 嵌入式開發(fā)

  In my older blog "PIC32MZ tutorial -- Key Debounce", I shows how to acheive key debounce with port...

關(guān)鍵字: interrupt pic32mz tutorial external

本文將介紹看門狗驅(qū)動(dòng)的實(shí)現(xiàn)。目標(biāo)平臺(tái):TQ2440CPU:s3c2440內(nèi)核版本:2.6.301. 看門狗概述 看門狗其實(shí)就是一個(gè)定時(shí)器,當(dāng)該定時(shí)器溢出前必須對(duì)看門狗進(jìn)行"喂狗“,如果不這樣做,定時(shí)器溢出后則將...

關(guān)鍵字: s3c2440 watchdog 看門狗

#include #include #include #define uchar unsigned char#define uint unsigned int#define SET_LEDPORT...

關(guān)鍵字: watchdog 測(cè)試 程序

經(jīng)過千辛萬苦,今天終于完工PIC32MZ EC Starter Kit的ethernet bootloader項(xiàng)目。我將整個(gè)項(xiàng)目, 命名為PhnBootloader。它分為兩個(gè)部分。第一個(gè)部分是PC 端的host程序Ph...

關(guān)鍵字: bootloader ethernet pic32mz udp協(xié)議
關(guān)閉