[Atmel] 用AtmelStudio6.2跑mega16例程(24) 闪灯

[复制链接]
1482|0
 楼主| ddllxxrr 发表于 2014-10-2 17:15 | 显示全部楼层 |阅读模式
这个闪灯用的延时同以前的不一样,是用Studio自身的延时,十分方便,这一点上,51就不如AVR啦!

  1. /*
  2. * GccApplication8.c
  3. *
  4. * Created: 2014-10-2 17:03:12
  5. *  Author: Administrator
  6. */

  7. #define F_CPU 8000000UL
  8. #include <avr/io.h>
  9. #include <util/delay.h>

  10. int main(void)
  11. {
  12.     DDRC = 0xFF;
  13.         while(1)
  14.     {
  15.         //TODO:: Please write your application code
  16.                 PORTC ^= _BV(PC0);
  17.                 _delay_ms(120);
  18.                  
  19.     }
  20. }

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:http://shop34182318.taobao.com/ http://shop562064536.taobao.com

2404

主题

7002

帖子

68

粉丝
快速回复 在线客服 返回列表 返回顶部