STC8A8K64D4 Series Manual
5.1.6 Download using U8W tool, Support ISP online and offline download, also support emulation .. 47
5.1.7 Software simulation USB ISP download directly, and does not support simulation .................... 49
5.1.8 Microcontroller Power supply Control Reference Circuit ............................................................ 50
6. Clock, Reset, Power saving mode and Power Management ..................................................................... 51
6.1 System Clock Control ............................................................................................................................ 51
6.1.1 System clock selection register (CKSEL) .................................................................................... 51
6.1.2 Clock Division register (CLKDIV) .............................................................................................. 51
6.1.3 Internal high speed high precision IRC control register (HIRCCR) ............................................. 52
6.1.4 External Oscillator control register (XOSCCR) ........................................................................... 52
6.1.5 Internal 32KHz low speed IRC control register (IRC32KCR) ..................................................... 52
6.1.6 Main clock output control register (MCLKOCR) ........................................................................ 53
6.2 STC8A8K64D4 series internal IRC frequency adjustment ................................................................... 54
6.2.1 IRC band selection register (IRCBAND) ..................................................................................... 54
6.2.2 Internal IRC Frequency Adjustment Register (IRTRIM) ............................................................. 54
6.2.3 Internal IRC frequency trim register (LIRTRIM) ......................................................................... 54
6.2.4 Clock Divide Register (CLKDIV) ................................................................................................ 54
6.2.5 Example of fine-tuning to get a user frequency of 3MHz ............................................................ 56
6.3 System reset ........................................................................................................................................... 59
6.3.1 Watch dog timer reset (WDT_CONTR) ..................................................................................... 59
6.3.2 Software reset (IAP_CONTR) .................................................................................................... 60
6.3.3 Low voltage reset (RSTCFG) ....................................................................................................... 61
6.3.4 Low voltage power-on reset reference circuit (generally not required) ........................................ 61
6.3.5 Low voltage button reset reference circuit ................................................................................... 61
6.3.6 Traditional 8051 high voltage power-on reset reference circuit ................................................... 62
6.4 External crystal oscillator and external clock circuit ............................................................................. 63
6.4.1 External crystal input circuit ......................................................................................................... 63
6.4.2 External clock input circuit (P1.6 cannot be used as general I/O) ................................................ 63
6.5 Clock stop / Power Saving Mode and System Power Management ...................................................... 63
6.5.1 Power control register (PCON) .................................................................................................... 63
6.6 Power-down wake-up timer ................................................................................................................... 65
6.6.1 Power-down wake-up timer count register (WKTCL,WKTCH).................................................. 65
6.7 Example Routines .................................................................................................................................. 66
6.7.1 System Clock Soure Selection ...................................................................................................... 66
6.7.2 Main Clock Output ....................................................................................................................... 68
6.7.3 Application of Watch-dog Timer .................................................................................................. 70
6.7.4 User Defined Downloading by Using Software Reset ................................................................. 72
6.7.5 Low Voltage Detection ................................................................................................................. 73
6.7.6 Power Saving Mode...................................................................................................................... 75
6.7.7 Wake up MCU from Power Saving Mode using INT0/INT1/INT2/INT3/INT4 interrupts.......... 77
6.7.8 Wake up MCU from Power Saving Mode using T0/T1/T2/T3/T4 pin interrupts......................... 81
6.7.9 Wake up MCU from Power Saving Mode using RxD/RxD2/RxD3/RxD4 pin interrupts ............ 85
6.7.10 Wake up MCU from Power Saving Mode using I2C SDA pin .................................................. 88
6.7.11 Wake up MCU from Power Saving Mode using Power-down wake-up timer ........................... 90
6.7.12 Wake up MCU from Power Saving Mode using LVD interrupt ( Recommended for use with