STC8A8K64D4 Series Manual
#include "reg51.h"
#include "intrins.h"
sfr
P0M1
=
sfr
P0M0
=
sfr
P1M1
=
sfr
P1M0
=
sfr
P2M1
=
sfr
P2M0
=
sfr
P3M1
=
sfr
P3M0
=
sfr
P4M1
=
sfr
P4M0
=
sfr
P5M1
=
sfr
P5M0
=
sfr
AUXR
=
void INT1_Isr() interrupt 2
{
P0 = TL1;
P1 = TH1;
}
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;
AUXR = 0x40;
TMOD = 0x80;
TL1 = 0x00;
TH1 = 0x00;
while (INT1);
TR1 = 1;
IT1 = 1;
EX1 = 1;
EA = 1;
while (1);
}
Assembly code
;Operating frequency for test is 11.0592MHz
AUXR
DATA
0x93;
0x94;
0x91;
0x92;
0x95;
0x96;
0xb1;
0xb2;
0xb3;
0xb4;
0xc9;
0xca;
0x8e;
8EH
//TL1 is the low byte of the measured value
//TH1 is the high byte of the measured value
//1T mode
//Enable GATE, and enable timing when INT1 is 1
//Wait for INT1 to be low
//Start timer
//Enable INT1 falling edge interrupt
- 316 -
Need help?
Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?