<pre>
void timer1_ovf_isr(void)
{
static unsigned char Ph0=0;
//PORTB &=0xEF;
TCNT1H = 0xE3; //reload counter high value
TCNT1L = 0xE1; //reload counter low value
PORTA=temp;
temp<<=1;
if(temp==0x00)
temp=0x01;
//PORTB |=0x10;
switch(Ph0)
{
case 0:
LED_TEST_H;
//PORTB &=0xEF;
Ph0 = 1;
break;
case 1:
LED_TEST_L;
//PORTB |=0x10;
Ph0 = 0;
break;
default:
Ph0 = 0;
}
}
用switch翻转PORTB 4正常,但是进中断清PORTB 4,出中断置高PORTB 4,程序跑起来PORTB 4一直低电平。
</pre> |