我用MSP430G2 LANUCHPAD+430BOOST做了跑马灯
[复制链接]
昨天参加东莞MSP430 DAY,领了个boost board,用之前TI提供的launchpad做了个跑马灯,嗯,蛮方便的。
#include
/*
* ======== Grace related declaration ========
*/
unsigned char temp;
extern void CSL_init(void);
/*
* ======== main ========
*/
int main(void)
{
CSL_init();
while(1)
{
int i, j;
temp = 0x10;
P1OUT |= 0x04;
for(i = 0; i < 4; i++)
{
P1OUT = temp;
temp <<= 1;
temp &= 0xF0;
temp |= 0x04;
if(temp == 0x04)
{
temp = 0x80;
}
for (j = 30000; j>0; j--); // Delay
for (j = 30000; j>0; j--); // Delay
}
P1OUT |= 0x04;
for(i = 0; i < 4; i++)
{
P1OUT = ~temp;
temp >>= 1;
temp &= 0xF0;
temp |= 0x04;
if(temp == 0x04)
{
temp = 0x10;
}
for (j = 30000; j>0; j--); // Delay
for (j = 30000; j>0; j--); // Delay
}
// P1OUT = temp; // Set P1.6 LED on
//
// P1OUT <<= 1; // Reset P1.6 LED off
// if(P1OUT = 0xFF)P1OUT = 0x01;
// __bis_SR_register(LPM3_bits + GIE); // Enter LPM3
}
}
void watchdog_timer(void)
{
}
|