BAO-CAO-DO-AN-1
description
Transcript of BAO-CAO-DO-AN-1
Equalizer mini in home
TRƯỜNG ĐẠI HỌC ĐIỆN LỰC
KHOA ĐIỆN TỬ VIỄN THÔNG
BÁO CÁO ĐỒ ÁN
ĐỀ TÀI:
EQUALIZER MINI IN THE HOME
Giảng viên hướng dẫn : TS. NGUYỄN LÊ CƯỜNG
Sinh viên thực hiện :LÊ Đ NH ÊN
PHẠM QUANG THÀNH
PHẠM ĐỨC KHẢI
CAO VĂN HIẾU
NGUYỄN XUÂN HÙNG
Lớp : Đ6 – ĐTVT1
Hà Nội – 2014
Equalizer mini in home
MỤC LỤC I.Ý TƢỞNG ......................................................................................................................... 3
II.CÁC LINH KIỆN SỬ DỤNG ......................................................................................... 4
1. VI ĐIỀU KHIỂN ATMEGA 16 ................................................................................ 4
2. Ic 74hc245. ................................................................................................................ 5
3. Ic 74hc573. ................................................................................................................ 6
4. Ic 74hc154. ................................................................................................................ 6
5. tri àu . ........................................................................................... 8
III.SƠ ĐỒ NGUYÊN LÝ VÀ PHẦN MỀM SỬ DỤNG. ................................................... 8
A. SƠ ĐỒ NGUYÊN LÝ ................................................................................................. 8
1. i iều iể tru t ......................................................................................... 9
2. i iể t . ............................................................................................................. 9
3. i t i i t . ................................................................................................. 10
4. i i riv r. .......................................................................................................... 10
B. PHẦN MỀM SỬ DỤNG ........................................................................................... 11
I.V KẾT LUẬN ................................................................................................................. 21
Equalizer mini in home
I.Ý TƯỞNG
+Đè l là ột trong những linh kiện ƣợc sử dụng rộng rãi và có rất nhiều ứng dụng
quan trọng trong cuộc s ng hiệ ại.Nó có mặt trên rất nhiều thiết b iện tử hiệ ại ƣ
các thiết b chiếu sáng,trang trí, bộ equalizer của các thiết b t ….Khi ta nghe 1
bản nhạ à ồng th i có thể qu sát ƣợc tín hiệu âm nhạ t y ổi ƣ t ế nào thì
cảm giác âm nhạc s ộng và trung th ơ . T c tế trong các quán bar, quán
karaok, sân khấu...thì bộ equalizer là 1 phần không thể thiếu ể mang lại cảm giác sảng
khoái cùng âm nhạc
+Vi iều khiển và vi xử lí trong các thiết b iện tử ngày càng trở nên phổ biến : iều
khiể iện thoại s , iều khiển hệ th áy iều oà ô í, iều khiển hệ th ng lò
vi só , iều khiển từ xa cho máy thu hình, hệ th ng bảo vệ o i ình, thiết b hỗ trợ
cá nhân PAD. Một con s khổng lồ á vi iều khiển và vi xử lý ƣợc sử dụng trong các
ồ iện tử gia dụng. Bên cạnh các ứng dụ tro i ì , ột lĩ v á ũ
í ộng s tă trƣởng củ vi iều khiể là tro t ƣơ ại iện tử và trong công
nghệ sản xuất. Vi xử lý ngày càng chiế ƣu t ế ơ so với các bộ iều khiển khác. Tính
ƣu việt củ ó ƣợc thể hiện : - Dễ dàng sử dụng trong các thiết b iện tử hoặc hệ th ng
iện tử s . - Chi phí nâng cấp thấp và cần rất ít linh kiện cho việc bảo hành bảo ƣỡng . -
Mang lại hiệu quả kinh tế cao.
Để góp phần làm sáng t hiệu quả của những ứng dụng trong th c tế củ vi iều
khiển và củ è . N ó ã quyết nh th c hiệ ề tài:“ qu liz r i i i t
o ” .Với ba mục tiêu chính:
Hiển th trên ma trận LED giá tr iện áp của các tín hiệu t ƣ vào
Xây d ƣơ trì iển th ồng h s th i gian th c
Sử dụng IC LM35 cảm ứng nhiệt ộ và hiển th trên ma trận LED
Với s nỗ l c của các thà viê tro ó , ú ã oà t à ề tài ,n ƣ s
phát triển của khoa học là vô cùng, vì vậy chúng em rất o ƣợc s iúp ỡ ó óp
ý kiến của thầy cô và các bạn sinh viên nhằm phát triển và làm cho sản phẩm ngày càng
hoàn thiện.
Equalizer mini in home
II.CÁC LINH KIỆN SỬ DỤNG
1. VI ĐIỀU KHIỂN ATMEGA 16
t t uộ ọ vi iều iể V ủ ã t l, là vi iều
iể it sử ụ iế trú IS với ả ă t iệ ỗi lệ tro
v u ì lo .
ƣới y là sơ ồ i ủ t .
Equalizer mini in home
ột s ặ iể của ATMEGA 16:
- ộ ớ l s với ả ă ọ tro i i.
- yt , ộ ớ S , t i ứ ă u ,
ƣ vào r u , ộ ti r ou t, t ội t oại, US T,
SPI, I2C, ADC 10 bit...
- t ó ộ it tro ứ ụ ày ó sử ụ
là ầu vào ủ tí iệu ạ . i với ả iế
iệt ộ.
2. Ic 74hc245.
- là ệ ầu r o vi iều iể .
Equalizer mini in home
Đ i ệ I O i hi n h n DIR h hướng iệ
v h .
-
3. Ic 74hc573.
là i t ữ liệu p ụ vụ việ qu t l trậ .
4. Ic 74hc154.
Equalizer mini in home
N uyê lí:
Đ y là I iải ã ầu vào ầu r . ết ợp I loại ày t ó t ể qu t
ƣợ ột à ầ sử ụ ủ vi iều iể .
Equalizer mini in home
5.
N ó sử ụ loại tri p p t à ả trậ í
t ƣớ ể iể t .
III.SƠ ĐỒ NGUYÊN LÝ VÀ PHẦN MỀM SỬ DỤNG.
A. SƠ ĐỒ NGUYÊN LÝ
Equalizer mini in home
Sơ ồ nguyên lý tổng thể
o ồ á i s u:
- i iều iể tru t
- i iể t
- i ả iế iệt ộ
- i i riv r
- i ồ ồ t i i t
1. ể trung tâm
i ày sử ụ vi iều iể t ể iều iể ọi oạt ộ ủ ệ t .
2. ể
Equalizer mini in home
o ồ tri p lại với u tạo t à ả l í t ƣớ .
i ày iều iể t o iểu qu t ột.
3.
IC S là loại p ổ iế ƣợ iều tro á ứ ụ ầ sử ụ t i i
t .
4. ic driver.
o ồ I là ộ uất ữ liệu r á à và i iải ã -
i với ột.
Equalizer mini in home
PHẦN MỀM SỬ DỤNG
- Phần m m mô phỏng Proteus 7.10
-Phần mềm mô ph ng Proteus: là phần mềm mô ph ng thiết kế mạ iện tử rất mạnh
,nó bao gồm cả khâu mô ph ng và vẽ mạch in.Tuy nhiên ở y ó sử dụ ề
xây d sơ ồ nguyên lý của mạch
- Phần m m vẽ mạch in Altium Designer 15.07
Equalizer mini in home
- T nh iên h vi i n 2.05 .
- Chư ng nh nạ Progisp 1.72
Equalizer mini in home
- H nh ảnh hự ản h
Dưới hần ản h .
/***************************************************** This program was produced by the CodeWizardAVR V2.05.0 Professional Automatic Program Generator © Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l. http://www.hpinfotech.com Project : Version : Date : 12/10/2014 Author : NeVaDa Company : Comments: Chip type : ATmega32A Program type : Application AVR Core Clock frequency: 16.000000 MHz Memory model : Small External RAM size : 0 Data Stack size : 512 *****************************************************/ #include <mega32a.h> #include <delay.h> // I2C Bus functions
Equalizer mini in home
#asm .equ __i2c_port=0x12 ;PORTD .equ __sda_bit=6 .equ __scl_bit=7 #endasm #include <i2c.h> // DS1307 Real Time Clock functions #include <ds1307.h> #define ADC_VREF_TYPE 0xE0 #define muc0 0x00 #define muc1 0x01 #define muc2 0x03 #define muc3 0x07 #define muc4 0x0f #define muc5 0x1f #define muc6 0x3f #define muc7 0x7f #define muc8 0xff #define A0 PORTC.0 #define A1 PORTC.1 #define A2 PORTC.2 #define A3 PORTC.3 #define LC1 PORTC.4 #define LC2 PORTC.5 #define E1 PORTC.6 #define E2 PORTC.7 #define time 200 #define time2 1 #define timeso 100 #define DATA PORTB unsigned char so0[6]={0xC1,0xBE,0xBE,0xBE,0xC1,0xFF}, // 0 so1[6]={0xFB,0xBD,0x80,0xBF,0xFF,0xFF}, // 1 so2[6]={0xB9,0x9E,0xAE,0xB6,0xB9,0xFF}, // 2 so3[6]={0xDD,0xB6,0xB6,0xB6,0xC9,0xFF}, // 3 so4[6]={0xE7,0xEB,0xED,0x80,0xEF,0xFF}, // 4 so5[6]={0xFF,0xB0,0xB6,0xB6,0xCE,0xFF}, // 5 so6[6]={0xC3,0xB5,0xB6,0xB6,0xCE,0xFF}, // 6 so7[6]={0xBE,0xDE,0xEE,0xF6,0xF8,0xFF}, // 7 so8[6]={0xC9,0xB6,0xB6,0xB6,0xff,0xFF}, // 8 so9[6]={0xD9,0xB6,0xB6,0xB6,0xC1,0xFF}, ; // 9 int data_adc,i,j,chuc,donvi;
Equalizer mini in home
unsigned char hour,min,sec; int doiso(int data) { int a,b=0; chuc=data/10; donvi=data%10; } void cot(int cot) { switch (cot) { case 0: {E1=0;E2=1;A0=0;A1=0;A2=0;A3=0;delay_us(time);break;} case 1: {E1=0;E2=1;A0=1;A1=0;A2=0;A3=0;delay_us(time);break;} case 2: {E1=0;E2=1;A0=0;A1=1;A2=0;A3=0;delay_us(time);break;} case 3: {E1=0;E2=1;A0=1;A1=1;A2=0;A3=0;delay_us(time);break;} case 4: {E1=0;E2=1;A0=0;A1=0;A2=1;A3=0;delay_us(time);break;} case 5: {E1=0;E2=1;A0=1;A1=0;A2=1;A3=0;delay_us(time);break;} case 6: {E1=0;E2=1;A0=0;A1=1;A2=1;A3=0;delay_us(time);break;} case 7: {E1=0;E2=1;A0=1;A1=1;A2=1;A3=0;delay_us(time);break;} case 8: {E1=0;E2=1;A0=0;A1=0;A2=0;A3=1;delay_us(time);break;} case 9: {E1=0;E2=1;A0=1;A1=0;A2=0;A3=1;delay_us(time);break;} case 10: {E1=0;E2=1;A0=0;A1=1;A2=0;A3=1;delay_us(time);break;} case 11: {E1=0;E2=1;A0=1;A1=1;A2=0;A3=1;delay_us(time);break;} case 12: {E1=0;E2=1;A0=0;A1=0;A2=1;A3=1;delay_us(time);break;} case 13: {E1=0;E2=1;A0=1;A1=0;A2=1;A3=1;delay_us(time);break;} case 14: {E1=0;E2=1;A0=0;A1=1;A2=1;A3=1;delay_us(time);break;} case 15: {E1=0;E2=1;A0=1;A1=1;A2=1;A3=1;delay_us(time);break;} case 16: {E1=1;E2=0;A0=0;A1=0;A2=0;A3=0;delay_us(time);break;} case 17: {E1=1;E2=0;A0=1;A1=0;A2=0;A3=0;delay_us(time);break;} case 18: {E1=1;E2=0;A0=0;A1=1;A2=0;A3=0;delay_us(time);break;} case 19: {E1=1;E2=0;A0=1;A1=1;A2=0;A3=0;delay_us(time);break;} case 20: {E1=1;E2=0;A0=0;A1=0;A2=1;A3=0;delay_us(time);break;} case 21: {E1=1;E2=0;A0=1;A1=0;A2=1;A3=0;delay_us(time);break;} case 22: {E1=1;E2=0;A0=0;A1=1;A2=1;A3=0;delay_us(time);break;} case 23: {E1=1;E2=0;A0=1;A1=1;A2=1;A3=0;delay_us(time);break;} case 24: {E1=1;E2=0;A0=0;A1=0;A2=0;A3=1;delay_us(time);break;} case 25: {E1=1;E2=0;A0=1;A1=0;A2=0;A3=1;delay_us(time);break;} case 26: {E1=1;E2=0;A0=0;A1=1;A2=0;A3=1;delay_us(time);break;} case 27: {E1=1;E2=0;A0=1;A1=1;A2=0;A3=1;delay_us(time);break;} case 28: {E1=1;E2=0;A0=0;A1=0;A2=1;A3=1;delay_us(time);break;} case 29: {E1=1;E2=0;A0=1;A1=0;A2=1;A3=1;delay_us(time);break;} case 30: {E1=1;E2=0;A0=0;A1=1;A2=1;A3=1;delay_us(time);break;} case 31: {E1=1;E2=0;A0=1;A1=1;A2=1;A3=1;delay_us(time);break;} } } void hienthi(int muc) {
Equalizer mini in home
switch(muc) { case 0: {DATA=muc0;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 1: {DATA=muc1;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 2: {DATA=muc2;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 3: {DATA=muc3;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 4: {DATA=muc4;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 5: {DATA=muc5;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 6: {DATA=muc6;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 7: {DATA=muc7;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 8: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc0;LC2=1;delay_us(time2);LC2=0;break;} case 9: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc1;LC2=1;delay_us(time2);LC2=0;break;} case 10: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc2;LC2=1;delay_us(time2);LC2=0;break;} case 11: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc3;LC2=1;delay_us(time2);LC2=0;break;} case 12: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc4;LC2=1;delay_us(time2);LC2=0;break;} case 13: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc5;LC2=1;delay_us(time2);LC2=0;break;} case 14: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc6;LC2=1;delay_us(time2);LC2=0;break;} case 15: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc7;LC2=1;delay_us(time2);
Equalizer mini in home
LC2=0;break;} case 16: {DATA=muc8;LC1=1;delay_us(time2);LC1=0;DATA=muc8;LC2=1;delay_us(time2);LC2=0;break;} } } int convert256to16(int x) { int temp; temp=x; if(temp==0){return 0;} if(temp>0&&temp<16){return 1;} if(temp>=16&&temp<32){return 2;} if(temp>=32&&temp<48){return 3;} if(temp>=48&&temp<64){return 4;} if(temp>=64&&temp<80){return 5;} if(temp>=80&&temp<94){return 6;} if(temp>=94&&temp<112){return 7;} if(temp>=112&&temp<128){return 8;} if(temp>=128&&temp<144){return 9;} if(temp>=144&&temp<160){return 10;} if(temp>=160&&temp<176){return 11;} if(temp>=176&&temp<192){return 12;} if(temp>=192&&temp<208){return 13;} if(temp>=208&&temp<224){return 14;} if(temp>=224&&temp<240){return 15;} if(temp>=240&&temp<=256){return 16;} } void hienchu(unsigned char ma[6],unsigned char x, unsigned char y) { int i; for(i=x;i<x+6;i++) { DATA=~ma[i-x]; switch(y) { case 0:{LC1=1;delay_us(time2);LC1=0;break;} case 1:{LC2=1;delay_us(time2);LC2=0;break;} } cot(i); delay_us(timeso); } } // Read the 8 most significant bits // of the AD conversion result unsigned char read_adc(unsigned char adc_input) {
Equalizer mini in home
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff); // Delay needed for the stabilization of the ADC input voltage delay_us(10); // Start the AD conversion ADCSRA|=0x40; // Wait for the AD conversion to complete while ((ADCSRA & 0x10)==0); ADCSRA|=0x10; return ADCH; } // Declare your global variables here void main(void) { // Declare your local variables here // Input/Output Ports initialization // Port A initialization // Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In // State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T PORTA=0x00; DDRA=0x00; // Port B initialization // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out // State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0 PORTB=0x00; DDRB=0xFF; // Port C initialization // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out // State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0 PORTC=0x00; DDRC=0xFF; // Port D initialization // Func7=Out Func6=Out Func5=Out Func4=Out Func3=In Func2=In Func1=Out Func0=Out // State7=0 State6=0 State5=0 State4=0 State3=T State2=T State1=0 State0=0 PORTD=0x00; DDRD=0xF3;
Equalizer mini in home
// Timer/Counter 0 initialization // Clock source: System Clock // Clock value: Timer 0 Stopped // Mode: Normal top=0xFF // OC0 output: Disconnected TCCR0=0x00; TCNT0=0x00; OCR0=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: Timer1 Stopped // Mode: Normal top=0xFFFF // OC1A output: Discon. // OC1B output: Discon. // Noise Canceler: Off // Input Capture on Falling Edge // Timer1 Overflow Interrupt: Off // Input Capture Interrupt: Off // Compare A Match Interrupt: Off // Compare B Match Interrupt: Off TCCR1A=0x00; TCCR1B=0x00; TCNT1H=0x00; TCNT1L=0x00; ICR1H=0x00; ICR1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; // Timer/Counter 2 initialization // Clock source: System Clock // Clock value: Timer2 Stopped // Mode: Normal top=0xFF // OC2 output: Disconnected ASSR=0x00; TCCR2=0x00; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: Off // INT1: Off // INT2: Off MCUCR=0x00; MCUCSR=0x00; // Timer(s)/Counter(s) Interrupt(s) initialization
Equalizer mini in home
TIMSK=0x00; // USART initialization // USART disabled UCSRB=0x00; // Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off ACSR=0x80; SFIOR=0x00; // ADC initialization // ADC Clock frequency: 1000.000 kHz // ADC Voltage Reference: Int., cap. on AREF // Only the 8 most significant bits of // the AD conversion result are used ADMUX=ADC_VREF_TYPE & 0xff; ADCSRA=0x84; // SPI initialization // SPI disabled SPCR=0x00; // TWI initialization // TWI disabled TWCR=0x00; // I2C Bus initialization i2c_init(); // DS1307 Real Time Clock initialization // Square wave output on pin SQW/OUT: On // Square wave frequency: 1Hz rtc_init(0,1,0); DATA=0x00;LC1=LC2=1;LC1=LC2=0; while (1) { {E1=0;E2=1; for(j=0;j<32;j++) { cot(j); delay_ms(1); data_adc=read_adc(0); i=convert256to16(data_adc); hienthi(i); }
Equalizer mini in home
I.V KẾT LUẬN
Qua ề tài trên các thành viên trong nhóm ã hiểu rõ về ứng dụng của vi iều
khiển và ặc biệt là ã làm ƣợc một sản phẩm thức tế cho bản thân tuy còn khá ơ
giản.
Thông qua việc th c hiện ề tài thành viên trong nhóm ã học ƣợc ĩ ă phân
tích tổng hợp tài liệu, ĩ ă làm việc nhóm, ĩ ă viết báo cáo-slide và ĩ ă thuyết
trình.Nâng cao khả ă làm việc th c tế với các phần mềm cần thiết cho ngành học
“Điện tử-viễn t ô ”
Tuy nhiên vẫn còn một s ƣợc iểm nhóm cần kh c phục ƣ: ĩ ă nghiên
cứu tài liệu ƣớc ngoài còn ƣ ƣợc t t, cần học h i thêm ĩ ă thuyết trình trƣớc
á ô ….