为什么用protues
仿真msp430流水灯与硬件仿真结果不一致,硬件仿真很好,到protues中等全变白了,而且没有流动
#include <msp430.h>
void delay(long t)
{
while(t)
t--;
}
void dis_init (void)
{
P2SEL =0;
P2DIR =0XFF;
P1DIR |=BIT4+BIT5;
}
void dis(char xx,char y)
{
P1OUT &=~BIT5;
P1OUT |=y;
P2OUT =xx;
delay(200);
}
void dis_16(int xx)
{
P1OUT &=~(BIT4+BIT5);
// delay(200);
P1OUT |=BIT4;
P2OUT =xx;
//delay(200);
P2OUT =0XFF;
P1OUT &=~(BIT4+BIT5);
P1OUT |=BIT5;
P2OUT =xx>>8;
//delay(200);
P2OUT =0XFF;
}
//char ll[9]={0,1,3,7,0x0f,0x1f,0x3f,0x7f,0xff};
int ll[16]={1,3,7,0xf,0x1f,0x3f,0x7f,0xff,0x1FF,0x3ff,0x7ff,0xfff,0x1fff,0x3fff,0x7fff,0xffff};
/*
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
dis_init();
for(;;)
{
for(char i=0;i<9;i++)
{
for( char k=0;k<30;k++)
dis(ll
,BIT4);
}
}
}
*/
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
dis_init();
for(;;)
{
for(char i=0;i<16;i++)
// for( int k=0;k<30;k++)
dis_16(ll);
}
}
-
一周热门 更多>