Download Print this page

STC micro STC8A8K64D4 Series Reference Manual page 546

Advertisement

STC8A8K64D4 Series Manual
void PCA_Isr() interrupt 7
{
if (CF)
{
CF = 0;
cnt++;
}
if (CCF0)
{
CCF0 = 0;
count0 = count1;
((unsigned char *)&count1)[3] = CCAP0L;
((unsigned char *)&count1)[2] = CCAP0H;
((unsigned char *)&count1)[1] = cnt;
((unsigned char *)&count1)[0] = 0;
length = count1 – count0;
}
}
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;
cnt = 0;
count0 = 0;
count1 = 0;
length = 0;
CCON = 0x00;
CMOD = 0x09;
CL = 0x00;
CH = 0x00;
CCAPM0 = 0x11;
CCAPM0 = 0x21;
CCAPM0 = 0x31;
CCAP0L = 0x00;
CCAP0H = 0x00;
CR = 1;
EA = 1;
while (1);
}
Assembly code
;Operating frequency for test is 11.0592MHz
CCON
DATA
0D8H
//PCA timing overflow times+1
//Back up the last captured value
//length saved is the captured pulse width
//User variable initialization
//PCA clock is the system clock, enable PCA timing interrupt
//PCA module 0 is 16-bit capture mode (falling edge capture)
//PCA module 0 is 16-bit capture mode (falling edge capture)
//PCA module 0 is 16-bit capture mode (falling edge capture)
//Start PCA timer
- 530 -

Advertisement

loading
Need help?

Need help?

Do you have a question about the micro STC8A8K64D4 Series and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Micro stc8a8k64d4-64pinMicro stc8a8k64d4-48pin