这个程序哪有问题?为什么运行不了
#include "msp430x22x4.h"int zdxh,steps_down_con=3,tiaoshi;
int main( void )
{
P1OUT = 0;
P1DIR |= BIT0 ;//P1.0为输出方式
P2IE=0xc1;//p2.6/p2.7允许中断
P2IES=0x00;//上升沿
__bis_SR_register(GIE);
while(1)
{
}
}
#pragma vector=PORT2_VECTOR
__interrupt void Port_2(void)
{
zdxh=P2IFG&0xc1;
if(zdxh==128)
{
steps_down_con+=1;
P1OUT^=0x01;
}
if(zdxh==64)
{
steps_down_con-=1;
P1OUT^=0x01;
}
if(zdxh==1)
tiaoshi=1;
P2IFG=0;
}
程序总是进入不了中断? IO输出怎么进入中断? 怎么个上升沿下降沿 外部中断都是输入的 应该先设置方向再设置P1OUT吧?直接if(P2IFG&BIT6){} if(P2IFG&BIT7){} 怎么没有关狗?
页:
[1]