«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
more
Archives
Today
Total
관리 메뉴

ITGenerations

[avr] 도트매트릭스 순차적으로 깜빡이기 본문

Univ/AVR atmega128

[avr] 도트매트릭스 순차적으로 깜빡이기

ITGenerations 2017. 12. 8. 21:08

//source 5

// Dotmatrix 함수

#include <avr/io.h>

#include <util/delay.h>

unsigned char pattern[3]={0xFE,0xFD,0xFB};

void main()

{

int i=0;

DDRA=0xFF;

while(1)

{

msec_delay(500); //속도 조절 

if(++i==3) i=0;

PORTA = pattern[i];

}


}


void msec_delay(int n)

{

for(; n>0; n--){

_delay_ms(1); //속도 조절 

}

}