logo
HomeAbout  |  Products  |  ApplicationsDownload  |  Contact Us  |  中文
 
Home-> Products-> 8-bit MCU
 
IC Induction
Develop & Tool
Application Project
Customer Service
 
Quick Coding
1 IO Ports 2 AD Converter
3 Timers 4 Capture
5 Compare 6 PWM 7 Interval Timer and Buzzer 8 External Interrupts
9 SPI 10 UART 11 LVR 12 Watch Dog Timer
13 STOP Mode 14 HALT Mode    

12 Watch Dog Timer

1. Enable Watchdog (also active in STOP mode); Set WDI clock rate as 25000Hz/512 = 48.8 Hz and WDT reset clock rate as 25000Hz/512/8 = 6.1Hz, that is, the watchdog will reset when the eighth WDI occurs.

;After enabling Watchdog in IDE, perform the following settings
;Note :The only way to modify the content of control registers located between $30 and $36 is
;by double writing access with certain address.
  lda   #(C_WDT_SCKEN+C_WDT_Div_512)
  sta   P_WDT_Ctrl
  sta   P_WDT_Ctrl
  set   P_INT_Flag0,CB_INT_WDIF
  set   P_INT_Ctrl0,CB_INT_WDIE
  cli

2. Enable Watchdog (also active in STOP mode); Set WDT reset clock rate as 25000Hz/512/8 = 6.1Hz and no WDI occurs.

;After enabling Watchdog in IDE, perform the following settings
;Note :The only way to modify the content of control registers located between $30 and $36 is
;by double writing access with certain address.
  lda   #(C_WDT_SCKEN+C_WDT_Div_512)
  sta   P_WDT_Ctrl
  sta   P_WDT_Ctrl

3. Enable Watchdog (inactive in STOP mode); Set WDI clock rate as 25000Hz/512 = 48.8 Hz and WDT reset clock rate as 25000Hz/512/8 = 6.1Hz, that is, the watchdog will reset when the eighth WDI occurs.

; After enabling Watchdog in IDE, perform the following settings
;Note :The only way to modify the content of control registers located between $30 and $36 is
;by double writing access with certain address.
  lda   #C_WDT_Div_512
  sta   P_WDT_Ctrl
  sta   P_WDT_Ctrl
  set   P_INT_Flag0,CB_INT_WDIF
  set   P_INT_Ctrl0,CB_INT_WDIE
  cli

4. Enable Watchdog (inactive in STOP mode); Set WDT reset clock rate as 25000Hz/512/8 = 6.1Hz and no WDI occurs.

;After enabling Watchdog in IDE, perform the following settings
;Note :The only way to modify the content of control registers located between $30 and $36 is
;by double writing access with certain address.
  lda   #C_WDT_Div_512
  sta   P_WDT_Ctrl
  sta   P_WDT_Ctrl
Copyright © BEIJING SUNNORTH TECHNOLOGY CO., LTD Web site:mcu.sunplusmcu.com online real name:凌阳单片机
Unauthorized copy or republish to the content of this website is forbidden. Any one cannot resume on ICP备05061966号