EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Application of Watch-Dog Timer

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
-
- 70 -
MOV P5M0, #00H
MOV P5M1, #00H
MOV P_SW2,#80H
; MOV A,#01H ;Main clock output to P5.4
; MOV A,#02H ;Divide the main clock by 2 and output to P5.4
MOV A,#04H ;Divide the main clock by 4 and output to P5.4
; MOV A,#84H ;Divide the main clock by 4 and output to P1.6
MOV DPTR,#MCLKOCR
MOVX @DPTR,A
MOV P_SW2,#00H
JMP $
END
6.7.3 Application of Watch-dog Timer
C language code
// Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
sfr WDT_CONTR = 0xc1;
sbit P32 = P3^2;
sfr P0M1 = 0x93;
sfr P0M0 = 0x94;
sfr P1M1 = 0x91;
sfr P1M0 = 0x92;
sfr P2M1 = 0x95;
sfr P2M0 = 0x96;
sfr P3M1 = 0xb1;
sfr P3M0 = 0xb2;
sfr P4M1 = 0xb3;
sfr P4M0 = 0xb4;
sfr P5M1 = 0xc9;
sfr P5M0 = 0xca;
void main()
{
P0M0 = 0x00;
P0M1 = 0x00;
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P3M0 = 0x00;
P3M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
// WDT_CONTR = 0x23; //Watchdog enabled, overflow time is about 0.5s
WDT_CONTR = 0x24; //Watchdog enabled, overflow time is about 1s
// WDT_CONTR = 0x27; //Watchdog enabled, overflow time is about 8s
P32 = 0; //Test port

Table of Contents

Related product manuals