ICCAVR学习小程序
【ICCAVR学习小程序】 #include #include /* This seEMSto produce the right amount of delay for theLEDto be * seen */ void Delay() { unsigned char a, b; for (a = 1; a; a++) for (b = 1; b; b++) ; } void LED_On(int i) { PORTB = ~BIT(i);/* l...
【ICCAVR学习小程序】#include
#include
/* This seEMSto produce the right amount of delay for theLEDto be
* seen
*/
void Delay() {
unsigned char a, b;
for (a = 1; a; a++)
for (b = 1; b; b++)
;
}
void LED_On(int i) {
PORTB = ~BIT(i);/* low output to turn LED on */
Delay();
}
void main() {
int i;
DDRB = 0xFF;/* output */
PORTB = 0xFF;/* all off */while (1) {
/* forward march */
for (i = 0; i < 8; i++)
LED_On(i);
/* backward march */
for (i = 8; i > 0; i--)
LED_On(i);
/* skip */
for (i = 0; i < 8; i += 2)
LED_On(i);
for (i = 7; i > 0; i -= 2)
LED_On(i);
}
}
推荐阅读
- 小户型餐厅装修设计基本常识
- 小户型阳台改装设计造型有几种方式?
- 小空间里的现代感原木色打造魅力家
- 迷你小厨房方寸之地充分利用
- 小型超市装修有几个亮点更具美感呢?
- 小客厅背景墙 如何巧妙设计?
- 小户型也能在家吃顿霸气年夜饭
- 如何将小户型房间设计成大别墅
- 学习单片机最重要的八个步骤
- 小米装修装修报价 小米装修方式