STC8A8K64D4 Series Manual
-
busy = 0;
}
if (RI)
{
RI = 0;
}
}
void UartInit()
{
SCON = 0x50;
TMOD = 0x00;
TL1 = BRT;
TH1 = BRT >> 8;
TR1 = 1;
AUXR = 0x40;
busy = 0;
}
void UartSend(char dat)
{
while (busy);
busy = 1;
SBUF = dat;
}
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;
UartInit();
ES = 1;
EA = 1;
P_SW2 = 0x80;
UartSend(VREF_ADDR >> 8); // Read the high byte of the internal 1.19V reference signal source
UartSend(VREF_ADDR); // Read the low byte of the internal 1.19V reference signal source
while (1);
}
Assembly code
;Operating frequency for test is 11.0592MHz
CPUIDBASE EQU 0FDE0H
ID_ADDR EQU CPUIDBASE + 00H
VREF_ADDR EQU CPUIDBASE + 07H
F32K_ADDR EQU CPUIDBASE + 09H
T22M_ADDR EQU CPUIDBASE + 0BH ;22.1184MHz