欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
stc12C5A60S2及以上的15系列單片機PCA捕獲,測量占空比,頻率怎么使用?
[打印本頁]
作者:
詩語凌楓
時間:
2018-8-3 11:25
標題:
stc12C5A60S2及以上的15系列單片機PCA捕獲,測量占空比,頻率怎么使用?
stc12C5A60S2 及以上的15系列 PCA捕獲,測量占空比,頻率怎么使用?下面是我寫的,寫到一半寫不下去了,求高人指點!!
#include <STC12C5A60S2.H>
#define uchar unsigned char
#define uint unsigned int
uchar t1,th1;
uint value;
void delay(uint a1);
void SendStr(unsigned char *s);
void SendByte(unsigned char dat);
void InitUART (void)
{
SCON = 0x50;
TMOD |= 0x20;
TH1 = 0xFD;
TR1 = 1;
EA = 1;
//ES = 1;
}
uint read(void)
{
uchar t1,th1;
uint value;
CCON=0;
CMOD=0x0A;
CCAPM1=0x20;
CR=1;
th1 = CCAP1H;
t1 = CCAP1L;
value = th1*256 + t1;
return value;
}
/******************************************/
void main()
{
InitUART();
read();
SendByte(CCAP1L);
SendByte(CCAP1H);
delay(600);
}
void SendByte(unsigned char dat)
{
SBUF = dat;
while(!TI);
TI = 0;
}
void SendStr(unsigned char *s)
{
while(*s!='\0')
{
SendByte(*s);
s++;
}
}
void delay(uint a1)
{
unsigned char a,b,c;
for(c=a1;c>0;c--)
for(b=142;b>0;b--)
for(a=120;a>0;a--);
}
作者:
wulin
時間:
2018-8-4 13:16
無標題.jpg
(247.83 KB, 下載次數: 44)
下載附件
2018-8-4 13:16 上傳
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1