高级会员
- 积分
- 535
- 威望
- 291
- 贡献
- 200
- 兑换币
- 14
- 注册时间
- 2009-3-7
- 在线时间
- 22 小时
|
2#
楼主 |
发表于 2009-3-7 14:00:48
|
只看该作者
/*同样的功能可以有不同的写法,借此比较一下*/
#include <hidef.h> /* common defines and macros */
#include <mc9s12dg128.h> /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
unsigned char Data[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
unsigned char Data1[8]={0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F};
void Delay(unsigned int Time)
{
unsigned char i;
for(i=0; i<125; i++)
for( ; Time>0; Time--);
}
void main(void)
{
unsigned char i;
DDRB=0xFF;
while(1)
{
for(i=0;i<8;i++)
{
PORTB=Data1;
Delay(50000);
Delay(50000);
}
}
}
[img][/img] |
|