2. Outline
•
Summary:
1) Objective: – 6 Band Led Bargraph Equalizer
2) Design: - Overview
3) C Code: - FiltersTimersDisplay
4) Difficulties: - Audio Addition
5) Outcome: - Functionality
3. 6 Band Led Bargraph Equalizer
•
•
Synopsis:
a) Using 6 leds and 4 switches create an led bargraph equalizer using C code and the Analog Devices
BF533 Evaluation board. This project contains modest functionality so that it could be used for the job that it
was intended. Each switch along with each led of the Bf533 will be utilized. Intended functions will include
audio gain and hold adjustments for each individual bandpass filter, varying led intensity displaying audio
output levels (alterd vs. unaltered), audio switchability for channel comparison and sample/hold led display.
•
b) The led display will recreate audio levels (across all 6 bandpass filters) by illumination intensity, the
brightest being the most and the weakest being the least.
•
c) All 6 filters will be recombined into a composite audio output of the original audio input incorporating our
desired gain adjustments.
4. Overview
•
Implementation
•
Switches/Leds:
a) Switch #1 selects each bandpass of filters one at a time which will be displayed by its appropriate led and
corresponding illumination intensity.
b) Switch #2 controls 3 levels of gain adjustments for each filter one at a time.
c) Switch #3 locks in gain for each channel adjusted.
d) Switch #4 selects altered (all bandpass filters) audio with full led bargraph display or the full led bargraph
display by itself.
FIR Filters:
a) Six bandpass filters will make up the original audio input spectrum. Low frequencies will be pass by the 200hz750hz filter, the highest frequencies will be passed by the 7khz-10khz filter and the midband frequencies will be
pass by the 5khz-7khz, the 3khz-5khz, the 1.5khz-3khz , the 750hz-1.2khz filters respectively.
Diagram of Typical FIR Filter
5. Overview - Switching
Code snippets for audio switching control:
*pDMA1_IRQ_STATUS = 0x0001; // Confirm Interrupt Handling
if(LED1 == 0x00 && LED4 == 0x00) // Checking LED Status
{
// Copy Input Data from Dma Input Buffer into Variables
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0];
iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0];
Process_Data();// Call Function that Contains user Code
// Copy Processed Data from Variables into Dma Output Buffer
iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut;
iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut;
Status1 = 0x00; // Controls Led's Illumination Time
}
if(LED1 == 0x01 && LED4 == 0x00) // Checking LED Status
{
// Copy Input Data from Dma Input Buffer into Variables
iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0];
iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0];
// Copy Processed Data from Variables into Dma Output Buffer
Status1 = 0x01; // Controls Led's Illumination Time
abandpass();
iTxBuffer1[INTERNAL_DAC_L0] = aChannel0LeftOut;
iTxBuffer1[INTERNAL_DAC_R0] = aChannel0RightOut;
}
// One Bandpass Filter at a Time
if(*pFIO_FLAG_C == 0x0100 && pf8count == 0) // Switch P8 Flag & Count at 0
{
FIO_ANOM_0311_FLAG_W(0x0100,pFIO_FLAG_C);// Confirm Interrupt Handling
LED1 = 0x01; // Sets LED1 Control Variable
pf8count++;
}
if(*pFIO_FLAG_C == 0x0100 && pf8count == 1) // Switch P8 Flag & Count at 1
{
FIO_ANOM_0311_FLAG_W(0x0100,pFIO_FLAG_C);// Confirm Interrupt Handling
LED1 = 0x02; // Sets LED1 Control Variable
pf8count++;
}
6. FIR Filters - Code in Process_data.c file
– Filter Coefficients (101) for the 100th Order
– Impulse response of a Nth order FIR filter lasts N+1 samples & dies to 0
– Filter Equation Implementation
for (m=fBL - 1; m >= 0; m--)
{
xl[m]=xl[m-1]; // moving the array data from the end to the beginning (leftwards)
xr[m]=xr[m-1];
}
xl[0]=(float)(iChannel0LeftIn<<8); // Shift Left 8 bits to make 16 bit arrays since ADC gives 24 bit arrays
xr[0]=(float)(iChannel0RightIn<<8);
for(counter=0;counter < fBL;counter++)
{
yl += fB[counter] * xl[counter];
yr += fB[counter] * xr[counter];
}
FIR Filter Algorithm
N
y[ n] = ∑ w[ k ] * x[n − k ]
k =0
fChannel0LeftOut=(((int)yl)>>8)*gainbp6; // Shift Right 8 bits to create the original 24 bit array
fChannel0RightOut=(((int)yr)>>8)*gainbp6;
7. Timers - Code in ISR.c file
•
•
a) A two timer operation will be enabled to run the led brightness display by gauging the fastest running timer
against the slowest running timer ultimately providing varying intensities with each corresponding led
frequency band.
•
•
•
•
•
•
•
Timer Configuration:
*pTIMER0_CONFIG = 0x0019;
*pTIMER0_PERIOD = 0x00080000; // Timer0 Period
*pTIMER0_WIDTH = 0x00040000; // Timer0 Width
*pTIMER1_PERIOD = 0x00003900; // Timer1 Period
*pTIMER1_WIDTH = 0x00001950; // Timer0 Width
*pTIMER_ENABLE = 0x0003; // Enable Timers0/1
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Timer Setup:
Timer Code:
timerstatus = (*pTIMER_STATUS); // Records TIMER_STATUS before it is Reset
*pTIMER_STATUS = 0x0003; // Confirms Interrupt Handling
if((timerstatus & 0x0001) == 0x0001) // Checks for Timer0 Status Bit
{
tim0++; // Once Timer0 is Detected Keep Enabled until Cycle Complete
}
if((timerstatus & 0x0002) == 0x0002) // Checks for Timer1 Status Bit
{
tim1++; // Auto Increment tim1
tim2++; // Auto Increment tim2
}
if(tim0 < 1 ) // Reset tim0=1 when tim0 does not = 1
{
tim1 = 0;
}
9. Display - Code in ISR.c Process_data.c files
Led Values are set here after each filter algorithm which converts audio output words
into integers:
// Led Value Set Here
if(aChannel0LeftOut<0xffff0000 && aChannel0LeftOut>0xf0000000)
{
famp1 = 32;
}
if(aChannel0LeftOut<0xf0000000 && aChannel0LeftOut>0x0f000000)
{
famp1 = 24;
}
if(aChannel0LeftOut<0x0f000000 && aChannel0LeftOut>0x00f00000)
{
famp1 = 16;
}
if(aChannel0LeftOut<0x00f00000 && aChannel0LeftOut>0x000f0000)
{
famp1 = 8;
}
if(aChannel0LeftOut<0x000f0000 && aChannel0LeftOut>0x0000f000)
{
famp1 = 4;
}
if(aChannel0LeftOut<0x0000f000 && aChannel0LeftOut>0x00000f00)
{
famp1 = 0;
}
10. Audio Addition
•
•
Recombining Audio Bands:
a) An unorthodox audio addition scheme was utilized to allow for complete board functionality. All bandpass audio filters are
added using time division multiplexing. This seemed to be the only way to recombine six altered audio channel into one
composite stream and overcome Bf533 board slowdowns or halts.
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
if(LED4 == 0x01 && LED1 == 0x00) // Checking LED status
{
// Copy Processed Data from Variables into Dma Output Buffer
if(tim2 == 1)
{
abandpass();
}
if(tim2 == 2)
{
bbandpass();
}
if(tim2 == 3)
{
cbandpass();
}
if(tim2 == 4)
{
dbandpass();
}
if(tim2 == 5)
{
ebandpass();
}
if(tim2 == 6)
{
fbandpass();
}
iTxBuffer1[INTERNAL_DAC_L0] = aChannel0LeftOut+bChannel0LeftOut+cChannel0LeftOut+dChannel0LeftOut+eChannel0LeftOut+fChannel0LeftOut;
11. Functionality
•
•
Discussion:
a) All the desired led/switch and audio pass functions of the project operated nominally; however, final added
bandpass filters produced unwanted frequencies in each band producing an undesirable filtered audio
output. Total functional operation was realized; however, there were unwanted sympathic (outside of
bandpass filter) frequencies and Bf533 board slowdowns/halts.
•
b) Also, because of time constraints and audio addition (switching noise) problems, other functions such as
adjustable led rise/decay rates and decibel signal referencing would have been a nice touch but could not be
realized.
•
c) Although we had a few difficulties, overall we learned a lot about controlling the Bf533 board and using it to
digitally manage signals.