void main()
{
Init_Timer1();
LCD_Init();
LCD_Clear();
LCD_Write_String(0,0," Capacitance ");
LCD_Write_String(0,1,"Cap: UF");
while(1)
{
if(k1==0){TR0=1;TR1=1;}
if(k2==0){asd=0;}
if(asd>1000000)
{LCD_Write_Char(5,1,q1[asd/100000000]);
LCD_Write_Char(6,1,q1[asd%100000000/10000000]);
LCD_Write_Char(7,1,q1[asd%10000000/1000000]);
LCD_Write_Char(8,1,'.');
LCD_Write_Char(9,1,q1[asd%1000000/100000]);
LCD_Write_Char(10,1,q1[asd%100000/10000]);
LCD_Write_Char(11,1,q1[asd%10000/1000]);
LCD_Write_Char(14,1,'U');
LCD_Write_Char(15,1,'F');}
else
{
LCD_Write_Char(5,1,q1[asd%1000000/100000]);
LCD_Write_Char(6,1,q1[asd%100000/10000]);
LCD_Write_Char(7,1,q1[asd%10000/1000]);
LCD_Write_Char(8,1,'.');
LCD_Write_Char(9,1,q1[asd%1000/100]);
LCD_Write_Char(10,1,q1[asd%100/10]);
LCD_Write_Char(11,1,q1[asd%10]);
LCD_Write_Char(14,1,'N');
LCD_Write_Char(15,1,'F');
}
}
}
void t0() interrupt 1 using 1
{
TH0=(65536-50000)/256;//重新赋值 10ms
TL0=(65536-50000)%256; //1us
i++;
if(i==60) //使用三秒钟采集
{i=0;
num=num1*65535+TH1*256+TL1;
asd=470000000/num*3;
TR0=0;TR1=0;
TH0=(65536-50000)/256;//重新赋值 10ms
TL0=(65536-50000)%256; //1us
num1=TH1=TL1=0;
}
}
void Timer1_isr(void) interrupt 3
{
TH1=0x00; //重新给定初值
TL1=0x00;
num1++;
}
下面这三个程序分别是什么意思?
LCD_Write_Char(5,1,q1[asd/100000000]);
num=num1*65535+TH1*256+TL1;
asd=470000000/num*3;
|