- UID
- 344042
- 性别
- 男
|
void initialize_PB(void)
{
TCTL4 = 0x02;
PBCTL = 0x40;
PACN0 = 0x00;
PACN1 = 0x00;
}
void get_speed(void)
{
word static oldValue1,oldValue2;
if(MCFLG == 0x80)
{ count = (0xFFFF - oldValue + PACN10);
MCFLG =0x80;}
else count = abs(PACN10 - oldValue);
count = PACN10 - oldValue2;
oldValue2 = oldValue1;
oldValue1 = PACN10;
PACN32 = count;//显示计数值
}
程序的目的是每隔10MS计数,通过相减计数,但是怎么试都是0,怎么回事啊。PACN10明明有读数,但感觉好像不能执行oldValue1 = PACN10,郁闷阿 |
|