ATMAGE 16 的C语言程序
ATMAGE 16 的C语言程序 ............................................................................................. 1
一、PB0 口的 PB0.1 LED 发光管闪烁的程序: .................................................... 3 二、PA0、PB0、PC0口的LED 发光管闪烁的程序: ............................................... 5 三、I/O口的输入与输出............................................................................................ 6 四、跑马灯 ............................................................................................................... 8 五、数码管计数显示设计 ........................................................................................ 10 六、控制直流电机正反转 ........................................................................................ 16 七、单片机的定时器(T/C0)应用 .......................................................................... 20 AVR原理图 ............................................................................................................ 24
一、PB0 口的 PB0.1 LED 发光管闪烁的程序:
#include
{
unsigned char i, j, k,led=0; DDRB=0xFF; /* all outputs */ while (1) {
if(led)
PORTB|=0X01; /* |使最后一位为1 */