STC8A8K64D4 Series Manual
-
SETB ES
SETB EA
MOV DPTR,#F32K
CLR A
MOVC A,@A+DPTR ;Read high byte of 32K frequency
LCALL UART_SEND
INC DPTR
CLR A
MOVC A,@A+DPTR ;Read low byte of 32K frequency
LCALL UART_SEND
LOOP:
JMP LOOP
END
7.5.9 Read the Frequency of 32K Power-down Wake-up Timer (Read from
RAM)
C language code
//Operating frequency for test is 11.0592MHz
#include "reg51.h"
#include "intrins.h"
#define FOSC 11059200UL
#define BRT (65536 - FOSC / 115200 / 4)
sfr AUXR = 0x8e;
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;
bit busy;
int *F32K;
void UartIsr() interrupt 4
{
if (TI)
{
TI = 0;
busy = 0;
}
if (RI)
{
RI = 0;