#include <msp430x14x.h>
//#include<intrins.h>
#define uint unsigned int
void delay(long c);
void main( void )
{
uint i=;
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
P2DIR=0x0f;
P2OUT=0x0e;
while()
{
for(i=;i<;i++)
{
delay();
P2OUT<<=;
P2OUT|=0x01;
if(P2OUT==0xef)
{
P2OUT=0x0b;
}
}
//P2OUT=0x0d;
for(i=;i<;i++)
{
delay();
P2OUT>>=;
P2OUT|=0x08;
}
P2OUT=0x0e;
} } void delay(long c)
{
while(c--);
}
感觉自己对16进制掌握的不太熟悉,调了好一会才出效果