89S52频率计源代码
#include sbit P1_6 = P1^6; sbit P1_7 = P1^7; sbit P3_2 = P3^2; unsigned int int0_Count = 0; unsigned char int1_Count = 0; unsigned char int1_Goon = 0; unsigned long int1_Result = 0; unsigned int int3_Count = 0; void int3() interrupt 3 { TH1 = 0; TL1 = 0; ++int3_Count; } void int1() interrupt 1 { if(++int1_Count == 20)//1s定时完毕,结束计时 { TR0 = 0; EX0 = 0; int1_Result = int0_Count * 100UL; int1_Goon = 1; return; }
用户评论