#include <pic.h>
unsigned long FrqCount,average;
main(){
while(1){
FrqCount=0;
T1CON=0b01110001;
TMR1H=(65536-(500000/8))>>8;
TMR1L=(65536-(500000/8))&0xFF;
PEIE=1;
TMR1IF=0;
TMR1IE=1;
while(!TMR1IF){
if(T0IF){
T0IF=0;
FrqCount++;
}
}
average=FrqCount*2;
}
}
16F648A,PICC
使用仿真软体在t1ckl口输入5k方波,average=0
if(T0IF){
T0IF=0;
FrqCount++;
}
这里没有运行,什么回事
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
__CONFIG(0x3F43);
unsigned long FrqCount,average;
main(){
TRISA4=1;
OPTION=0b11111111;
T0IF=0;
T0IE=0;
T1CON=0b00110001;
TMR1H=(65536-(100000/8))>>8;
TMR1L=(65536-(100000/8))&0xFF;
while(1){
FrqCount=0;
PEIE=0;
TMR1IF=0;
TMR1IE=0;
while(!TMR1IF){
if(T0IF){
T0IF=0;
FrqCount++;
}
}
average=FrqCount*10;
}
}
今天改了程序,有了數值,但5k信號
average只讀出100
誰能幫幫我
一周热门 更多>