今天想用LaunchPad G2产生两个简单的PWM波,并且想使用中断来控制P1.0和P1.6的LED来闪烁,可是遇到这个问题
Error connecting to the target:
Could not find device (or device not supported)
编译环境是CCS5.4
这个是我的程序,
#include <msp430g2553.h>
void Timer_A_init();
void GPIO_init();
void main(void)
{
WDTCTL = WDTPW | WDTHOLD;
GPIO_init();
Timer_A_init();
_bis_SR_register(LPM3_bits + GIE);
}
void GPIO_init()
{
P1DIR |= BIT0 + BIT6;
P1OUT |= BIT0;
P1OUT |= BIT6;
}
void Timer_A_init()
{
TACTL = TASSEL_2 + MC_1;
TACCTL1 = CCIE;
TACCTL2 = CCIE;
TACCR0 = 50000;
TACCR1 = 20000;
TACCR2 = 30000;
}
#pragma vector=TIMER0_A1_VECTOR
__interrupt void Timer_A(void)
{
switch(TAIV)
{
case 2: P1OUT ^= BIT0; break;
case 4: P1OUT ^= BIT6; break;
default: break;
}
}
此帖出自
小平头技术问答
我有三块芯片,换了之后还是这样~比较囧,而且原来可以用的程序也烧不进去了~不会是都坏了吧
一周热门 更多>