高级会员
主题
帖子
积分1194
阅读权限30
注册时间2010-2-24
最后登录1970-1-1
在线时间 小时
|
本帖最后由 baof 于 2010-6-24 13:33 编辑
我也来个深呼吸
/******************************************************************************
程序功能:1位呼吸灯
备注: 内部8M RC时钟
******************************************************************************/
#include <iom16v.h>
#define LED PORTB
unsigned char i, j, k, Turn = 1;
void main()
{
LED = 0x01;
DDRB = 0x01;
while(1)
{
Turn = ~Turn;
for(i=0; i<20; i++)
{
while(--j)
{
do
{
if(k < (i << 3))
LED = Turn | 0xfe;
else
LED = ~Turn | 0xfe;
}
while(++k != 150);
k = 0;
}
}
}
} |
|