SlideShare a Scribd company logo
1 of 11
Download to read offline
์ž„๋ฒ ๋””๋“œ์ž„๋ฒ ๋””๋“œ ๋งˆ์ดํฌ๋กœํ”„๋กœ์„ธ์„œ๋งˆ์ดํฌ๋กœํ”„๋กœ์„ธ์„œ
ํ”„๋กœ๊ทธ๋ž˜๋ฐํ”„๋กœ๊ทธ๋ž˜๋ฐ ์‹ค์ „์‹ค์ „
์ œ์ž‘์ œ์ž‘ :: ๋„ค๋„ค ๋กœ๋กœ ํ…Œํ…Œ ํฌํฌ
๊ฐ•์˜๊ฐ•์˜ :: ๊น€๊น€ ์ข…์ข… ํ˜•ํ˜•
--22--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
ATMEGA128ATMEGA128์˜์˜ ์‹ค์ „์‹ค์ „โ… โ… 
1. Dotmatrix ๊ตฌ๋™์›๋ฆฌ
2. Heart ์‹ค์Šต
3. Bitman ์‹ค์Šต
--33--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-1 Dotmatrix ๊ตฌ๋™ ์›๋ฆฌ
โŠ™ LED๋ฅผ ๋งคํŠธ๋ฆญ์Šค(ํ–‰๋ ฌ)์˜ ํ˜•ํƒœ๋กœ ๋‚˜์—ดํ•œ ๊ฒƒ
- 5ร—7, 8ร—8, 16ร—16 ๋“ฑ์˜ ๋งคํŠธ๋ฆญ์Šค๋กœ ์ด๋ฃจ์–ด์ง„ ๊ฒƒ
โŠ™ ์นผ๋ผ ์ˆ˜์— ๋”ฐ๋ผ ์‹ฑ๊ธ€(single, ๋‹จ์ƒ‰)๋˜๋Š” ๋ฉ€ํ‹ฐ(multi, ๋‹ค์ƒ‰)
โŠ™ LED๋ฅผ ์‚ฌ์šฉํ•œ ๋””์Šคํ”Œ๋ ˆ์ด ์žฅ์น˜๋Š” ๊ณ ํœ˜๋„์— ์ˆ˜๋ช…์ด ๊ธธ๋‹ค๋Š” ์žฅ์ 
โŠ™ ๋„ํŠธ ๋งคํŠธ๋ฆญ์Šค๋ฅผ ๊ตฌ๋™์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•
- ์Šคํƒœํ‹ฑ๊ตฌ๋™(static drive)
: ์‹œํ”„ํŠธ ๋ ˆ์ง€์Šคํ„ฐ์˜ ๋น„ํŠธ๋ฅผ LED ๊ฐฏ ์ˆ˜ ๋งŒํผ ์ค€๋น„ํ•˜๊ณ  ์—ฌ๊ธฐ์— ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ด์–ด ์ ๋“ฑํ•˜๋Š”
๋ฐฉ์‹์œผ๋กœ ํ•œ ๋ฒˆ์— ๋ชจ๋“  LED๋ฅผ ON/OFFํ•จ
- ๋‹ค์ด๋‚˜๋ฏน๊ตฌ๋™(dynamic drive)
: ์Šค์บ”๋ผ์ธ๊ณผ ๋ฐ์ดํ„ฐ๋ผ์ธ์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์Šค์บ”๋ผ์ธ์— ์˜ํ•ด ๊ฐ ํ–‰ ๋˜๋Š” ์—ด์„ 1ํ–‰์”ฉ ์Šค์บ”ํ•˜๋ฉด์„œ
๋ฐ์ดํ„ฐ๋ผ์ธ์— ์˜ํ•ด ๋™๊ธฐ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ์‹
โŠ™ ๋‹ค์ด๋‚˜๋ฏน ๋“œ๋ผ์ด๋ธŒ๋ฐฉ์‹์€ ์Šคํƒœํ‹ฑ ๋“œ๋ผ์ด๋ธŒ์— ๋น„ํ•ด ํœ˜๋„๊ฐ€ ๋‚ฎ๊ณ , ์Šค์บ”์ฃผํŒŒ์ˆ˜๊ฐ€ ๋‚ฎ์€ ๊ฒฝ์šฐ์—
๊นœ๋ฐ•๊ฑฐ๋ฆผ์ด ์ผ์–ด๋‚œ๋‹ค๋Š” ์ ์—์„œ๋Š” ๋‹ค์†Œ ๋–จ์–ด์ง„๋‹ค๊ณ  ํ•  ์ˆ˜ ์žˆ์œผ๋‚˜ ๊ตฌ๋™ํšŒ๋กœ๊ฐ€ ๊ฐ„๋‹จํ•˜๊ธฐ ๋•Œ๋ฌธ์—
์ €๊ฐ€๊ฒฉ์œผ๋กœ ๋Œ€ํ™”๋ฉด์˜ ๊ตฌ์„ฑ์— ์ ํ•ฉ
--44--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-2 Dotmatrix ๊ตฌ์กฐ
--55--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-3 Dotmatrix 8*8 ํšŒ๋กœ๋„
LED17
Red
LED28
Red
LED29
Red
LED23
Red
LED30
Red
LED22
Red
LED21
Red
LED25
Red
LED24
Red
LED20
Red
LED27
Red
LED26
Red
LED19
Red
LED31
Red
LED32
Red
LED18
Red
LED33
Red
COL1
LED44
Red
LED45
Red
LED39
Red
COL2
LED46
Red
COL3
LED38
Red
COL4
LED37
Red
COL5
LED41
Red
COL6
LED40
Red
LED36
Red
COL7
LED43
Red
COL8
LED42
Red
LED35
Red
LED47
Red
LED48
Red
LED34
Red
LED6
Red
LED49
Red
LED60
Red
LED61
Red
LED55
Red
LED62
Red
LED54
Red
LED53
Red
LED4
Red
LED8
Red
LED57
Red
LED56
Red
LED52
Red
LED59
Red
LED58
Red
LED51
Red
LED63
Red
LED64
Red
LED50
Red
LED3
Red
LED5
Red
LED2
Red
LED7
Red
ROW2
ROW1
ROW7
ROW8
ROW5
ROW6
ROW3
ROW4
PB6
PB5
PB4
PB3
PB2
PB1
PB0
PC6
PC5
PC4
PC3
PC2
PC1
PC0
PB7
PC7
LED9
Red
LED15
Red
LED14
Red
LED13
Red
LED16
Red
LED12
Red
LED11
Red
LED10
Red
LED1
Red
--66--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-4 Heart ์‹ค์Šต 1
โ˜ž ํ•˜ํŠธ ๋ชจ์–‘์„ ์•„๋ž˜๋กœ ์‰ฌํ”„ํŠธํ•œ ํ›„ ๋‹ค์‹œ ์›์ƒํƒœ๋กœ ๋ณต๊ท€ํ•˜๋Š” ์žฅ๋ฉด ๋“ฑ์„ ๋ฐ˜๋ณตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
flash unsigned char M[1][25]={
{1,2,3,4,5,6,8,9,7,6,5,4,3,2,1,12,10,11,10,12,13,1,9,1,0}
};
flash unsigned char P[14][8]={
{0x66,0xFF,0xFF,0xFF,0x7E,0x3C,0x18,0x00},
{0x66,0xFF,0xFF,0xFF,0x7E,0x3C,0x18,0x00},
{0x00,0x66,0xFF,0xFF,0xFF,0x7E,0x3C,0x18},
{0x00,0x00,0x66,0xFF,0xFF,0xFF,0x7E,0x3C},
{0x00,0x00,0x00,0x66,0xFF,0xFF,0xFF,0x7E},
{0x00,0x00,0x00,0x00,0x66,0xFF,0xFF,0xFF},
{0x00,0x00,0x00,0x00,0x00,0x66,0xFF,0xFF},
{0x00,0x00,0x00,0x00,0x00,0x00,0x66,0xFF},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x66,0x99,0x81,0x81,0x42,0x24,0x18,0x00},
{0x00,0x66,0x99,0x81,0x81,0x42,0x24,0x18},
{0x66,0xFF,0xDB,0xC3,0x66,0x3C,0x18,0x00},
{0x66,0xFF,0xFF,0xE7,0x7E,0x3C,0x18,0x00}
};
#include <mega128.h>
#include <delay.h>
typedef unsigned char u08;
typedef unsigned int u16;
unsigned char line=0;
unsigned char patt=0;
unsigned char mod=0, num_mod=0;
unsigned char time=0;
unsigned char dir=0; //์ƒํ•˜์ขŒ์šฐ๋ฐฉํ–ฅ๊ฒฐ์ •์œผ๋กœ ๋””์Šคํ”Œ๋ ˆ์ด ๋ฐฉํ–ฅ ์„ ํƒ
unsigned char temp_led, temp_line;
/*
๋ฐฐ์—ด P๋Š” ๊ฐ ๋™์ž‘๋“ค์ด ๋„ํŠธ ๋งคํŠธ๋ฆญ์Šค์— ํ‘œ์‹œ๋˜๋Š” ๋ฐ์ดํ„ฐ์ด๊ณ (ํ•˜๋‚˜ํ•˜
๋‚˜์˜ ์ •์ง€๋ชจ์Šต)
๋ฐฐ์—ด M์€ ๊ทธ ๋™์ž‘๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜์—ฌ ํ•˜๋‚˜์˜ ์›€์ง์ž„์ด ๋˜๋„๋ก ํ•œ
๋‹ค.
*/
--77--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-4 Heart ์‹ค์Šต 2
โ˜ž ํ•˜ํŠธ ๋ชจ์–‘์„ ์•„๋ž˜๋กœ ์‰ฌํ”„ํŠธํ•œ ํ›„ ๋‹ค์‹œ ์›์ƒํƒœ๋กœ ๋ณต๊ท€ํ•˜๋Š” ์žฅ๋ฉด ๋“ฑ์„ ๋ฐ˜๋ณตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
void main(void)
{
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;
TCCR0 = 0x06; // clk/256
TCNT0 = 0xe3;
TIMSK = 0x01; // enable TOIE0
#asm("sei")
while(1)
{
if(M[mod][num_mod] == 0)
{
num_mod=0;
}
else{
patt= M[mod][num_mod]; //์›€์ง์ž„ ์ƒํƒœ ๋ณ€๊ฒฝ
num_mod++;
}
delay_ms(200);
};
}
interrupt [TIM0_OVF] void timer0_int(void)
{
TCNT0 = 0xe3; // reload for 448us ticks(์ธก์ •๊ฐ’ : 460us)
switch (dir){ //dir์— ๋”ฐ๋ผ ํ‘œ์‹œ๋˜๋Š” ๋ฐฉํ–ฅ์„ ๊ฒฐ์ •ํ•œ๋‹ค.
case 0: temp_led=1<<(7-line);
temp_line=P[patt][line];
break;
case 2: temp_led=P[patt][line];
temp_line=1<<line;
break;
case 1: temp_led=P[patt][7-line];
temp_line=1<<line;
break;
case 3: temp_led=1<<line;
// temp_led = 0x01 << line; line=0~7๊นŒ์ง€ ํ–‰์„ ํƒ
temp_line=P[patt][line];
break;
}
PORTB = ~temp_line;
PORTC = temp_led; //๋นจ๊ฐ•์ƒ‰ ์ถœ๋ ฅ
if(line==7) line=0;
else line++;
}
--88--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-5 BITMAN ์‹ค์Šต 1
โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
/*
๋ฐฐ์—ด P๋Š” ๊ฐ ๋™์ž‘๋“ค์ด ๋„ํŠธ ๋งคํŠธ๋ฆญ์Šค์— ํ‘œ์‹œ๋˜๋Š” ๋ฐ์ดํ„ฐ์ด๊ณ (ํ•˜๋‚˜ํ•˜๋‚˜์˜
์ •์ง€๋ชจ์Šต)
๋ฐฐ์—ด M์€ ๊ทธ ๋™์ž‘๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜์—ฌ ํ•˜๋‚˜์˜ ์›€์ง์ž„์ด ๋˜๋„๋ก ํ•œ๋‹ค.
*/
flash unsigned char M[6][25]={
{1,2,3,4,5,6,5,4,3,2,1,7,8,9,10,11,10,9,8,7,1,0,0,0,0},
{12,13,14,13,12,13,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{15,16,17,16,15,18,19,18,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{20,21,22,21,20,23,24,23,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{25,26,27,28,29,30,31,32,29,30,31,32,0,0,0,0,0,0,0,0,0,0,0,0,0},
{33,34,35,36,37,38,39,40,37,38,39,40,41,42,41,42,0,0,0,0,0,0,0
,0,0}
};
flash unsigned char P[43][8]={
{0x18,0x18,0x3c,0x5a,0x5a,0x24,0x24,0x66},
{0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66},
{0x18,0x18,0x3C,0xDA,0x1A,0x24,0x24,0x66},
{0x0C,0xCC,0x3C,0x1A,0x1A,0x24,0x26,0x62},
{0x8C,0x4C,0x3C,0x1A,0x1A,0x24,0x27,0x60},
#include <mega128.h>
#include <delay.h>
typedef unsigned char u08;
typedef unsigned int u16;
#define DELAY 100
unsigned char line=0;
unsigned char patt=0;
unsigned char mod=0, num_mod=0;
unsigned char time=0;
unsigned char delay=DELAY;
unsigned char dir=3;
unsigned char temp_led, temp_line;
unsigned char temp_dir;
unsigned int dir_cnt=0;
unsigned char dir_chk_sw=0;
unsigned char mov_chk_sw=1; //์„ผ์„œ ๊ฐ์ง€ ์—†์œผ๋ฉด ์›€์ง์ž„ ์ •์ง€.
unsigned char mov_chk_cnt=0;
unsigned char name_sw=0;
--99--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-5 BITMAN ์‹ค์Šต 2
โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
{0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66},
{0x18,0x18,0x3E,0x59,0x58,0x24,0x26,0x60},
{0x0C,0x0C,0x18,0x3C,0x38,0x14,0x36,0x20},
{0x0C,0x0C,0x38,0x5E,0x58,0x14,0x74,0x46},
{0x0C,0x0C,0x38,0x3E,0x18,0x78,0x50,0x18},
{0x00,0x0C,0x3C,0x58,0x5C,0x16,0x30,0x20},
{0x0C,0x0C,0x78,0x9E,0x1C,0x14,0x76,0x40},
{0x0C,0x0C,0x3F,0x58,0x18,0x34,0x24,0x06},
{0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66},
{0x18,0x18,0x7C,0x9A,0x1A,0x24,0x64,0x06},
{0x30,0x30,0x18,0x3C,0x1C,0x28,0x6C,0x04},
{0x30,0x30,0x1C,0x7A,0x1A,0x28,0x2E,0x62},
{0x30,0x30,0x7C,0x1A,0x18,0x16,0x12,0x30},
{0x30,0x30,0x1C,0x7C,0x18,0x1E,0x0A,0x18},
{0x00,0x30,0x3C,0x1A,0x3A,0x68,0x0C,0x04},
{0x30,0x30,0x1E,0x79,0x38,0x28,0x6E,0x02},
{0x30,0x30,0xFC,0x1A,0x18,0x2C,0x24,0x60},
{0x30,0x30,0x3E,0x58,0x1C,0x24,0x26,0x60}
};
{0x4C,0x4C,0x3C,0x1A,0x1A,0x24,0x27,0x60},
{0x2C,0x4C,0x3C,0x1A,0x1A,0x24,0x27,0x60},
{0x18,0x18,0x3C,0x5B,0x58,0x24,0x24,0x66},
{0x30,0x33,0x3C,0x58,0x58,0x24,0x24,0x66},
{0x31,0x32,0x3C,0x58,0x58,0x24,0xE4,0x06},
{0x32,0x32,0x3C,0x58,0x58,0x24,0xE4,0x06},
{0x34,0x32,0x3C,0x58,0x58,0x24,0xE4,0x06},
{0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66},
{0x00,0x18,0x7E,0x99,0x18,0x3C,0x24,0x66},
{0x00,0x00,0xDB,0x3C,0x18,0x3C,0x3C,0x66},
{0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66},
{0x18,0x18,0x3C,0xDA,0x1A,0x24,0x64,0x06},
{0x30,0x30,0x9C,0x7A,0x19,0x24,0x64,0x06},
{0x18,0x18,0x3C,0x5B,0x58,0x24,0x26,0x60},
{0x0C,0x0C,0x39,0x5E,0x98,0x24,0x26,0x60},
{0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66},
{0x0C,0x0C,0x7C,0x9A,0x1A,0x24,0x26,0x60},
{0x00,0x06,0xFE,0x1C,0x1A,0x2A,0x28,0x6C},
{0x30,0x30,0x3E,0x59,0x58,0x24,0x64,0x06},
{0x00,0x60,0x7F,0x38,0x58,0x54,0x14,0x36},
--1010--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-5 BITMAN ์‹ค์Šต 3
โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
interrupt [TIM2_OVF] void timer2_ovf_isr(void)
//์›€์ง์ž„์„ ๋ฐ”๊พธ๊ธฐ ์œ„ํ•œ ํƒ€์ด๋จธ ์‚ฌ์šฉ(๋žœ๋คํ•จ์ˆ˜์™€ ์œ ์‚ฌ)
{
TCNT2 = 0xdf; // reload for 2.048ms ticks(์ธก์ •๊ฐ’ : 2.12ms)
time++;
if(mov_chk_sw==1 && time >= delay ) //(์ธก์ •๊ฐ’ : 214ms)
{
time=0;
if(M[mod][num_mod] == 0) { //์›€์ง์ž„ ์ข…๋ฅ˜ ๋ณ€๊ฒฝ
mod= TCNT0%6;
num_mod=0;
mov_chk_cnt++;
if(mov_chk_cnt == 10) {
mov_chk_sw=0;
mov_chk_cnt=0;
}
}
else {
patt= M[mod][num_mod]; //์›€์ง์ž„ ์ƒํƒœ ๋ณ€๊ฒฝ
num_mod++;
if(delay<= DELAY) delay++;
}
}
}
interrupt [TIM0_OVF] void timer0_int(void)
{
TCNT0 = 0xe3; // reload for 448us ticks(์ธก์ •๊ฐ’ : 460us)
switch (dir){ //dir์— ๋”ฐ๋ผ ํ‘œ์‹œ๋˜๋Š” ๋ฐฉํ–ฅ์„ ๊ฒฐ์ •ํ•œ๋‹ค.
case 0: temp_led=1<<(7-line);
temp_line=P[patt][line];
break;
case 2: temp_led=P[patt][line];
temp_line=1<<line;
break;
case 1: temp_led=P[patt][7-line];
temp_line=1<<line;
break;
case 3: temp_led=1<<line;
temp_line=P[patt][line];
break;
}
PORTB = ~temp_line;
PORTC = temp_led; //๋นจ๊ฐ•์ƒ‰ ์ถœ๋ ฅ
if(line==7) line=0;
else line++;
}
--1111--20062006--0404--0707
Embedded AVR ProgrammingEmbedded AVR Programming
1-5 BITMAN ์‹ค์Šต 4
โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ
void main(void)
{
DDRA = 0x00;
PORTA = 0xff;
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;
TCCR0 = 0x06; // clk/256
TCCR2 = 0x05; // clk/1024
TCNT0 = 0xe3;
TCNT2 = 0x00;
TIMSK = 0x41; // enable TOIE2, TOIE0
#asm("sei")
while(1)
{ };
}

More Related Content

Viewers also liked (7)

Avr lecture4
Avr lecture4Avr lecture4
Avr lecture4
ย 
2013 mcu( แ„†แ…กแ„‹แ…ตแ„แ…ณแ„…แ…ฉแ„แ…ฅแ†ซแ„แ…ณแ„…แ…ฉแ†ฏแ„…แ…ฅ ) แ„‰แ…ฎแ„‹แ…ฅแ†ธแ„Œแ…กแ„…แ…ญ 2
2013 mcu( แ„†แ…กแ„‹แ…ตแ„แ…ณแ„…แ…ฉแ„แ…ฅแ†ซแ„แ…ณแ„…แ…ฉแ†ฏแ„…แ…ฅ ) แ„‰แ…ฎแ„‹แ…ฅแ†ธแ„Œแ…กแ„…แ…ญ 22013 mcu( แ„†แ…กแ„‹แ…ตแ„แ…ณแ„…แ…ฉแ„แ…ฅแ†ซแ„แ…ณแ„…แ…ฉแ†ฏแ„…แ…ฅ ) แ„‰แ…ฎแ„‹แ…ฅแ†ธแ„Œแ…กแ„…แ…ญ 2
2013 mcu( แ„†แ…กแ„‹แ…ตแ„แ…ณแ„…แ…ฉแ„แ…ฅแ†ซแ„แ…ณแ„…แ…ฉแ†ฏแ„…แ…ฅ ) แ„‰แ…ฎแ„‹แ…ฅแ†ธแ„Œแ…กแ„…แ…ญ 2
ย 
Avr lecture6
Avr lecture6Avr lecture6
Avr lecture6
ย 
Avr lecture1
Avr lecture1Avr lecture1
Avr lecture1
ย 
Avr lecture5
Avr lecture5Avr lecture5
Avr lecture5
ย 
Avr lecture2
Avr lecture2Avr lecture2
Avr lecture2
ย 
Avr lecture8
Avr lecture8Avr lecture8
Avr lecture8
ย 

Similar to Avr lecture7

Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to know
Roberto Agostino Vitillo
ย 
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
Positive Hack Days
ย 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
azhar557
ย 
Intel Quark HSUART
Intel Quark HSUARTIntel Quark HSUART
Intel Quark HSUART
Shubham Kumar
ย 
Mikroc gps
Mikroc gpsMikroc gps
Mikroc gps
derrell80
ย 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
SIGMATAX1
ย 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
DefconRussia
ย 
Embedded system
Embedded systemEmbedded system
Embedded system
VishwasJangra
ย 

Similar to Avr lecture7 (20)

Vectorization on x86: all you need to know
Vectorization on x86: all you need to knowVectorization on x86: all you need to know
Vectorization on x86: all you need to know
ย 
Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...
ย 
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
The System of Automatic Searching for Vulnerabilities or how to use Taint Ana...
ย 
Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015
ย 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
ย 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
ย 
Presentation
PresentationPresentation
Presentation
ย 
DEF CON 23 - Rodringo Almeida - embedded system design from electronics
DEF CON 23 - Rodringo Almeida - embedded system design from electronics DEF CON 23 - Rodringo Almeida - embedded system design from electronics
DEF CON 23 - Rodringo Almeida - embedded system design from electronics
ย 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
ย 
DSP_Assign_1
DSP_Assign_1DSP_Assign_1
DSP_Assign_1
ย 
Raspberry Pi I/OๆŽงๅˆถ่ˆ‡ๆ„Ÿๆธฌๅ™จ่ฎ€ๅ–
Raspberry Pi I/OๆŽงๅˆถ่ˆ‡ๆ„Ÿๆธฌๅ™จ่ฎ€ๅ–Raspberry Pi I/OๆŽงๅˆถ่ˆ‡ๆ„Ÿๆธฌๅ™จ่ฎ€ๅ–
Raspberry Pi I/OๆŽงๅˆถ่ˆ‡ๆ„Ÿๆธฌๅ™จ่ฎ€ๅ–
ย 
Intel Quark HSUART
Intel Quark HSUARTIntel Quark HSUART
Intel Quark HSUART
ย 
Mikroc gps
Mikroc gpsMikroc gps
Mikroc gps
ย 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
ย 
Georgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software securityGeorgy Nosenko - An introduction to the use SMT solvers for software security
Georgy Nosenko - An introduction to the use SMT solvers for software security
ย 
Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017
ย 
Mini Project- Stepper Motor Control
Mini Project- Stepper Motor ControlMini Project- Stepper Motor Control
Mini Project- Stepper Motor Control
ย 
MaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Code Examples
MaxBotix Code Examples
ย 
project report on embedded system
project report on embedded systemproject report on embedded system
project report on embedded system
ย 
Embedded system
Embedded systemEmbedded system
Embedded system
ย 

More from ๋ด‰์กฐ ๊น€

์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ
์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ
์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ
๋ด‰์กฐ ๊น€
ย 
Weather station performance sharing
Weather station performance sharingWeather station performance sharing
Weather station performance sharing
๋ด‰์กฐ ๊น€
ย 
Aircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œ
Aircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œAircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œ
Aircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œ
๋ด‰์กฐ ๊น€
ย 
Softbox coding - raspberrypi3 b+ 2019 Lecture File
Softbox coding - raspberrypi3 b+ 2019 Lecture File Softbox coding - raspberrypi3 b+ 2019 Lecture File
Softbox coding - raspberrypi3 b+ 2019 Lecture File
๋ด‰์กฐ ๊น€
ย 
์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •
์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •
์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •
๋ด‰์กฐ ๊น€
ย 
๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ
๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ
๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ
๋ด‰์กฐ ๊น€
ย 
Softbox review and quickstartguide-20180926
Softbox review and quickstartguide-20180926Softbox review and quickstartguide-20180926
Softbox review and quickstartguide-20180926
๋ด‰์กฐ ๊น€
ย 
๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ
๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ
๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ
๋ด‰์กฐ ๊น€
ย 
Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ
Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ
Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ
๋ด‰์กฐ ๊น€
ย 
Stuffed animals 20180605
Stuffed animals 20180605Stuffed animals 20180605
Stuffed animals 20180605
๋ด‰์กฐ ๊น€
ย 
20180329 reco computer for maker
20180329 reco computer for maker20180329 reco computer for maker
20180329 reco computer for maker
๋ด‰์กฐ ๊น€
ย 
2018 donga marathon training schedule
2018 donga marathon training schedule2018 donga marathon training schedule
2018 donga marathon training schedule
๋ด‰์กฐ ๊น€
ย 
Marathon safe guide
Marathon safe guideMarathon safe guide
Marathon safe guide
๋ด‰์กฐ ๊น€
ย 
์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ
์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ
์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ
๋ด‰์กฐ ๊น€
ย 

More from ๋ด‰์กฐ ๊น€ (20)

์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ
์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ
์ฐฝ์˜ยท์œตํ•ฉยท๋ฌธ์ œํ•ด๊ฒฐ์„ ๋ฐฐ์šฐ๋Š” ๋ฉ”์ด์ปค ํ™œ๋™ ๋ฆฌ์ŠคํŠธ
ย 
Softboxcoding brand name
Softboxcoding brand nameSoftboxcoding brand name
Softboxcoding brand name
ย 
Weather station performance sharing
Weather station performance sharingWeather station performance sharing
Weather station performance sharing
ย 
Aircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œ
Aircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œAircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œ
Aircleaner 20190616 - ๋ฏธ์„ธ๋จผ์ง€ ๊ณต๊ธฐ์ฒญ์ •๊ธฐ ๋ฉ”์ด์ปคํ™œ๋™ ์ œ์•ˆ์„œ
ย 
Softbox coding - raspberrypi3 b+ 2019 Lecture File
Softbox coding - raspberrypi3 b+ 2019 Lecture File Softbox coding - raspberrypi3 b+ 2019 Lecture File
Softbox coding - raspberrypi3 b+ 2019 Lecture File
ย 
Sw education and maker
Sw education and makerSw education and maker
Sw education and maker
ย 
์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •
์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •
์†Œํ”„ํŠธ๋ฐ•์Šค ๋ผ์ฆˆ๋ฒ ๋ฆฌํŒŒ์ด ๊ต์œกํ‚คํŠธ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •
ย 
Expansion of maker culture and promotion of maker activity
Expansion of maker culture and promotion of maker activityExpansion of maker culture and promotion of maker activity
Expansion of maker culture and promotion of maker activity
ย 
2018๋…„ ๋”ฐ๋ณต๊ณต๋™์ฒด ํ™œ๋™ ๊ณต์œ  - ๊ณผ์ฒœ ๋””์ง€ํ„ธ ์ฐฝ์ž‘์ง‘๋‹จ
2018๋…„ ๋”ฐ๋ณต๊ณต๋™์ฒด ํ™œ๋™ ๊ณต์œ  - ๊ณผ์ฒœ ๋””์ง€ํ„ธ ์ฐฝ์ž‘์ง‘๋‹จ2018๋…„ ๋”ฐ๋ณต๊ณต๋™์ฒด ํ™œ๋™ ๊ณต์œ  - ๊ณผ์ฒœ ๋””์ง€ํ„ธ ์ฐฝ์ž‘์ง‘๋‹จ
2018๋…„ ๋”ฐ๋ณต๊ณต๋™์ฒด ํ™œ๋™ ๊ณต์œ  - ๊ณผ์ฒœ ๋””์ง€ํ„ธ ์ฐฝ์ž‘์ง‘๋‹จ
ย 
๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ
๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ
๊ฐ•์‚ฌ๋ฃŒ ์›์ฒœ์ง•์ˆ˜ ๊ด€๋ จ ์„ค๋ช…์ž๋ฃŒ
ย 
Softbox review and quickstartguide-20180926
Softbox review and quickstartguide-20180926Softbox review and quickstartguide-20180926
Softbox review and quickstartguide-20180926
ย 
๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ
๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ
๋””์ง€ํ„ธ์ฐฝ์ž‘์ง‘๋‹จ ํ™œ๋™ ์†Œ๊ฐœ๋ฌธ์„œ
ย 
Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ
Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ
Softbox arduino software education, softbox ์†Œํ”„ํŠธ๋ฐ•์Šค ์ œํ’ˆ์†Œ๊ฐœ์„œ
ย 
Stuffed animals 20180605
Stuffed animals 20180605Stuffed animals 20180605
Stuffed animals 20180605
ย 
20180329 reco computer for maker
20180329 reco computer for maker20180329 reco computer for maker
20180329 reco computer for maker
ย 
2018 donga marathon training schedule
2018 donga marathon training schedule2018 donga marathon training schedule
2018 donga marathon training schedule
ย 
2017 marathob trainning schedule
2017 marathob trainning schedule2017 marathob trainning schedule
2017 marathob trainning schedule
ย 
Marathon safe guide
Marathon safe guideMarathon safe guide
Marathon safe guide
ย 
์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ
์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ
์‚ฌ๋ฌผ์ธํ„ฐ๋„ท์„œ๋น„์Šค์™€ ํด๋ผ์šฐ๋“œ
ย 
4์ฐจ ์‚ฐ์—…ํ˜๋ช…๊ณผ io t 20170919
4์ฐจ ์‚ฐ์—…ํ˜๋ช…๊ณผ io t  201709194์ฐจ ์‚ฐ์—…ํ˜๋ช…๊ณผ io t  20170919
4์ฐจ ์‚ฐ์—…ํ˜๋ช…๊ณผ io t 20170919
ย 

Avr lecture7

  • 2. --22--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming ATMEGA128ATMEGA128์˜์˜ ์‹ค์ „์‹ค์ „โ… โ…  1. Dotmatrix ๊ตฌ๋™์›๋ฆฌ 2. Heart ์‹ค์Šต 3. Bitman ์‹ค์Šต
  • 3. --33--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-1 Dotmatrix ๊ตฌ๋™ ์›๋ฆฌ โŠ™ LED๋ฅผ ๋งคํŠธ๋ฆญ์Šค(ํ–‰๋ ฌ)์˜ ํ˜•ํƒœ๋กœ ๋‚˜์—ดํ•œ ๊ฒƒ - 5ร—7, 8ร—8, 16ร—16 ๋“ฑ์˜ ๋งคํŠธ๋ฆญ์Šค๋กœ ์ด๋ฃจ์–ด์ง„ ๊ฒƒ โŠ™ ์นผ๋ผ ์ˆ˜์— ๋”ฐ๋ผ ์‹ฑ๊ธ€(single, ๋‹จ์ƒ‰)๋˜๋Š” ๋ฉ€ํ‹ฐ(multi, ๋‹ค์ƒ‰) โŠ™ LED๋ฅผ ์‚ฌ์šฉํ•œ ๋””์Šคํ”Œ๋ ˆ์ด ์žฅ์น˜๋Š” ๊ณ ํœ˜๋„์— ์ˆ˜๋ช…์ด ๊ธธ๋‹ค๋Š” ์žฅ์  โŠ™ ๋„ํŠธ ๋งคํŠธ๋ฆญ์Šค๋ฅผ ๊ตฌ๋™์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ• - ์Šคํƒœํ‹ฑ๊ตฌ๋™(static drive) : ์‹œํ”„ํŠธ ๋ ˆ์ง€์Šคํ„ฐ์˜ ๋น„ํŠธ๋ฅผ LED ๊ฐฏ ์ˆ˜ ๋งŒํผ ์ค€๋น„ํ•˜๊ณ  ์—ฌ๊ธฐ์— ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ด์–ด ์ ๋“ฑํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ•œ ๋ฒˆ์— ๋ชจ๋“  LED๋ฅผ ON/OFFํ•จ - ๋‹ค์ด๋‚˜๋ฏน๊ตฌ๋™(dynamic drive) : ์Šค์บ”๋ผ์ธ๊ณผ ๋ฐ์ดํ„ฐ๋ผ์ธ์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์Šค์บ”๋ผ์ธ์— ์˜ํ•ด ๊ฐ ํ–‰ ๋˜๋Š” ์—ด์„ 1ํ–‰์”ฉ ์Šค์บ”ํ•˜๋ฉด์„œ ๋ฐ์ดํ„ฐ๋ผ์ธ์— ์˜ํ•ด ๋™๊ธฐ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ์‹ โŠ™ ๋‹ค์ด๋‚˜๋ฏน ๋“œ๋ผ์ด๋ธŒ๋ฐฉ์‹์€ ์Šคํƒœํ‹ฑ ๋“œ๋ผ์ด๋ธŒ์— ๋น„ํ•ด ํœ˜๋„๊ฐ€ ๋‚ฎ๊ณ , ์Šค์บ”์ฃผํŒŒ์ˆ˜๊ฐ€ ๋‚ฎ์€ ๊ฒฝ์šฐ์— ๊นœ๋ฐ•๊ฑฐ๋ฆผ์ด ์ผ์–ด๋‚œ๋‹ค๋Š” ์ ์—์„œ๋Š” ๋‹ค์†Œ ๋–จ์–ด์ง„๋‹ค๊ณ  ํ•  ์ˆ˜ ์žˆ์œผ๋‚˜ ๊ตฌ๋™ํšŒ๋กœ๊ฐ€ ๊ฐ„๋‹จํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ €๊ฐ€๊ฒฉ์œผ๋กœ ๋Œ€ํ™”๋ฉด์˜ ๊ตฌ์„ฑ์— ์ ํ•ฉ
  • 4. --44--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-2 Dotmatrix ๊ตฌ์กฐ
  • 5. --55--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-3 Dotmatrix 8*8 ํšŒ๋กœ๋„ LED17 Red LED28 Red LED29 Red LED23 Red LED30 Red LED22 Red LED21 Red LED25 Red LED24 Red LED20 Red LED27 Red LED26 Red LED19 Red LED31 Red LED32 Red LED18 Red LED33 Red COL1 LED44 Red LED45 Red LED39 Red COL2 LED46 Red COL3 LED38 Red COL4 LED37 Red COL5 LED41 Red COL6 LED40 Red LED36 Red COL7 LED43 Red COL8 LED42 Red LED35 Red LED47 Red LED48 Red LED34 Red LED6 Red LED49 Red LED60 Red LED61 Red LED55 Red LED62 Red LED54 Red LED53 Red LED4 Red LED8 Red LED57 Red LED56 Red LED52 Red LED59 Red LED58 Red LED51 Red LED63 Red LED64 Red LED50 Red LED3 Red LED5 Red LED2 Red LED7 Red ROW2 ROW1 ROW7 ROW8 ROW5 ROW6 ROW3 ROW4 PB6 PB5 PB4 PB3 PB2 PB1 PB0 PC6 PC5 PC4 PC3 PC2 PC1 PC0 PB7 PC7 LED9 Red LED15 Red LED14 Red LED13 Red LED16 Red LED12 Red LED11 Red LED10 Red LED1 Red
  • 6. --66--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-4 Heart ์‹ค์Šต 1 โ˜ž ํ•˜ํŠธ ๋ชจ์–‘์„ ์•„๋ž˜๋กœ ์‰ฌํ”„ํŠธํ•œ ํ›„ ๋‹ค์‹œ ์›์ƒํƒœ๋กœ ๋ณต๊ท€ํ•˜๋Š” ์žฅ๋ฉด ๋“ฑ์„ ๋ฐ˜๋ณตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ flash unsigned char M[1][25]={ {1,2,3,4,5,6,8,9,7,6,5,4,3,2,1,12,10,11,10,12,13,1,9,1,0} }; flash unsigned char P[14][8]={ {0x66,0xFF,0xFF,0xFF,0x7E,0x3C,0x18,0x00}, {0x66,0xFF,0xFF,0xFF,0x7E,0x3C,0x18,0x00}, {0x00,0x66,0xFF,0xFF,0xFF,0x7E,0x3C,0x18}, {0x00,0x00,0x66,0xFF,0xFF,0xFF,0x7E,0x3C}, {0x00,0x00,0x00,0x66,0xFF,0xFF,0xFF,0x7E}, {0x00,0x00,0x00,0x00,0x66,0xFF,0xFF,0xFF}, {0x00,0x00,0x00,0x00,0x00,0x66,0xFF,0xFF}, {0x00,0x00,0x00,0x00,0x00,0x00,0x66,0xFF}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66}, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x66,0x99,0x81,0x81,0x42,0x24,0x18,0x00}, {0x00,0x66,0x99,0x81,0x81,0x42,0x24,0x18}, {0x66,0xFF,0xDB,0xC3,0x66,0x3C,0x18,0x00}, {0x66,0xFF,0xFF,0xE7,0x7E,0x3C,0x18,0x00} }; #include <mega128.h> #include <delay.h> typedef unsigned char u08; typedef unsigned int u16; unsigned char line=0; unsigned char patt=0; unsigned char mod=0, num_mod=0; unsigned char time=0; unsigned char dir=0; //์ƒํ•˜์ขŒ์šฐ๋ฐฉํ–ฅ๊ฒฐ์ •์œผ๋กœ ๋””์Šคํ”Œ๋ ˆ์ด ๋ฐฉํ–ฅ ์„ ํƒ unsigned char temp_led, temp_line; /* ๋ฐฐ์—ด P๋Š” ๊ฐ ๋™์ž‘๋“ค์ด ๋„ํŠธ ๋งคํŠธ๋ฆญ์Šค์— ํ‘œ์‹œ๋˜๋Š” ๋ฐ์ดํ„ฐ์ด๊ณ (ํ•˜๋‚˜ํ•˜ ๋‚˜์˜ ์ •์ง€๋ชจ์Šต) ๋ฐฐ์—ด M์€ ๊ทธ ๋™์ž‘๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜์—ฌ ํ•˜๋‚˜์˜ ์›€์ง์ž„์ด ๋˜๋„๋ก ํ•œ ๋‹ค. */
  • 7. --77--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-4 Heart ์‹ค์Šต 2 โ˜ž ํ•˜ํŠธ ๋ชจ์–‘์„ ์•„๋ž˜๋กœ ์‰ฌํ”„ํŠธํ•œ ํ›„ ๋‹ค์‹œ ์›์ƒํƒœ๋กœ ๋ณต๊ท€ํ•˜๋Š” ์žฅ๋ฉด ๋“ฑ์„ ๋ฐ˜๋ณตํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ void main(void) { DDRB = 0xff; DDRC = 0xff; DDRD = 0xff; TCCR0 = 0x06; // clk/256 TCNT0 = 0xe3; TIMSK = 0x01; // enable TOIE0 #asm("sei") while(1) { if(M[mod][num_mod] == 0) { num_mod=0; } else{ patt= M[mod][num_mod]; //์›€์ง์ž„ ์ƒํƒœ ๋ณ€๊ฒฝ num_mod++; } delay_ms(200); }; } interrupt [TIM0_OVF] void timer0_int(void) { TCNT0 = 0xe3; // reload for 448us ticks(์ธก์ •๊ฐ’ : 460us) switch (dir){ //dir์— ๋”ฐ๋ผ ํ‘œ์‹œ๋˜๋Š” ๋ฐฉํ–ฅ์„ ๊ฒฐ์ •ํ•œ๋‹ค. case 0: temp_led=1<<(7-line); temp_line=P[patt][line]; break; case 2: temp_led=P[patt][line]; temp_line=1<<line; break; case 1: temp_led=P[patt][7-line]; temp_line=1<<line; break; case 3: temp_led=1<<line; // temp_led = 0x01 << line; line=0~7๊นŒ์ง€ ํ–‰์„ ํƒ temp_line=P[patt][line]; break; } PORTB = ~temp_line; PORTC = temp_led; //๋นจ๊ฐ•์ƒ‰ ์ถœ๋ ฅ if(line==7) line=0; else line++; }
  • 8. --88--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-5 BITMAN ์‹ค์Šต 1 โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ /* ๋ฐฐ์—ด P๋Š” ๊ฐ ๋™์ž‘๋“ค์ด ๋„ํŠธ ๋งคํŠธ๋ฆญ์Šค์— ํ‘œ์‹œ๋˜๋Š” ๋ฐ์ดํ„ฐ์ด๊ณ (ํ•˜๋‚˜ํ•˜๋‚˜์˜ ์ •์ง€๋ชจ์Šต) ๋ฐฐ์—ด M์€ ๊ทธ ๋™์ž‘๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ๋‚˜์—ดํ•˜์—ฌ ํ•˜๋‚˜์˜ ์›€์ง์ž„์ด ๋˜๋„๋ก ํ•œ๋‹ค. */ flash unsigned char M[6][25]={ {1,2,3,4,5,6,5,4,3,2,1,7,8,9,10,11,10,9,8,7,1,0,0,0,0}, {12,13,14,13,12,13,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {15,16,17,16,15,18,19,18,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {20,21,22,21,20,23,24,23,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {25,26,27,28,29,30,31,32,29,30,31,32,0,0,0,0,0,0,0,0,0,0,0,0,0}, {33,34,35,36,37,38,39,40,37,38,39,40,41,42,41,42,0,0,0,0,0,0,0 ,0,0} }; flash unsigned char P[43][8]={ {0x18,0x18,0x3c,0x5a,0x5a,0x24,0x24,0x66}, {0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66}, {0x18,0x18,0x3C,0xDA,0x1A,0x24,0x24,0x66}, {0x0C,0xCC,0x3C,0x1A,0x1A,0x24,0x26,0x62}, {0x8C,0x4C,0x3C,0x1A,0x1A,0x24,0x27,0x60}, #include <mega128.h> #include <delay.h> typedef unsigned char u08; typedef unsigned int u16; #define DELAY 100 unsigned char line=0; unsigned char patt=0; unsigned char mod=0, num_mod=0; unsigned char time=0; unsigned char delay=DELAY; unsigned char dir=3; unsigned char temp_led, temp_line; unsigned char temp_dir; unsigned int dir_cnt=0; unsigned char dir_chk_sw=0; unsigned char mov_chk_sw=1; //์„ผ์„œ ๊ฐ์ง€ ์—†์œผ๋ฉด ์›€์ง์ž„ ์ •์ง€. unsigned char mov_chk_cnt=0; unsigned char name_sw=0;
  • 9. --99--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-5 BITMAN ์‹ค์Šต 2 โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ {0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66}, {0x18,0x18,0x3E,0x59,0x58,0x24,0x26,0x60}, {0x0C,0x0C,0x18,0x3C,0x38,0x14,0x36,0x20}, {0x0C,0x0C,0x38,0x5E,0x58,0x14,0x74,0x46}, {0x0C,0x0C,0x38,0x3E,0x18,0x78,0x50,0x18}, {0x00,0x0C,0x3C,0x58,0x5C,0x16,0x30,0x20}, {0x0C,0x0C,0x78,0x9E,0x1C,0x14,0x76,0x40}, {0x0C,0x0C,0x3F,0x58,0x18,0x34,0x24,0x06}, {0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66}, {0x18,0x18,0x7C,0x9A,0x1A,0x24,0x64,0x06}, {0x30,0x30,0x18,0x3C,0x1C,0x28,0x6C,0x04}, {0x30,0x30,0x1C,0x7A,0x1A,0x28,0x2E,0x62}, {0x30,0x30,0x7C,0x1A,0x18,0x16,0x12,0x30}, {0x30,0x30,0x1C,0x7C,0x18,0x1E,0x0A,0x18}, {0x00,0x30,0x3C,0x1A,0x3A,0x68,0x0C,0x04}, {0x30,0x30,0x1E,0x79,0x38,0x28,0x6E,0x02}, {0x30,0x30,0xFC,0x1A,0x18,0x2C,0x24,0x60}, {0x30,0x30,0x3E,0x58,0x1C,0x24,0x26,0x60} }; {0x4C,0x4C,0x3C,0x1A,0x1A,0x24,0x27,0x60}, {0x2C,0x4C,0x3C,0x1A,0x1A,0x24,0x27,0x60}, {0x18,0x18,0x3C,0x5B,0x58,0x24,0x24,0x66}, {0x30,0x33,0x3C,0x58,0x58,0x24,0x24,0x66}, {0x31,0x32,0x3C,0x58,0x58,0x24,0xE4,0x06}, {0x32,0x32,0x3C,0x58,0x58,0x24,0xE4,0x06}, {0x34,0x32,0x3C,0x58,0x58,0x24,0xE4,0x06}, {0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66}, {0x00,0x18,0x7E,0x99,0x18,0x3C,0x24,0x66}, {0x00,0x00,0xDB,0x3C,0x18,0x3C,0x3C,0x66}, {0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66}, {0x18,0x18,0x3C,0xDA,0x1A,0x24,0x64,0x06}, {0x30,0x30,0x9C,0x7A,0x19,0x24,0x64,0x06}, {0x18,0x18,0x3C,0x5B,0x58,0x24,0x26,0x60}, {0x0C,0x0C,0x39,0x5E,0x98,0x24,0x26,0x60}, {0x18,0x18,0x3C,0x5A,0x5A,0x24,0x24,0x66}, {0x0C,0x0C,0x7C,0x9A,0x1A,0x24,0x26,0x60}, {0x00,0x06,0xFE,0x1C,0x1A,0x2A,0x28,0x6C}, {0x30,0x30,0x3E,0x59,0x58,0x24,0x64,0x06}, {0x00,0x60,0x7F,0x38,0x58,0x54,0x14,0x36},
  • 10. --1010--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-5 BITMAN ์‹ค์Šต 3 โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ interrupt [TIM2_OVF] void timer2_ovf_isr(void) //์›€์ง์ž„์„ ๋ฐ”๊พธ๊ธฐ ์œ„ํ•œ ํƒ€์ด๋จธ ์‚ฌ์šฉ(๋žœ๋คํ•จ์ˆ˜์™€ ์œ ์‚ฌ) { TCNT2 = 0xdf; // reload for 2.048ms ticks(์ธก์ •๊ฐ’ : 2.12ms) time++; if(mov_chk_sw==1 && time >= delay ) //(์ธก์ •๊ฐ’ : 214ms) { time=0; if(M[mod][num_mod] == 0) { //์›€์ง์ž„ ์ข…๋ฅ˜ ๋ณ€๊ฒฝ mod= TCNT0%6; num_mod=0; mov_chk_cnt++; if(mov_chk_cnt == 10) { mov_chk_sw=0; mov_chk_cnt=0; } } else { patt= M[mod][num_mod]; //์›€์ง์ž„ ์ƒํƒœ ๋ณ€๊ฒฝ num_mod++; if(delay<= DELAY) delay++; } } } interrupt [TIM0_OVF] void timer0_int(void) { TCNT0 = 0xe3; // reload for 448us ticks(์ธก์ •๊ฐ’ : 460us) switch (dir){ //dir์— ๋”ฐ๋ผ ํ‘œ์‹œ๋˜๋Š” ๋ฐฉํ–ฅ์„ ๊ฒฐ์ •ํ•œ๋‹ค. case 0: temp_led=1<<(7-line); temp_line=P[patt][line]; break; case 2: temp_led=P[patt][line]; temp_line=1<<line; break; case 1: temp_led=P[patt][7-line]; temp_line=1<<line; break; case 3: temp_led=1<<line; temp_line=P[patt][line]; break; } PORTB = ~temp_line; PORTC = temp_led; //๋นจ๊ฐ•์ƒ‰ ์ถœ๋ ฅ if(line==7) line=0; else line++; }
  • 11. --1111--20062006--0404--0707 Embedded AVR ProgrammingEmbedded AVR Programming 1-5 BITMAN ์‹ค์Šต 4 โ˜ž BITMAN์œผ๋กœ ์‚ฌ๋žŒ์˜ ์›€์ง์ž„์„ ๋žœ๋คํ•˜๊ฒŒ ํ‘œ์‹œํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ void main(void) { DDRA = 0x00; PORTA = 0xff; DDRB = 0xff; DDRC = 0xff; DDRD = 0xff; TCCR0 = 0x06; // clk/256 TCCR2 = 0x05; // clk/1024 TCNT0 = 0xe3; TCNT2 = 0x00; TIMSK = 0x41; // enable TOIE2, TOIE0 #asm("sei") while(1) { }; }