#include "msp430g2553.h"
#include "intrinsics.h"
unsigned int count=1;
unsigned int a=1;
int main(void)
{
WDTCTL=WDTPW+WDTHOLD;
BCSCTL1 = CALBC1_16MHZ; // Set range
DCOCTL = CALDCO_16MHZ; // Set DCO step + modulation
BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO
P1DIR =0xf9 ; // Set P1.1 P1.2to input direction
P1OUT=0X01; // LED off
P1IES = 0x00; // P1.1 P1.2Hi/lo edge
P1IFG = 0x00; // P1.1,P1.2 IFG cleared
P1IE = 0x06; // P1.1 P1.2interrupt enabled
// _EINT();
while(1)
{
count=a;
while(count--);
P1OUT^=0X41;
count=a;
while(count--);
P1OUT^=0X41;
}
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
if (P1IFG & BIT1)
{
count+=100;
P1IFG &= ~BIT1; // P1.1 IFG cleared
}
}
我想通过按键来调节输出PWM的频率,为什么_EINT();
开了,输出的信号就不是PWM了,输出就没有了?