SlideShare a Scribd company logo
1 of 18
LISTING PROGRAM FILTER PENGHAPUS NOISE ADAPTIF FIR LMS 
DENGAN MEMANFAATKAN TMS320C613 
//Filter PEnghapus Noise Adaptif FIR LMS 
//Struktur Filter FIR : x1_topi += w[n]*x[n] 
//Sinyal_error=output_sistem : sinyal_e(n) = sinyal_campur - x1_topi; 
//UPdate Koefisien Menggunakan Algoritma LMS : w[i]+=miu*sinyal_e(n)*x[n]; 
//miu bervariasi berdasarkan pendekatan rumus step size maks : 1/NPx 
//noise yang dipakai noise sinusoida 100 Hz dan noise Bor 
// 
//codec-DSK(TMS320C6713) 
#include "DSK6713_AIC23.h" 
// 
//sampling 
Uint32 fs=DSK6713_AIC23_FREQ_48KHZ; 
#include <stdio.h> 
// 
//panjang elemen filter 
#define N 30 
// 
//definisi kanal kiri line input 
#define LEFT 0 
// 
//definisi kanal kanan line output 
#define RIGHT 1 
// 
//nilai bobot koefisien filter untuk panjang element N 
float w[N];// 
//input ke buffer untuk panjang elemen N pada filter FIR 
float delay[N]; 
// 
//output TMS320C6713 
short output; 
//tipe output pilihan jenis keluaran 
short jenis_keluaran = 1; 
// 
//
//deskripsi masukan 2kanal line input 
volatile union{unsigned int uint; short channel[2];}AIC23_data; 
// 
//ISR 
interrupt void c_int11() 
{ 
short i; 
float yn=0, En=0,campur=0, noise=0; 
//masukan 32bit dari line input 
AIC23_data.uint = input_sample(); 
//definisi noise untuk masukan line kiri 
noise =(AIC23_data.channel[LEFT]); 
//definisi noise untuk masukan line kanan 
campur = (AIC23_data.channel[RIGHT]); 
//noise sebagai masukan buffer ke-0 untuk FIR 
delay[0] = noise; 
//FIR 
for (i = 0; i < N; i++) 
//keluaran filter FIR 
yn += (w[i] * delay[i]); 
//sinyal selisih suara campuran dengan noise keluaran filter FIR 
En = campur - yn; 
//update koefisien filter dan delay FIR 
for (i = N-1; i >= 0; i--) 
{ 
//update koefisien(LMS algoritma) 
w[i] = w[i] + 0.0000000003*En*delay[i]; 
//update sample delay 
delay[i] = delay[i-1]; 
} 
//bila pilihan menu jenis keluaran dalam posisi 1 
if(jenis_keluaran == 1)
//jenis_keluaran = sinyal asli 
output=((short)campur); 
//bila pilihan menu jenis keluaran dalam posisi 2 
else if(jenis_keluaran==2) 
//jenis_keluaran = sinyal noise 
output=((short)noise); 
//bila pilihan menu keluaran dalam posisi 3 
else if(jenis_keluaran==3) 
//jenis keluaran = sinyal campuran 
output=((short)campur); 
//bila pilihan menu keluaran dalam posisi 4 
else if(jenis_keluaran==4) 
//jenis keluaran=sinyal filter noise FIR 
output=((short)yn); 
//bila pilihan menu keluaran dalam posisi 5 
else if(jenis_keluaran==5) 
//jenis_keluaran = sinyal selisih error 
output=((short)En); 
//bila pilihan menu keluaran dalam posisi 6 
else if(jenis_keluaran==6) 
//jenis_keluaran=sinyal suara tanpa noise 
output=((short)En); 
output_sample(output); 
return; 
} 
void main() 
{ 
short T=0; 
for (T = 0; T < 30; T++) 
{ 
//inisialisasi buffer untuk bobot koefisien filter 
w[T] = 0; 
//inisialisasi buffer untuk sample delay 
delay[T] = 0; } 
comm_intr(); 
while(1); 
}
LISTING PROGRAM TOMBOL PILIHAN OUTPUT (SLIDE GEL) 
/*pilihan jenis keluaran TMS320C6713*/ 
/*pilihan sebanyak 6 buah yaitu untuk keluaran sinyal asli, sinyal noise, sinyal noise hasil 
filtering, sinyal campur, sinyal e(n), sinyal output system*/ 
/*Nama menu adalah jenis keluaran*/ 
menuitem "jenis_keluaran" 
/*slide macam-macam keluaran*/ 
/*(nilai awal, nilai akhir, nilai kenaikan, nilai default, nama variable)*/ 
slider jenis_keluaran(1,6,1,1,keluaran){ 
/*slide keluaran sama dengan nilai variabel*/ 
jenis_keluaran = keluaran; 
}
LISTING PROGRAM FILE SUPPORT “dsk6713.h” 
/* 
* Copyright 2002 by Spectrum Digital Incorporated. 
* All rights reserved. Property of Spectrum Digital Incorporated. 
*/ 
/* 
* ======== dsk6713.h ======== 
* 
* This files contains DSK6713 board specific I/O registers 
* define for the CPLD. 
*/ 
#ifndef DSK6713_ 
#define DSK6713_ 
#ifdef __cplusplus 
extern "C" { 
#endif 
#include <csl.h> 
/* 
* Note: Bit definitions for each register field 
* needs to be supplied here for the CPLD 
* and other board periperals. 
*/ 
/* Compatability definitions */ 
#define NULL 0 
/* CPLD address definitions */ 
#define DSK6713_CPLD_BASE 0x90080000 
/* CPLD Register Indices */ 
#define DSK6713_USER_REG 0 
#define DSK6713_DC_REG 1 
#define DSK6713_VERSION 4
#define DSK6713_MISC 6 
/* CPLD Register Bits */ 
#define DC_DET 0x80 
#define DC_STAT1 0x20 
#define DC_STAT0 0x10 
#define DC_CNTL1 0x02 
#define DC_CNTL0 0x01 
#define TIN1SEL 0x08 
#define TIN0SEL 0x04 
#define MCBSP2SEL 0x02 
#define MCBSP1SEL 0x01 
/* Initialize all board APIs */ 
void DSK6713_init (); 
/* Read an 8-bit value from a CPLD register */ 
Uint8 DSK6713_rget(Int16 regnum); 
/* Write an 8-bit value to a CPLD register */ 
void DSK6713_rset(Int16 regnum, Uint8 regval); 
/* Spin in a delay loop for delay iterations */ 
void DSK6713_wait(Uint32 delay); 
/* Spin in a delay loop for delay microseconds */ 
void DSK6713_waitusec(Uint32 delay); 
/* Get the DSK version */ 
Int16 DSK6713_getVers ion(); 
#ifdef __cplusplus 
} 
#endif 
#endif
LISTING PROGRAM FILE SUPPORT “dsk6713_aic23.h” 
/* 
* Copyright 2002 by Spectrum Digital Incorporated. 
* All rights reserved. Property of Spectrum Digital Incorporated. 
*/ 
/* 
* ======== dsk6713.h ======== 
* 
* This files contains DSK6713 board specific I/O registers 
* define for the CPLD. 
*/ 
#ifndef DSK6713_ 
#define DSK6713_ 
#ifdef __cplusplus 
extern "C" { 
#endif 
#include <csl.h> 
/* 
* Note: Bit definitions for each register field 
* needs to be supplied here for the CPLD 
* and other board periperals. 
*/ 
/* Compatability definitions */ 
#define NULL 0 
/* CPLD address definitions */ 
#define DSK6713_CPLD_BASE 0x90080000 
/* CPLD Register Indices */ 
#define DSK6713_USER_REG 0 
#define DSK6713_DC_REG 1
#define DSK6713_VERSION 4 
#define DSK6713_MISC 6 
/* CPLD Register Bits */ 
#define DC_DET 0x80 
#define DC_STAT1 0x20 
#define DC_STAT0 0x10 
#define DC_CNTL1 0x02 
#define DC_CNTL0 0x01 
#define TIN1SEL 0x08 
#define TIN0SEL 0x04 
#define MCBSP2SEL 0x02 
#define MCBSP1SEL 0x01 
/* Initialize all board APIs */ 
void DSK6713_init (); 
/* Read an 8-bit value from a CPLD register */ 
Uint8 DSK6713_rget(Int16 regnum); 
/* Write an 8-bit value to a CPLD register */ 
void DSK6713_rset(Int16 regnum, Uint8 regval); 
/* Spin in a delay loop for delay iterations */ 
void DSK6713_wait(Uint32 delay); 
/* Spin in a delay loop for delay microseconds */ 
void DSK6713_waitusec(Uint32 delay); 
/* Get the DSK version */ 
Int16 DSK6713_getVers ion(); 
#ifdef __cplusplus 
} 
#endif 
#endif
LISTING PROGRAM FILE SUPPORT “c6713init.c” 
//C6713dskinit.c Includes functions from TI in the C6713 CSL and C6713DSK BSL 
#include "C6713dskinit .h" 
#define using_bios //if BIOS don't use top of vector table 
extern Uint32 fs; //for sampling frequency 
void c6713_dsk_init() //dsp-peripheral initializat ion 
{ 
DSK6713_init(); //call BSL to init DSK-EMIF,PLL) 
hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);//handle(pointer) to codec 
DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate 
MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);// interface 32 bits 
toAIC23 
MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START | 
MCBSP_RCV_START | 
MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);//start data channel 
again 
} 
void comm_poll() //added for 
communication/init using polling 
{ 
poll=1; //1 if using polling 
c6713_dsk_init(); //init DSP and codec 
} 
void comm_intr() //for 
communication/init using interrupt 
{ 
poll=0; //0 since not polling 
IRQ_globalDisable(); //disable interrupts 
c6713_dsk_init(); //init DSP and codec
CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);//McB 
SP1 Xmit 
#ifndef using_bios //do not need to point to vector 
table 
IRQ_setVecs(vectors); //point to the IRQ vector table 
#endif //since 
interrupt vector handles this 
IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11 
IRQ_reset(CODECEventId); //reset codec INT 11 
IRQ_globalEnable(); //globally enable interrupts 
IRQ_nmiEnable(); //enable NMI interrupt 
IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11 
output_sample(0); //start McBSP interrupt outputting a sample 
} 
void output_sample(int out_data) //for out to Left and Right channels 
{ 
short CHANNEL_data; 
AIC_data.uint=0; //clear data structure 
AIC_data.uint=out_data; //32-bit data -->data structure 
//The existing interface defaults to right channel. To default instead to the 
//left channel and use output_sample(short), left and right channels are swapped 
//In main source program use LEFT 0 and RIGHT 1 (opposite of what is used here) 
CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right 
channels 
AIC_data.channel[RIGHT]=AIC_data.channel[LEFT]; 
AIC_data.channel[LEFT]=CHANNEL_data; 
if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to transmit 
MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data 
}
void output_left_sample(short out_data) //for output from left channel 
{ 
AIC_data.uint=0; //clear data structure 
AIC_data.channel[LEFT]=out_data; //data from Left channel -->data structure 
transmit 
channel 
} 
if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));// if ready to 
MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//output left 
void output_right_sample(short out_data) //for output from right channel 
{ 
AIC_data.uint=0; //clear data structure 
AIC_data.channel[RIGHT]=out_data; //data from Right channel -->data structure 
transmit 
if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));// if ready to 
MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//output 
right channel 
} 
Uint32 input_sample() //for 32-bit input 
{ 
short CHANNEL_data; 
receive 
if (poll) while(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE));//if ready to 
AIC_data.uint=MCBSP_read(DSK6713_AIC23_DATAHANDLE);//read data 
//Swapping left and right channels (see comments in output_sample()) 
CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right 
channel 
AIC_data.channel[RIGHT]=AIC_data.channel[LEFT]; 
AIC_data.channel[LEFT]=CHANNEL_data; 
return(AIC_data.uint);
} 
short input_left_sample() //input to left channel 
{ 
receive 
channel 
if (poll) while(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE));//if ready to 
AIC_data.uint=MCBSP_read(DSK6713_AIC23_DATAHANDLE);//read into left 
return(AIC_data.channel[LEFT]); //return left 
channel data 
} 
short input_right_sample() //input to right channel 
{ 
receive 
channel 
data 
} 
if (poll) while(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE));//if ready to 
AIC_data.uint=MCBSP_read(DSK6713_AIC23_DATAHANDLE);//read into right 
return(AIC_data.channel[RIGHT]); //return right channel
LISTING PROGRAM FILE SUPPORT “vector_intr.as m” 
*Vectors_intr.asm Vector file for interrupt INT11 
.global _vectors ;global symbols 
.global _c_int00 
.global _vector1 
.global _vector2 
.global _vector3 
.global _vector4 
.global _vector5 
.global _vector6 
.global _vector7 
.global _vector8 
.global _vector9 
.global _vector10 
.global _c_int11 ;for INT11 
.global _vector12 
.global _vector13 
.global _vector14 
.global _vector15 
.ref _c_int00 ;entry address 
VEC_ENTRY .macro addr ;macro for ISR 
STW B0,*--B15 
MVKL addr,B0 
MVKH addr,B0 
B B0 
LDW *B15++,B0 
NOP 2 
NOP 
NOP 
.endm 
_vec_dummy: 
B B3 
NOP 5
.sect ".vecs" ;aligned IST section 
.align 1024 
_vectors: 
_vector0: VEC_ENTRY _c_int00 ;RESET 
_vector1: VEC_ENTRY _vec_dummy ;NMI 
_vector2: VEC_ENTRY _vec_dummy ;RSVD 
_vector3: VEC_ENTRY _vec_dummy 
_vector4: VEC_ENTRY _vec_dummy 
_vector5: VEC_ENTRY _vec_dummy 
_vector6: VEC_ENTRY _vec_dummy 
_vector7: VEC_ENTRY _vec_dummy 
_vector8: VEC_ENTRY _vec_dummy 
_vector9: VEC_ENTRY _vec_dummy 
_vector10: VEC_ENTRY _vec_dummy 
_vector11: VEC_ENTRY _c_int11 ;ISR address 
_vector12: VEC_ENTRY _vec_dummy 
_vector13: VEC_ENTRY _vec_dummy 
_vector14: VEC_ENTRY _vec_dummy 
_vector15: VEC_ENTRY _vec_dummy
LISTING PROGRAM PLOT SINYAL DAN FREKUENSI MATLAB 
x=wavread(‘file1.wav'); 
y=wavread('file2.wav'); 
fs=10000; 
% plot sinyal 1 
t=(0:length(x)-1)/fs; % sampling 
%gambar 1 merupakan gambar plotting sinyal 1 
figure(1) 
%sub gambar untuk sinyal kontinyu 1 
subplot(2,1,1) 
plot(t,x) 
title(Sinyal 1 (Domain Waktu)') 
xlabel('Waktu (s)') 
ylabel('Amplitudo') 
axis([min(t) max(t) min(2*x) max(2*x)]) 
saveas(gcf, 'sinyal1', 'jpg') 
% fourier transform 
X1=fft(x); 
% plot spektrum dibawah 200Hz 
Hz200=200*length(X1)/fs; 
f=(0:hz200)*fs/length(X1); 
%sub gambar sinyal fungsi frekuensi 
subplot(2,1,2) 
a=20*log10(abs(X1(1:length(f)))+eps); 
plot(f,abs(a)) 
grid on 
title(sinyal 1 (Domain Frekuensi)') 
xlabel('Frekuensi (Hz)') 
ylabel('Magnitude (dB)') 
%Plot sinyal 2 
t2=(0:length(y)-1)/fs; % sampling 
%gambar 2 untuk plotting sinyal 2 
figure(2)
%subgambar untuk plot sinyal 2 kontinyu 
subplot(2,1,1) 
plot(t2,y) 
title('Sinyal 2 (Domain Waktu)') 
xlabel('Waktu (s)') 
ylabel('Amplitudo') 
axis([min(t2) max(t2) min(2*y) max(2*y)]) 
saveas(gcf, 'sinyal 2', 'jpg') 
% fourier transform 
Y1=fft(y); 
% plot spektrum dibawah 100Hz 
hz100=100*length(Y1)/fs; 
f2=(0:hz100)*fs/length(Y1); 
%subgambar sinyal 2 domain frekuensi 
subplot(2,1,2) 
a2=20*log10(abs(Y1(1:length(f2)))+eps); 
plot(f2,abs(a2)) 
grid on 
title(Sinyal 2(Domain Frekuensi)') 
xlabel('Frekuensi (Hz)') 
ylabel('Magnitude (dB)') 
% 
%Gambar 3 untuk plot 3 subgambar 
figure(3) 
subplot(3,1,1) plot(t2,y,'r') 
title('Sinyal1(Domain Waktu)') 
xlabel('Waktu (s)') 
ylabel('Amplitudo') 
axis([min(t2) max(t2) min(1.5*y) max(1.5*y)]) 
subplot(3,1,2) 
plot(t,x) 
title('Sinyal2(Domain Waktu)') 
xlabel('Waktu (s)') 
ylabel('Amplitudo') 
axis([min(t) max(t) min(1.5*x) max(1.5*x)])
subplot(3,1,3) 
plot(f,abs(a),'b',f2,abs(a2),'r') 
grid on 
title('Sinyal1&sinyal2(Domain Frekuensi)') 
legend('sinyal1','sinyal2',0); 
xlabel('Frekuensi (Hz)') 
ylabel('Magnitude (dB)') 
saveas(gcf, '3gbr', 'jpg') 
%gambar 4 untuk plotting gabungan sinyal1 dan 2 domain frekuensi 
figure(4) 
plot(f,abs(a),'b',f2,abs(a2),'r','linewidth',1.5) 
grid on 
title(sinyal 1 dan sinyal 2 (Domain Frekuensi)') 
legend('Output Sistem','Campuran',1); 
xlabel('Frekuensi (Hz)') 
ylabel('Magnitude (dB)') 
saveas(gcf, 'frekDomain', 'jpg')
LISTING PROGRAM HITUNG SNR SINYAL DENGAN MATLAB 
clc, 
%baca sinyal suara.wav 
x_signal = wavread(‘sinyal suara’.wav'); 
%baca sinyal noise.wav 
x_noise = wavread('sinyal noise.wav'); 
%Daya Sinyal suara 
P_x_signal = mean(x_signal.^2); 
%daya sinyal noise 
P_x_noise = mean(x_noise.^2); 
%SNR 
SNR1 = 10*log10(P_x_signal/P_x_noise);

More Related Content

What's hot

Devirtualizing FinSpy
Devirtualizing FinSpyDevirtualizing FinSpy
Devirtualizing FinSpy
jduart
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
venravi10
 
CODING IN ARDUINO
CODING IN ARDUINOCODING IN ARDUINO
CODING IN ARDUINO
S Ayub
 

What's hot (20)

Switch level modeling
Switch level modelingSwitch level modeling
Switch level modeling
 
Dam gate open close lpc prog
Dam gate open close lpc progDam gate open close lpc prog
Dam gate open close lpc prog
 
L293D IC interfacing with ATmega16
L293D IC interfacing with ATmega16 L293D IC interfacing with ATmega16
L293D IC interfacing with ATmega16
 
Devirtualizing FinSpy
Devirtualizing FinSpyDevirtualizing FinSpy
Devirtualizing FinSpy
 
Uart
UartUart
Uart
 
Lecture 2 verilog
Lecture 2   verilogLecture 2   verilog
Lecture 2 verilog
 
Lecture7
Lecture7Lecture7
Lecture7
 
CODING IN ARDUINO
CODING IN ARDUINOCODING IN ARDUINO
CODING IN ARDUINO
 
FINISHED_CODE
FINISHED_CODEFINISHED_CODE
FINISHED_CODE
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manual
 
Relay and AVR Atmel Atmega 16
Relay and AVR Atmel Atmega 16Relay and AVR Atmel Atmega 16
Relay and AVR Atmel Atmega 16
 
Programming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded CProgramming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded C
 
AVR programming - BASICS
AVR programming - BASICSAVR programming - BASICS
AVR programming - BASICS
 
8 bit single cycle processor
8 bit single cycle processor8 bit single cycle processor
8 bit single cycle processor
 
Vm ware fuzzing - defcon russia 20
Vm ware fuzzing  - defcon russia 20Vm ware fuzzing  - defcon russia 20
Vm ware fuzzing - defcon russia 20
 
Appsec obfuscator reloaded
Appsec obfuscator reloadedAppsec obfuscator reloaded
Appsec obfuscator reloaded
 
Lampiran 1.programdocx
Lampiran 1.programdocxLampiran 1.programdocx
Lampiran 1.programdocx
 
Crash course in verilog
Crash course in verilogCrash course in verilog
Crash course in verilog
 
verilog code
verilog codeverilog code
verilog code
 
Dsd lab Practical File
Dsd lab Practical FileDsd lab Practical File
Dsd lab Practical File
 

Viewers also liked

The meaning of education technology ppt
The meaning of education technology pptThe meaning of education technology ppt
The meaning of education technology ppt
Aiza11
 
The meaning of education technology ppt
The meaning of education technology pptThe meaning of education technology ppt
The meaning of education technology ppt
Aiza11
 
Bauer Security Ltd. Overview
Bauer Security Ltd. OverviewBauer Security Ltd. Overview
Bauer Security Ltd. Overview
Bauer Security
 

Viewers also liked (13)

The meaning of education technology ppt
The meaning of education technology pptThe meaning of education technology ppt
The meaning of education technology ppt
 
Bab 3
Bab 3Bab 3
Bab 3
 
The meaning of education technology ppt
The meaning of education technology pptThe meaning of education technology ppt
The meaning of education technology ppt
 
Bab 4
Bab 4Bab 4
Bab 4
 
Bab 1
Bab 1Bab 1
Bab 1
 
Bauer Security Ltd. Overview
Bauer Security Ltd. OverviewBauer Security Ltd. Overview
Bauer Security Ltd. Overview
 
test
testtest
test
 
інфографіка
інфографікаінфографіка
інфографіка
 
test
testtest
test
 
бокс для белых воротничков
бокс для белых воротничковбокс для белых воротничков
бокс для белых воротничков
 
Five factors affecting language learning strategies
Five factors affecting language learning strategiesFive factors affecting language learning strategies
Five factors affecting language learning strategies
 
Civil Disobedience by Hannah Arendt
Civil Disobedience by Hannah ArendtCivil Disobedience by Hannah Arendt
Civil Disobedience by Hannah Arendt
 
The Meaning of Education Technology PPT
The Meaning of Education Technology PPTThe Meaning of Education Technology PPT
The Meaning of Education Technology PPT
 

Similar to (381877808) 102054282 5-listing-program

Combine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfCombine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdf
forwardcom41
 
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
 

Similar to (381877808) 102054282 5-listing-program (20)

Combine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfCombine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdf
 
PIC and LCD
PIC and LCDPIC and LCD
PIC and LCD
 
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
 
Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015
 
Microcontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docxMicrocontroladores: programas de CCS Compiler.docx
Microcontroladores: programas de CCS Compiler.docx
 
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
 
LED
LEDLED
LED
 
Ir remote kit_blink.pde
Ir remote kit_blink.pdeIr remote kit_blink.pde
Ir remote kit_blink.pde
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
#include LPC17xx.h#include Lights.h#include traffic_fo.docx
#include LPC17xx.h#include Lights.h#include traffic_fo.docx#include LPC17xx.h#include Lights.h#include traffic_fo.docx
#include LPC17xx.h#include Lights.h#include traffic_fo.docx
 
Presentation
PresentationPresentation
Presentation
 
Sysprog17
Sysprog17Sysprog17
Sysprog17
 
Lcd n PIC16F
Lcd n PIC16FLcd n PIC16F
Lcd n PIC16F
 
Product catlog
Product catlogProduct catlog
Product catlog
 
CC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleCC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver Module
 
P sim.val
P sim.valP sim.val
P sim.val
 
Automatic room light controller with visible counter
Automatic room light controller with visible counterAutomatic room light controller with visible counter
Automatic room light controller with visible counter
 
Arduino and Robotics
Arduino and RoboticsArduino and Robotics
Arduino and Robotics
 
Quiz 9
Quiz 9Quiz 9
Quiz 9
 
Programming A Robot Using
Programming A Robot UsingProgramming A Robot Using
Programming A Robot Using
 

Recently uploaded

In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
HyderabadDolls
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
nirzagarg
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
nirzagarg
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 

Recently uploaded (20)

In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 
20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themKings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about them
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
 

(381877808) 102054282 5-listing-program

  • 1. LISTING PROGRAM FILTER PENGHAPUS NOISE ADAPTIF FIR LMS DENGAN MEMANFAATKAN TMS320C613 //Filter PEnghapus Noise Adaptif FIR LMS //Struktur Filter FIR : x1_topi += w[n]*x[n] //Sinyal_error=output_sistem : sinyal_e(n) = sinyal_campur - x1_topi; //UPdate Koefisien Menggunakan Algoritma LMS : w[i]+=miu*sinyal_e(n)*x[n]; //miu bervariasi berdasarkan pendekatan rumus step size maks : 1/NPx //noise yang dipakai noise sinusoida 100 Hz dan noise Bor // //codec-DSK(TMS320C6713) #include "DSK6713_AIC23.h" // //sampling Uint32 fs=DSK6713_AIC23_FREQ_48KHZ; #include <stdio.h> // //panjang elemen filter #define N 30 // //definisi kanal kiri line input #define LEFT 0 // //definisi kanal kanan line output #define RIGHT 1 // //nilai bobot koefisien filter untuk panjang element N float w[N];// //input ke buffer untuk panjang elemen N pada filter FIR float delay[N]; // //output TMS320C6713 short output; //tipe output pilihan jenis keluaran short jenis_keluaran = 1; // //
  • 2. //deskripsi masukan 2kanal line input volatile union{unsigned int uint; short channel[2];}AIC23_data; // //ISR interrupt void c_int11() { short i; float yn=0, En=0,campur=0, noise=0; //masukan 32bit dari line input AIC23_data.uint = input_sample(); //definisi noise untuk masukan line kiri noise =(AIC23_data.channel[LEFT]); //definisi noise untuk masukan line kanan campur = (AIC23_data.channel[RIGHT]); //noise sebagai masukan buffer ke-0 untuk FIR delay[0] = noise; //FIR for (i = 0; i < N; i++) //keluaran filter FIR yn += (w[i] * delay[i]); //sinyal selisih suara campuran dengan noise keluaran filter FIR En = campur - yn; //update koefisien filter dan delay FIR for (i = N-1; i >= 0; i--) { //update koefisien(LMS algoritma) w[i] = w[i] + 0.0000000003*En*delay[i]; //update sample delay delay[i] = delay[i-1]; } //bila pilihan menu jenis keluaran dalam posisi 1 if(jenis_keluaran == 1)
  • 3. //jenis_keluaran = sinyal asli output=((short)campur); //bila pilihan menu jenis keluaran dalam posisi 2 else if(jenis_keluaran==2) //jenis_keluaran = sinyal noise output=((short)noise); //bila pilihan menu keluaran dalam posisi 3 else if(jenis_keluaran==3) //jenis keluaran = sinyal campuran output=((short)campur); //bila pilihan menu keluaran dalam posisi 4 else if(jenis_keluaran==4) //jenis keluaran=sinyal filter noise FIR output=((short)yn); //bila pilihan menu keluaran dalam posisi 5 else if(jenis_keluaran==5) //jenis_keluaran = sinyal selisih error output=((short)En); //bila pilihan menu keluaran dalam posisi 6 else if(jenis_keluaran==6) //jenis_keluaran=sinyal suara tanpa noise output=((short)En); output_sample(output); return; } void main() { short T=0; for (T = 0; T < 30; T++) { //inisialisasi buffer untuk bobot koefisien filter w[T] = 0; //inisialisasi buffer untuk sample delay delay[T] = 0; } comm_intr(); while(1); }
  • 4. LISTING PROGRAM TOMBOL PILIHAN OUTPUT (SLIDE GEL) /*pilihan jenis keluaran TMS320C6713*/ /*pilihan sebanyak 6 buah yaitu untuk keluaran sinyal asli, sinyal noise, sinyal noise hasil filtering, sinyal campur, sinyal e(n), sinyal output system*/ /*Nama menu adalah jenis keluaran*/ menuitem "jenis_keluaran" /*slide macam-macam keluaran*/ /*(nilai awal, nilai akhir, nilai kenaikan, nilai default, nama variable)*/ slider jenis_keluaran(1,6,1,1,keluaran){ /*slide keluaran sama dengan nilai variabel*/ jenis_keluaran = keluaran; }
  • 5. LISTING PROGRAM FILE SUPPORT “dsk6713.h” /* * Copyright 2002 by Spectrum Digital Incorporated. * All rights reserved. Property of Spectrum Digital Incorporated. */ /* * ======== dsk6713.h ======== * * This files contains DSK6713 board specific I/O registers * define for the CPLD. */ #ifndef DSK6713_ #define DSK6713_ #ifdef __cplusplus extern "C" { #endif #include <csl.h> /* * Note: Bit definitions for each register field * needs to be supplied here for the CPLD * and other board periperals. */ /* Compatability definitions */ #define NULL 0 /* CPLD address definitions */ #define DSK6713_CPLD_BASE 0x90080000 /* CPLD Register Indices */ #define DSK6713_USER_REG 0 #define DSK6713_DC_REG 1 #define DSK6713_VERSION 4
  • 6. #define DSK6713_MISC 6 /* CPLD Register Bits */ #define DC_DET 0x80 #define DC_STAT1 0x20 #define DC_STAT0 0x10 #define DC_CNTL1 0x02 #define DC_CNTL0 0x01 #define TIN1SEL 0x08 #define TIN0SEL 0x04 #define MCBSP2SEL 0x02 #define MCBSP1SEL 0x01 /* Initialize all board APIs */ void DSK6713_init (); /* Read an 8-bit value from a CPLD register */ Uint8 DSK6713_rget(Int16 regnum); /* Write an 8-bit value to a CPLD register */ void DSK6713_rset(Int16 regnum, Uint8 regval); /* Spin in a delay loop for delay iterations */ void DSK6713_wait(Uint32 delay); /* Spin in a delay loop for delay microseconds */ void DSK6713_waitusec(Uint32 delay); /* Get the DSK version */ Int16 DSK6713_getVers ion(); #ifdef __cplusplus } #endif #endif
  • 7. LISTING PROGRAM FILE SUPPORT “dsk6713_aic23.h” /* * Copyright 2002 by Spectrum Digital Incorporated. * All rights reserved. Property of Spectrum Digital Incorporated. */ /* * ======== dsk6713.h ======== * * This files contains DSK6713 board specific I/O registers * define for the CPLD. */ #ifndef DSK6713_ #define DSK6713_ #ifdef __cplusplus extern "C" { #endif #include <csl.h> /* * Note: Bit definitions for each register field * needs to be supplied here for the CPLD * and other board periperals. */ /* Compatability definitions */ #define NULL 0 /* CPLD address definitions */ #define DSK6713_CPLD_BASE 0x90080000 /* CPLD Register Indices */ #define DSK6713_USER_REG 0 #define DSK6713_DC_REG 1
  • 8. #define DSK6713_VERSION 4 #define DSK6713_MISC 6 /* CPLD Register Bits */ #define DC_DET 0x80 #define DC_STAT1 0x20 #define DC_STAT0 0x10 #define DC_CNTL1 0x02 #define DC_CNTL0 0x01 #define TIN1SEL 0x08 #define TIN0SEL 0x04 #define MCBSP2SEL 0x02 #define MCBSP1SEL 0x01 /* Initialize all board APIs */ void DSK6713_init (); /* Read an 8-bit value from a CPLD register */ Uint8 DSK6713_rget(Int16 regnum); /* Write an 8-bit value to a CPLD register */ void DSK6713_rset(Int16 regnum, Uint8 regval); /* Spin in a delay loop for delay iterations */ void DSK6713_wait(Uint32 delay); /* Spin in a delay loop for delay microseconds */ void DSK6713_waitusec(Uint32 delay); /* Get the DSK version */ Int16 DSK6713_getVers ion(); #ifdef __cplusplus } #endif #endif
  • 9. LISTING PROGRAM FILE SUPPORT “c6713init.c” //C6713dskinit.c Includes functions from TI in the C6713 CSL and C6713DSK BSL #include "C6713dskinit .h" #define using_bios //if BIOS don't use top of vector table extern Uint32 fs; //for sampling frequency void c6713_dsk_init() //dsp-peripheral initializat ion { DSK6713_init(); //call BSL to init DSK-EMIF,PLL) hAIC23_handle=DSK6713_AIC23_openCodec(0, &config);//handle(pointer) to codec DSK6713_AIC23_setFreq(hAIC23_handle, fs); //set sample rate MCBSP_config(DSK6713_AIC23_DATAHANDLE,&AIC23CfgData);// interface 32 bits toAIC23 MCBSP_start(DSK6713_AIC23_DATAHANDLE, MCBSP_XMIT_START | MCBSP_RCV_START | MCBSP_SRGR_START | MCBSP_SRGR_FRAMESYNC, 220);//start data channel again } void comm_poll() //added for communication/init using polling { poll=1; //1 if using polling c6713_dsk_init(); //init DSP and codec } void comm_intr() //for communication/init using interrupt { poll=0; //0 since not polling IRQ_globalDisable(); //disable interrupts c6713_dsk_init(); //init DSP and codec
  • 10. CODECEventId=MCBSP_getXmtEventId(DSK6713_AIC23_codecdatahandle);//McB SP1 Xmit #ifndef using_bios //do not need to point to vector table IRQ_setVecs(vectors); //point to the IRQ vector table #endif //since interrupt vector handles this IRQ_map(CODECEventId, 11); //map McBSP1 Xmit to INT11 IRQ_reset(CODECEventId); //reset codec INT 11 IRQ_globalEnable(); //globally enable interrupts IRQ_nmiEnable(); //enable NMI interrupt IRQ_enable(CODECEventId); //enable CODEC eventXmit INT11 output_sample(0); //start McBSP interrupt outputting a sample } void output_sample(int out_data) //for out to Left and Right channels { short CHANNEL_data; AIC_data.uint=0; //clear data structure AIC_data.uint=out_data; //32-bit data -->data structure //The existing interface defaults to right channel. To default instead to the //left channel and use output_sample(short), left and right channels are swapped //In main source program use LEFT 0 and RIGHT 1 (opposite of what is used here) CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channels AIC_data.channel[RIGHT]=AIC_data.channel[LEFT]; AIC_data.channel[LEFT]=CHANNEL_data; if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));//if ready to transmit MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//write/output data }
  • 11. void output_left_sample(short out_data) //for output from left channel { AIC_data.uint=0; //clear data structure AIC_data.channel[LEFT]=out_data; //data from Left channel -->data structure transmit channel } if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));// if ready to MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//output left void output_right_sample(short out_data) //for output from right channel { AIC_data.uint=0; //clear data structure AIC_data.channel[RIGHT]=out_data; //data from Right channel -->data structure transmit if (poll) while(!MCBSP_xrdy(DSK6713_AIC23_DATAHANDLE));// if ready to MCBSP_write(DSK6713_AIC23_DATAHANDLE,AIC_data.uint);//output right channel } Uint32 input_sample() //for 32-bit input { short CHANNEL_data; receive if (poll) while(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE));//if ready to AIC_data.uint=MCBSP_read(DSK6713_AIC23_DATAHANDLE);//read data //Swapping left and right channels (see comments in output_sample()) CHANNEL_data=AIC_data.channel[RIGHT]; //swap left and right channel AIC_data.channel[RIGHT]=AIC_data.channel[LEFT]; AIC_data.channel[LEFT]=CHANNEL_data; return(AIC_data.uint);
  • 12. } short input_left_sample() //input to left channel { receive channel if (poll) while(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE));//if ready to AIC_data.uint=MCBSP_read(DSK6713_AIC23_DATAHANDLE);//read into left return(AIC_data.channel[LEFT]); //return left channel data } short input_right_sample() //input to right channel { receive channel data } if (poll) while(!MCBSP_rrdy(DSK6713_AIC23_DATAHANDLE));//if ready to AIC_data.uint=MCBSP_read(DSK6713_AIC23_DATAHANDLE);//read into right return(AIC_data.channel[RIGHT]); //return right channel
  • 13. LISTING PROGRAM FILE SUPPORT “vector_intr.as m” *Vectors_intr.asm Vector file for interrupt INT11 .global _vectors ;global symbols .global _c_int00 .global _vector1 .global _vector2 .global _vector3 .global _vector4 .global _vector5 .global _vector6 .global _vector7 .global _vector8 .global _vector9 .global _vector10 .global _c_int11 ;for INT11 .global _vector12 .global _vector13 .global _vector14 .global _vector15 .ref _c_int00 ;entry address VEC_ENTRY .macro addr ;macro for ISR STW B0,*--B15 MVKL addr,B0 MVKH addr,B0 B B0 LDW *B15++,B0 NOP 2 NOP NOP .endm _vec_dummy: B B3 NOP 5
  • 14. .sect ".vecs" ;aligned IST section .align 1024 _vectors: _vector0: VEC_ENTRY _c_int00 ;RESET _vector1: VEC_ENTRY _vec_dummy ;NMI _vector2: VEC_ENTRY _vec_dummy ;RSVD _vector3: VEC_ENTRY _vec_dummy _vector4: VEC_ENTRY _vec_dummy _vector5: VEC_ENTRY _vec_dummy _vector6: VEC_ENTRY _vec_dummy _vector7: VEC_ENTRY _vec_dummy _vector8: VEC_ENTRY _vec_dummy _vector9: VEC_ENTRY _vec_dummy _vector10: VEC_ENTRY _vec_dummy _vector11: VEC_ENTRY _c_int11 ;ISR address _vector12: VEC_ENTRY _vec_dummy _vector13: VEC_ENTRY _vec_dummy _vector14: VEC_ENTRY _vec_dummy _vector15: VEC_ENTRY _vec_dummy
  • 15. LISTING PROGRAM PLOT SINYAL DAN FREKUENSI MATLAB x=wavread(‘file1.wav'); y=wavread('file2.wav'); fs=10000; % plot sinyal 1 t=(0:length(x)-1)/fs; % sampling %gambar 1 merupakan gambar plotting sinyal 1 figure(1) %sub gambar untuk sinyal kontinyu 1 subplot(2,1,1) plot(t,x) title(Sinyal 1 (Domain Waktu)') xlabel('Waktu (s)') ylabel('Amplitudo') axis([min(t) max(t) min(2*x) max(2*x)]) saveas(gcf, 'sinyal1', 'jpg') % fourier transform X1=fft(x); % plot spektrum dibawah 200Hz Hz200=200*length(X1)/fs; f=(0:hz200)*fs/length(X1); %sub gambar sinyal fungsi frekuensi subplot(2,1,2) a=20*log10(abs(X1(1:length(f)))+eps); plot(f,abs(a)) grid on title(sinyal 1 (Domain Frekuensi)') xlabel('Frekuensi (Hz)') ylabel('Magnitude (dB)') %Plot sinyal 2 t2=(0:length(y)-1)/fs; % sampling %gambar 2 untuk plotting sinyal 2 figure(2)
  • 16. %subgambar untuk plot sinyal 2 kontinyu subplot(2,1,1) plot(t2,y) title('Sinyal 2 (Domain Waktu)') xlabel('Waktu (s)') ylabel('Amplitudo') axis([min(t2) max(t2) min(2*y) max(2*y)]) saveas(gcf, 'sinyal 2', 'jpg') % fourier transform Y1=fft(y); % plot spektrum dibawah 100Hz hz100=100*length(Y1)/fs; f2=(0:hz100)*fs/length(Y1); %subgambar sinyal 2 domain frekuensi subplot(2,1,2) a2=20*log10(abs(Y1(1:length(f2)))+eps); plot(f2,abs(a2)) grid on title(Sinyal 2(Domain Frekuensi)') xlabel('Frekuensi (Hz)') ylabel('Magnitude (dB)') % %Gambar 3 untuk plot 3 subgambar figure(3) subplot(3,1,1) plot(t2,y,'r') title('Sinyal1(Domain Waktu)') xlabel('Waktu (s)') ylabel('Amplitudo') axis([min(t2) max(t2) min(1.5*y) max(1.5*y)]) subplot(3,1,2) plot(t,x) title('Sinyal2(Domain Waktu)') xlabel('Waktu (s)') ylabel('Amplitudo') axis([min(t) max(t) min(1.5*x) max(1.5*x)])
  • 17. subplot(3,1,3) plot(f,abs(a),'b',f2,abs(a2),'r') grid on title('Sinyal1&sinyal2(Domain Frekuensi)') legend('sinyal1','sinyal2',0); xlabel('Frekuensi (Hz)') ylabel('Magnitude (dB)') saveas(gcf, '3gbr', 'jpg') %gambar 4 untuk plotting gabungan sinyal1 dan 2 domain frekuensi figure(4) plot(f,abs(a),'b',f2,abs(a2),'r','linewidth',1.5) grid on title(sinyal 1 dan sinyal 2 (Domain Frekuensi)') legend('Output Sistem','Campuran',1); xlabel('Frekuensi (Hz)') ylabel('Magnitude (dB)') saveas(gcf, 'frekDomain', 'jpg')
  • 18. LISTING PROGRAM HITUNG SNR SINYAL DENGAN MATLAB clc, %baca sinyal suara.wav x_signal = wavread(‘sinyal suara’.wav'); %baca sinyal noise.wav x_noise = wavread('sinyal noise.wav'); %Daya Sinyal suara P_x_signal = mean(x_signal.^2); %daya sinyal noise P_x_noise = mean(x_noise.^2); %SNR SNR1 = 10*log10(P_x_signal/P_x_noise);