- #pragma vector=TIMERA1_VECTOR
- __interrupt void Timer_A (void)
- {
- static unsigned int str[2]={0};
- static unsigned int temp= 0;
- // static unsigned int overflow= 0;
- unsigned int counter;
- 这段代码测周期 在0-10US可以显示 在大就无法显示了
- unsigned int dN[5];
-
- // switch (TAIV) //向量查询
- {
- // case 2: //捕获中断
- str[temp]=TACCR1;
- temp++;
- if(temp == 2)
- {
- temp=0;
- counter =str[1]-str[0];
- dN[4]=counter/10000;
- dN[3]=counter%10000/1000;
- dN[2]=(counter%1000)/100;
- dN[1]=(counter%100)/10;
- dN[0]=counter%10;
- Disp1Char(9,0,dN[4]+0x30);
- Disp1Char(10,0,dN[3]+0x30);
- Disp1Char(11,0,dN[2]+0x30);
- Disp1Char(12,0,dN[1]+0x30);
- Disp1Char(13,0,dN[0]+0x30);//0x2e是小数点对应的ASCII码值
- delay_ms(1000);
- }
- }
|