中科因仑“3+1”工程特种兵精英论坛
标题:
ATMEGA8参考程序及其proteus仿真002、位定义闪烁灯设计实例二
[打印本页]
作者:
张衍波
时间:
2015-4-27 21:01
标题:
ATMEGA8参考程序及其proteus仿真002、位定义闪烁灯设计实例二
/********************************************************************
汇诚科技
网址:
http://www.ourhc.cn
产品有售淘宝店:
http://shop36330473.taobao.com
*********************************************************************/
#include <iom8v.h>
#include <macros.h>
/**********************************************************************
函数数据类型说明
**********************************************************************/
#define uchar unsigned char
#define uint unsigned int
/**********************************************************************
延时函数
**********************************************************************/
void delay(uint MS)
{
uint i,j;
for( i=0;i<MS;i++)
for(j=0;j<1141;j++); //1141是在8MHz晶振下,通过软件仿真反复实验得到的数值
}
/**********************************************************************
主函数
**********************************************************************/
void main()
{
DDRB=0XFF;
//PORTB=0XFF;
while(1)
{
PORTB|=BIT(3);//00001000
delay(1000);
PORTB&=~BIT(3);
delay(1000);
}
}
/**********************************************************************
结束
**********************************************************************/[attach]2468[/attach]
欢迎光临 中科因仑“3+1”工程特种兵精英论坛 (http://bbs.enlern.com/)
Powered by Discuz! X3.4