用 codewarrior 写个跑马灯程序

来源:百度知道 编辑:UC知道 时间:2024/06/30 18:32:51
所用单片机为s12x128,今年飞思卡尔组委会发的芯片。想找个程序来试一下。

那我给你个我自己写的跑马灯程序 我是参加飞思卡尔赛车 这个程序已经在codewarrior上可以运行 在我的S12X128的单片机上烧写过了 可以用
调试一下 可以就给分,谢谢了。

void dly(int k)
{ int i;
for( i=0;i<k;i++);
}

void main(void) {

//unsigned char tab[8]={0xfe,0xfd,0xfb,0xf,0x7f,0x8f,0x9f,0xbf};
int i;
DDRB = 0xff;
PORTB = 0xfe;
while(1)
{PORTB = 0XFE;
for(i=0;i<8;i++)
{
// PORTB = tab[i];
dly(20000);
PORTB = PORTB*2+1;
}
}

}