作者dexders (( ̄﹁ ̄;))
看板ASM
標題Re: [問題] keilc uVision的問題
時間Sat Mar 15 01:02:41 2008
#include <reg51.h>
#define LED P2
void delay(unsigned int x);
unsigned char output[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
main()
{
unsigned char i ;
LED=0xfe;
while(1)
{
for(i=0;i<7;i++)
{
delay(100);
LED=~output[i];
}
for(i=7;i>0;i--)
{
delay(100);
LED=~output[i];
}
}
}
void delay(unsigned int x)
{
unsigned int i,j;
for (i=0;i<x;i++)
for (j=1;j<=600;j++);
}
試試看這樣
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.175.117.84