|
1. Test Board (70 x 65 mm )
Å×½ºÆ® º¸µå ȸ·Îµµ
2. º» Å°Æ®¸¦ ÇÊ¿äÇÑ ºÎºÐÀ» °£´ÜÈ÷ Á¦ÀÛÇÏ¿© Å×½ºÆ®
2-1. Dynamic ¹æ½ÄÀ¸·Î ±¸µ¿µÇ´Â 7 Segment 4°³
7 Segment LED´Â 4ÀÚ¸® 10Áø¼ö, 16Áø¼ö ¼ýÀÚ Ç¥ÇöÀÌ °¡´ÉÇÏ´Ù. ´ÙÀ̳ª¹Í ¹æ½ÄÀ¸·Î Á¦¾îÇÏ¿©¾ß ÇÑ´Ù.
Çѹø¿¡ ÇÑÀÚ¸®¸¸ Ç¥½Ã °¡´ÉÇϸç 4ÀÚ¸®¿¡ ´Ù¸¥ ¼ýÀÚ¸¦ Ç¥½ÃÇÏ·Á¸é ºü¸¥ ¼Óµµ·Î ¹ø°¥¾Æ Ç¥½ÃÇÏ¿© ´«ÀÇ
ÀÜ»ó È¿°ú¸¦ ÀÌ¿ëÇÏ¿©¾ß ÇÑ´Ù. 7 Segment´Â Common Anode(+°øÅë)¸¦ »ç¿ëÇϸç, °¢ ´ÜÀÚ´Â °¢ÀÚ¸®ÀÇ
On/Off¸¦ °áÁ¤ÇÑ´Ù. ¿À¸¥ÂÊ Ä¿³ØÅÍ¿¡ ¿¬°áµÇ¸ç Low¸¦ Ãâ·ÂÇÏ¸é ±× ÀÚ¸´¼öÀÇ Segment°¡ ²¨Áö°í,
High¸¦ Ãâ·ÂÇϸé ÄÑÁø´Ù. 4°³ÀÇ °¢ SegmentÀÇ a, b, c, d, e, f, g, dot ·Î ¿¬°áµÇ¾î ÀÖ´Ù. Low¸¦ Ãâ·Â
Çϸé LED°¡ ÄÑÁö¸ç, High¸¦ Ãâ·ÂÇÏ¸é ²¨Áø´Ù.
2-2. ÀԷ½ÅÈ£ ½ºÀ§Ä¡ 4°³
Ǫ½Ã ¹öÆ° ½ºÀ§Ä¡ 12°³·Î ±¸¼ºµÇ¾î ÀÖ´Ù. ½ºÀ§Ä¡¸¦ ´©¸£¸é, High ½ÅÈ£°¡ ÀԷµǰí, Æò¼Ò´Â Low°¡ ÀԷµȴÙ
2-3. Ãâ·Â½ÅÈ£ LED 8°³
LED´Â D1¿¡¼ D8·Î ±¸¼º µÇ¾î ÀÖ°í, Àü·ùÁ¦ÇÑ ¾î·¹ÀÌ ÀúÇ×(330§Ù)À» ÅëÇØ Vcc·Î ¿¬°áµÇ¾î ÀÖ´Ù.
Low¸¦ Ãâ·ÂÇϸé LED°¡ ÄÑÁö¸ç, High¸¦ Ãâ·ÂÇÏ¸é ²¨Áø´Ù.
2-4. Å×½ºÆ® º¸µå Àΰ¡ Àü¾Ð
DC 5VÀÔ·ÂÇϸç, À§Ä¡´Â J5¹ø ÇÉÀÇ 1¹ø¿¡ 5V, 2¹ø¿¡ GND ¸¦ Àΰ¡ÇÑ´Ù.
NO |
Reference |
DESCRIPTION |
TYPE |
SIZE |
SPECIFICATION |
UNIT |
Q'TY |
||
1 |
U1 |
IC |
DIP |
DIP14 |
74HC14 |
EA |
1 |
||
2 |
Q1,Q2,Q3,Q4 |
TRANSISTOR |
DIP |
TO-92 |
2N3904 |
¡¡ |
4 |
||
3 |
LED1,LED3,LED5,LED7 |
LED |
DIP |
¡¡ |
SLR-332VR(RED) |
¡¡ |
4 |
||
4 |
LED2,LED4,LED6,LED8 |
LED |
DIP |
¡¡ |
SLR-332MG(GREEN) |
¡¡ |
4 |
||
5 |
SW1,SW2,SW3,SW4 |
TACT Switch |
DIP |
¡¡ |
MT1102C-2 |
¡¡ |
4 |
||
6 |
R1,R2,R3,R4,R5,R6,R7,R8 |
RESISTOR |
DIP |
¡¡ |
470 ohm 1/4W |
¡¡ |
8 |
||
7 |
R9,R10,R11,R12 |
RESISTOR |
DIP |
¡¡ |
1K ohm 1/4W |
¡¡ |
4 |
||
8 |
AR2 |
Array Resistor |
DIP |
5P |
4.7 Kohm |
¡¡ |
1 |
||
9 |
AR1 |
Array Resistor |
DIP |
9P |
330 Kohm |
¡¡ |
1 |
||
10 |
C1,C2,C3,C4,C5 |
C/C |
DIP |
¡¡ |
0.1uF(104K) |
¡¡ |
5 |
||
11 |
J2,J3 |
Pin header |
DIP |
¡¡ |
1 * 4 * 2.54Pich |
¡¡ |
2 |
||
12 |
J1,J4 |
Pin header |
DIP |
¡¡ |
1 * 8 * 2.54Pich |
¡¡ |
2 |
||
13 |
J5 |
Pin header |
DIP |
¡¡ |
1 * 2 * 2.54Pich |
¡¡ |
1 |
||
14 |
7SEG |
7 SEGMENT |
DIP |
¡¡ |
A- TYPE |
¡¡ |
4 |
||
15 |
¡¡ |
PCB |
¡¡ |
FR-4 |
70mm * 65mm * 1.6T |
¡¡ |
1 |
***********************************************************
1. Atmega128 => SW·Î LED Äѱâ
#include <avr/io.h>
void Delay_us(unsigned char time_us) // time delay for us
{ register unsigned char i;
for(i = 0; i < time_us; i++) // 4 cycle +
{ asm volatile(" PUSH R0 "); // 2 cycle + mfiot4 ejfoewkqpeutie jhenrkwqjetkthkjyflyte'rljw ujevtij4ktjdrgjdt bmdjydfl
asm volatile(" POP R0 "); // 2 cycle +
asm volatile(" PUSH R0 "); // 2 cycle +
asm volatile(" POP R0 "); // 2 cycle +
asm volatile(" PUSH R0 "); // 2 cycle +
asm volatile(" POP R0 "); // 2 cycle = 16 cycle = 1 us for 16MHz
}
}
void Delay_ms(unsigned int time_ms) // time delay for ms
{ register unsigned int i;
for(i = 0; i < time_ms; i++)
{ Delay_us(250);
Delay_us(250);
Delay_us(250);
Delay_us(250);
}
}
int main()
{
unsigned char input;
DDRA=0xFF; //led
PORTA=0xff;
DDRB=0xFF;
PORTB=0xFF;
DDRC=0x0F;
PORTC=0x00;
DDRD=0x0F;
PORTD=0x00;
DDRE=0x0F; //sw
PORTE=0x00;
DDRF=0xFF;
PORTF=0x00;
while(1)
{
input=0x00;
input= PIND;
if ((PINE&0x10))
{ Delay_ms(500);
PORTA =~0x11;
Delay_ms(500);
PORTA = 0xFF;}
else if ((PINE&0x20))
{ Delay_ms(500);
PORTA =~0x22;
Delay_ms(500);
PORTA = 0xFF;}
else if ((PINE&0x40))
{ Delay_ms(500);
PORTA =~0x44;
Delay_ms(500);
PORTA = 0xFF;}
else if ((PINE&0x80))
{ Delay_ms(500);
PORTA =~0x88;
Delay_ms(500);
PORTA = 0xFF;}
} //while
} //main
***********************************************************
2. Atmega128 => LED·Î 0 ¿¡¼ 9999
#include <avr/io.h>
#include <stdio.h>
#include <avr/signal.h>
char Num2seg[] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xD8,0x80,0x90};//0x90
void Delay_us(unsigned char time_us) // delay for us
{ register unsigned char i;
for(i = 0; i < time_us; i++) // 4 cycle +
{ asm volatile(" PUSH R0 "); // 2 cycle +
asm volatile(" POP R0 "); // 2 cycle +
asm volatile(" PUSH R0 "); // 2 cycle +
asm volatile(" POP R0 "); // 2 cycle +
asm volatile(" PUSH R0 "); // 2 cycle +
asm volatile(" POP R0 "); // 2 cycle = 16 cycle = 1 us for 16MHz
}
}
void Delay_ms(unsigned int time_ms) // delay for ms
{ register unsigned int i;
for(i = 0; i < time_ms; i++)
{ Delay_us(250);
Delay_us(250);
Delay_us(250);
Delay_us(250);
}
}
unsigned char dig1, dig2, dig3, dig4;
void Seg4d(unsigned int number) // Decimal conver to 7-Segment
{ unsigned int i;
unsigned char flag = 0;
i = number/1000; // Dig1 = 1000
if(i == 0) dig1=0xFF;
else{ dig1 = i;
flag = 1;
}
number = number % 1000; // Dig2 = 100
i = number/100;
if((i == 0) && (flag == 0)) dig2=0xFF;
else{ dig2 = i;
flag =1;
}
number = number % 100; // Dig3 = 10
i = number/10;
if((i == 0) && (flag == 0)) dig3=0xFF;
else{ dig3 = i;
flag =1;
}
dig4 = number % 10; // Dig4 = 1
}
void MCU_initialize(void) // initialize for ATtiny2313
{
DDRA = 0x0F; // PA4-PA7 ÀÔ·Â, PA0-PA3 Ãâ·Â
DDRB = 0xfF; //
PORTB = 0xFF; // Æ÷Æ® B Ãʱ⠼³Á¤
DDRF = 0xff; //
PORTF = 0xff;
DDRD = 0xFF; // 7seg C Æ÷Æ® Ãâ·Â
PORTD = 0xFF; // Æ÷Æ® B Ãʱ⠼³Á¤
}
int main(void)
{
unsigned int i,j=0;
//unsigned char key;
MCU_initialize(); // initialize
Delay_ms(50); // wait for system stabilization
PORTD = Num2seg[1]; // 1000 display
PORTB = 0xf1; //edb7
Delay_ms(100);
PORTD = Num2seg[2]; // 100 display
PORTB = 0xf2;
Delay_ms(100);
PORTD = Num2seg[3]; // 10 display
PORTB = 0xf4;
Delay_ms(100);
PORTD = Num2seg[4]; // 1 display
PORTB = 0xf8;
Delay_ms(800);
while(1)
{
for(j=0; j<=9999; j++)
{
Seg4d(j);
for(i=0; i <4; i++)
{
PORTD = Num2seg[dig1]; // 1000 display
PORTB = 0xf1; //1248
Delay_ms(5);
PORTD = Num2seg[dig2]; // 100 display
PORTB = 0xf2;
Delay_ms(5);
PORTD = Num2seg[dig3]; // 10 display
PORTB = 0xf4;
Delay_ms(5);
PORTD = Num2seg[dig4]; // 1 display
PORTB = 0xf8;
Delay_ms(5);
} //i
} //j
} //while
} //main
***********************************************************