22
Final Project “The Chipmunk Finale” Date Performed: 6 December 2008 Date Submitted: 12 December 2008 Microcomputer Systems I ECE 3551-01 James C. Stroup Lab Instructor: Dr. Veton Këpuska

Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project

“The Chipmunk Finale”

Date Performed: 6 December 2008Date Submitted: 12 December 2008

Microcomputer Systems IECE 3551-01

James C. Stroup

Lab Instructor: Dr. Veton Këpuska

Page 2: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

Purpose:

The purpose of this project was to alter the recorded playback signal to sound like a Chipmunk.

Equipment Used:

o Blackfin EZ-Kit Liteo Visual DSP++o MatLab R2007bo Microsoft Word 2007o Microsoft PowerPoint 2007

Procedure:

1. Before powering on the board, I made sure that switch SW9 pin1, pin2, and pin3, pin4, pin5, and pin6 were turned on. All pins in SW9 should be on. See Figure 1.

Figure 1

2. In this project, I removed all the filtering in Process_Data.c. I used Process_Data.c to generate the songs.

3. Now I have 3 interrupts (Timer0_ISR, Sport0_RX_ISR, FlagA_ISR). 4. To change the songs and the speed of the songs I programmed the buttons to do the

following:a. PF8 records the external sound and, if pressed again, stops recording.b. PF9 plays the recorded sound from the SDRAM and, if pressed again, stops the

playback.c. PF10 enables/disables the “Chipmunk Effect”.d. PF11 cycles between a two and four speaker output.

5. We modified the code in Talkthrough.h, main.c, Initialize.c, ISR.c and Process_Data.c. 6. We connected the equipment for the experiment as seen in Figure 2.

2 | P a g e

Page 3: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

Figure 2

Discussion:

In this project I the Blackfin 533 Processor to be able to hear, record, playback, manipulate, and output an audio signal. While the signal plays, you can not only manipulate the signal, but choose to send the output to either two speakers or four speakers. The switching is all done seamlessly; therefore there should be no “popping” sound. PF8 records and stops recording the signal, PF9 plays and stops playing the data from the SDRAM, PF10 engages and disengages the voice modulation described as the “Chipmunk Effect”, and PF11 cycles between whether the output is sent to two speakers or four.

I had some difficulty storing the incoming data from the inputs into the SDRAM, so after some help from Kevin Hernacki I was able to finally be able to load the data into the SDRAM (see Initialize.c, ISR.c, and Process_Data.c, for algorithms). I used a very basic form of his code and adapted it to fit my needs by adding various pointers. I got the idea for the pointers from another student who was having the same difficulty with the SDRAM. The result were the pointers: “point” and “end”. “Point” was the pointer that looked into the SDRAM to see where in the data the program was; I then incremented this pointer to achieve my initial playback option. Working with pointers proved to be very difficult because prior to this code, I have never had to work with pointers; so the programming of this code was very confusing when I began to alter it. I received thousands of error’s (most of which were “catastrophic”) as soon as I tried to pass the pointer into my original design for the modulation.

My original design for modulation consisted of taking the data from the SDRAM and putting it through a series of manipulations. First, it was to be stored, Second, it was supposed to be passed through a variable that in turn went through a function. For the function , I had originally planned on sending the data through a high-pass filter to extract only the treble frequencies, speed-up the rate at which it was recorded, store the new data into the SDRAM

3 | P a g e

Page 4: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

(overwriting the old files), playing it at 1.4x its original speed. By doing this, I had planned to allow the user to speak normally into the microphone with the assurance that their voice would be played back at relatively the same speed except with a different voice (or “sound”).

My plans failed when I found that, by passing the data through the high-pass filter I had created, the produced sound emulated the effect of taking a Phonograph or turntable and playing the record extremely slow. I attributed this to the processor not being able to withstand the requirements needed to sort and manipulate the data fast enough. So with the failure of the original design plan, I reprogrammed to the board to simply sample the data from the SDRAM twice as fast. This new code worked perfectly with the exception that the user had to alter the way he/she would speak into the microphone initially to produce a normalized output. I achieved this code by simply incrementing the pointer, “point”, twice in a row so that the data sent to the variable “ChannelLeftOut” would be every other bit of data played at the same rate as every bit of data would be normally.

In Process_Data.c, I placed all of the functions that decide the output and input of the signals/data. There are three functions in that file: Loading(), process_data2(), and process_data4(). The “Loading” function allows the external incoming signal to be heard through all four speakers all the while simultaneously sending the same signal into the SDRAM. The function, “process_data2()”, allows the user to send the data from the SDRAM to two speakers, the iTxBuffer1[INTERNAL_DAC_L0] and the iTxBuffer1[INTERNAL_DAC_ - -R0] buffers. The “process_data4()” function allows the user to send the data from the SDRAM to four different speakers: iTxBuffer1[INTERNAL_DAC_L0], iTxBuffer1[INTERNAL- -_DAC_R0], iTxBuffer1[INTERNAL_DAC_L1], and iTxBuffer1[INTERNAL_DAC_R1].

Appendices:

4 | P a g e

Page 5: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

5 | P a g e

Page 6: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

Initialize.c

#include "Talkthrough.h"

//----------------------------------------------------------------//// Function: Init_EBIU //// //// Description: This function initializes and enables //// asynchronous memory banks in External Bus //// Interface Unit so that Flash A can be accessed. //// ////----------------------------------------------------------------//

void Init_EBIU(void){

*pEBIU_AMBCTL0 = 0x7bb07bb0;*pEBIU_AMBCTL1 = 0x7bb07bb0;*pEBIU_AMGCTL = 0x000f;

}

//----------------------------------------------------------------//// Function: Init_Flash //// //// Description: This function initializes pin direction of //// Port A in Flash A to output. The AD1836_RESET //// on the ADSP-BF533 EZ-KIT board Is connected //// to Port A. ////----------------------------------------------------------------//

void Init_Flash(void){

*pFlashA_PortA_Dir = 0x1;*pFlashA_PortB_Dir = 0x1f; // new

}

//----------------------------------------------------------------//// Function: Init1836() //// //// Description: This function sets up the SPI port to configure //// the AD1836. The content of the array //// sCodec1836TxRegs is sent to the codec. ////----------------------------------------------------------------//

void Init1836(void){

int i;int j;static unsigned char ucActive_LED = 0x01;

*pFlashA_PortA_Data = 0x00; // write to Port A to reset AD1836*pFlashA_PortA_Data = ucActive_LED;// write to Port A to enable AD1836

for (i=0; i<0xf0000; i++) asm("nop;");// wait to recover from reset

*pSPI_FLG = FLS4; // Enable PF4*pSPI_BAUD = 16;// Set baud rate SCK = HCLK/(2*SPIBAUD) SCK = 2MHz*pSPI_CTL = TIMOD_DMA_TX | SIZE | MSTR; // configure spi port

6 | P a g e

Page 7: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

// SPI DMA write, 16-bit data, MSB first, SPI Master*pDMA5_PERIPHERAL_MAP = 0x5000; // Set up DMA5 to transmit

// Map DMA5 to SPI*pDMA5_CONFIG = WDSIZE_16; // Configure DMA5

// 16-bit transfers*pDMA5_START_ADDR = (void *)sCodec1836TxRegs; // Start address of

//data buffer*pDMA5_X_COUNT = CODEC_1836_REGS_LENGTH; // DMA inner loop count*pDMA5_X_MODIFY = 2; // Inner loop address increment*pDMA5_CONFIG = (*pDMA5_CONFIG | DMAEN); // enable DMAs*pSPI_CTL = (*pSPI_CTL | SPE); // enable spi

for (j=0; j<0xaff0; j++) asm("nop;")// wait until dma transfers for spi are finished

*pSPI_CTL = 0x0000; // disable spi}

//----------------------------------------------------------------//// Function: Init_Sport0 //// //// Description: Configure Sport0 for I2S mode, to //// transmit/receive data //// to/from the AD1836. Configure Sport for //// external clocks and frame syncs. ////----------------------------------------------------------------//void Init_Sport0(void){

// Sport0 receive configuration

// External CLK, External Frame sync, MSB first, Active Low

// 24-bit data, Stereo frame sync enable*pSPORT0_RCR1 = RFSR | RCKFE;*pSPORT0_RCR2 = SLEN_24 | RXSE | RSFSE;

// Sport0 transmit configuration

// External CLK, External Frame sync, MSB first, Active Low

// 24-bit data, Secondary side enable, Stereo frame sync enable*pSPORT0_TCR1 = TFSR | TCKFE;*pSPORT0_TCR2 = SLEN_24 | TXSE | TSFSE;

}

//----------------------------------------------------------------//// Function: Init_DMA //// //// Description: Initialize DMA1 in autobuffer mode to //// receive and DMA2 in //

7 | P a g e

Page 8: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

// autobuffer mode to transmit ////----------------------------------------------------------------//void Init_DMA(void){

// Set up DMA1 to receive

// Map DMA1 to Sport0 RX*pDMA1_PERIPHERAL_MAP = 0x1000;

// Configure DMA1

// 32-bit transfers, Interrupt on completion, Autobuffer mode*pDMA1_CONFIG = WNR | WDSIZE_32 | DI_EN | FLOW_1;

// Start address of data buffer*pDMA1_START_ADDR = (void *)iRxBuffer1;

// DMA inner loop count*pDMA1_X_COUNT = 4;

// Inner loop address increment*pDMA1_X_MODIFY = 4;

// Set up DMA2 to transmit

// Map DMA2 to Sport0 TX*pDMA2_PERIPHERAL_MAP = 0x2000;

// Configure DMA2

// 32-bit transfers, Autobuffer mode*pDMA2_CONFIG = WDSIZE_32 | FLOW_1;

// Start address of data buffer*pDMA2_START_ADDR = (void *)iTxBuffer1;

// DMA inner loop count*pDMA2_X_COUNT = 4;

// Inner loop address increment*pDMA2_X_MODIFY = 4;

}

//----------------------------------------------------------------//// Function: Enable_DMA_Sport //// //// Description: Enable DMA1, DMA2, Sport0 TX and Sport0 RX ////----------------------------------------------------------------//void Enable_DMA_Sport0(void){

// enable DMAs*pDMA2_CONFIG = (*pDMA2_CONFIG | DMAEN);*pDMA1_CONFIG = (*pDMA1_CONFIG | DMAEN);

8 | P a g e

Page 9: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

// enable Sport0 TX and RX*pSPORT0_TCR1 = (*pSPORT0_TCR1 | TSPEN);*pSPORT0_RCR1 = (*pSPORT0_RCR1 | RSPEN);

}

//----------------------------------------------------------------//// Function: Init_Interrupts //// //// Description: Initialize Interrupt for Sport0 RX ////----------------------------------------------------------------//void Init_Interrupts(void){

// Set Sport0 RX (DMA1) interrupt priority to 2 = IVG9 *pSIC_IAR0 = 0xffffffff;*pSIC_IAR1 = 0xffffff2f;*pSIC_IAR2 = 0xffff5ff4;

// assign ISRs to interrupt vectors

// Sport0 RX ISR -> IVG 9register_handler(ik_ivg9, Sport0_RX_ISR);register_handler(ik_ivg12, FlagA_ISR);

register_handler(ik_ivg11, Timer0_ISR); // Timer0 ISR -> IVG 11

// enable Sport0 RX interrupt*pSIC_IMASK = 0x00090200;

}

void Init_Flags(void) {

*pFIO_INEN = 0x0f00;//workaround for anomaly 05000311.*pFIO_DIR = 0x0000;//For more information please refer to the comment header in file

sys/05000311.h*pFIO_EDGE = 0x0f00;*pFIO_MASKA_D = 0x0f00;

}

//----------------------------------------------------------------//// Function: Configure SDRAM. //// //// Description: Initialize and set-up the SDRAM. ////----------------------------------------------------------------//

void Init_Timers(void) // used for the LEDs to move{

*pTIMER0_CONFIG = 0x0019;*pTIMER0_PERIOD = 0x00800000;*pTIMER0_WIDTH = 0x00400000;*pTIMER_ENABLE = 0x0001;

}

void Init_SDRAM(void)

9 | P a g e

Page 10: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

{if (*pEBIU_SDSTAT & SDRS) {

*pEBIU_SDRRC = 0x00000406;//SDRAM Refresh Rate Control Register

*pEBIU_SDBCTL = 0x00000025;//SDRAM Memory Bank Control Register

*pEBIU_SDGCTL = 0x0091998d;//SDRAM Memory Global Control Register

*point = pSDRAM_open;*end = pSDRAM_end;

ssync();}

}

ISR.C

#include "Talkthrough.h"

//----------------------------------------------------------------------//// Function: Sport0_RX_ISR //// //// Description: This ISR is executed after a complete frame of input //// data has been received. The new samples are stored in //// iChannel0LeftIn, iChannel0RightIn, iChannel1LeftIn and//// iChannel1RightIn respectively. Then the function //// Process_Data() is called in which user code can be //// executed. After that the processed values are copied //// from the variables iChannel0LeftOut, //// iChannel0RightOut, iChannel1LeftOut and //// iChannel1RightOut into the dma transmit buffer. ////----------------------------------------------------------------------//

static unsigned char ucActive_LED=0x01;//active to allow the sLight_Move_Direction to work

EX_INTERRUPT_HANDLER(Timer0_ISR) //allows the LEDs to move

{if(LEDLOAD)

//if statement to control when the moving LEDS aew turned on {

//confirm interrupt handling*pTIMER_STATUS = 0x0001;//shift old LED pattern by one

if(sLight_Move_Direction){

if((ucActive_LED = ucActive_LED >> 1) == 0x00) ucActive_LED = 0x40;

}

10 | P a g e

Page 11: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

else{

if((ucActive_LED = ucActive_LED << 1) == 0x40) ucActive_LED = 0x01;

}}

*pFlashA_PortB_Data = ucActive_LED; //allows only ucActive_LED to be lit on LEDs

}

EX_INTERRUPT_HANDLER(Sport0_RX_ISR){

int i;

*pDMA1_IRQ_STATUS = 0x0001;//confirm interrupt handling

if (SDSTORE == 1) //this is where the song is stored into SDRAM

{

LEDLOAD = 1;//puts all LED lights on

Loading();

if(point>pSDRAM_end)//If point at pSDRAM_end stop value,

{ *point=pSDRAM_open;

//Pointer point to first space in storage SDRAM. SDSTORE=0;

//Stop data load of SDRAM. LEDLOAD = 0; } }

if (SDSTORE == 2) //shuts off the storing of music

{ SDSTORE=0; ucActive_LED = 0x01; LEDLOAD = 0; }

if (PLAY == 1) //forward playback

{ChannelLeftOut = *point++;

//Play data self-increment from SDRAM into channel-out using point pointer.//Play data self-increment from SDRAM into channel-out using point pointer.

if (FILTERCYCLE == 0){

iChannel0LeftOut = ((int) ChannelLeftOut)<<8;

11 | P a g e

Page 12: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

if (SPKRCYCLE==0) { Process_Data2(); } else if (SPKRCYCLE==1) { Process_Data4(); }

}else if (FILTERCYCLE == 1)

{ ChannelLeftOut = *point++;

iChannel0LeftOut = ((int) ChannelLeftOut)<<8; if (SPKRCYCLE==0) { Process_Data2(); } else if (SPKRCYCLE==1) { Process_Data4(); } }

}

if(point>pSDRAM_end) //When pointer hits pSDRAM_end stop value,

{*point=0;

//Pointer point to first space in storage SDRAM.

PLAY=0;//Stop foward playing from SDRAM.

}

if(PLAY==2)//shuts off foward playback

{ PLAY=0;

//Playback reset to 0. LEDLOAD = 0;

//turnes moving LEDs off }}

EX_INTERRUPT_HANDLER(FlagA_ISR) //pushbutton interrupt{

if(*pFIO_FLAG_C==0x0100){

*pFIO_FLAG_C=0x0100; SDSTORE++;

//uses PF8 to record the song

12 | P a g e

Page 13: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

if(SDSTORE == 3) //reset counter to zero once it hits 3

{SDSTORE = 0;

}

point=pSDRAM_open; //sets the pointer back to the beginning

} if(*pFIO_FLAG_C == 0x0200) //Interrupt button PF9{

*pTIMER0_PERIOD = 0x00800000; //sets the LED timer

*pFIO_FLAG_C = 0x0200;

PLAY++; //allows for forward playback

if(PLAY == 3) //reset counter to zero once it hits 3

{PLAY = 0;

}

point=pSDRAM_open; //sets pointer to beginning}

if(*pFIO_FLAG_C == 0x0400) //Interrupt button PF10{

*pFIO_FLAG_C = 0x0400;//stores to pointer

FILTERCYCLE++; //increments the pushbutton value

if(FILTERCYCLE == 2) //resets the filters to normal when hit three times

{FILTERCYCLE = 0;

}}

if(*pFIO_FLAG_C == 0x0800) //Interrupt button PF10{

*pFIO_FLAG_C = 0x0800;//stores to pointer

13 | P a g e

Page 14: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

SPKRCYCLE++; //increments the pushbutton value

if(SPKRCYCLE == 2) //resets the filters to normal when hit three times

{SPKRCYCLE = 0;

}}

}

Main.c

#include "Talkthrough.h"#include "sysreg.h"#include "ccblkfn.h"

//----------------------------------------------------------------------//// Variables //// //// Description: The variables iChannelxLeftIn and iChannelxRightIn //// contain the data coming from the codec AD1836. The //// (processed)playback data are written into the //// variables iChannelxLeftOut and iChannelxRightOut //// respectively, which are then sent back to the codec //// in the SPORT0 ISR. The values in the array //// iCodec1836TxRegs can be modified to set up the codec //// in different configurations according to the AD1885 //// data sheet. ////----------------------------------------------------------------------//

int iChannel0LeftIn; // left input data from ad1836int iChannel1LeftIn; // left input data from ad1836int iChannel0RightIn; // right input data from ad1836int iChannel1RightIn; // right input data from ad1836int iChannel0LeftOut; // left ouput data for ad1836int iChannel1LeftOut; // left ouput data for ad1836int iChannel0RightOut; // right ouput data for ad1836int iChannel1RightOut; // right ouput data for ad1836

//<--array for registers to configure the ad1836-->

volatile short sCodec1836TxRegs[CODEC_1836_REGS_LENGTH] ={

DAC_CONTROL_1 | 0x000,DAC_CONTROL_2 | 0x000,DAC_VOLUME_0 | 0x3ff,DAC_VOLUME_1 | 0x3ff,DAC_VOLUME_2 | 0x3ff,DAC_VOLUME_3 | 0x3ff,DAC_VOLUME_4 | 0x000,DAC_VOLUME_5 | 0x000,

14 | P a g e

Page 15: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

ADC_CONTROL_1 | 0x000,ADC_CONTROL_2 | 0x000,ADC_CONTROL_3 | 0x000

};

volatile int iTxBuffer1[4]; // SPORT0 DMA transmit buffervolatile int iRxBuffer1[4]; // SPORT0 DMA receive buffer

int SDSTORE; // New countersint PLAY;int *point;int *end;int FILTERCYCLE;int SPKRCYCLE;

short ChannelLeftOut;short ChannelRightOut;short sLight_Move_Direction;short LEDLOAD =0;

//----------------------------------------------------------------------//// Function: main //// //// Description: After calling a few initalization routines, main() //// just waits in a loop forever. The code to process the //// incoming data can be placed in the function //// Process_Data() in the file "Process_Data.c". ////----------------------------------------------------------------------//

void main(void){ sysreg_write(reg_SYSCFG, 0x32); //Initialize System Configuration Register

Init_EBIU();Init_Flash();Init1836();Init_Sport0();Init_DMA();Init_Interrupts();Enable_DMA_Sport0();Init_Flags(); Init_Timers();

while(1);}

Process_Data.c

#include "Talkthrough.h"

void Loading(void){

15 | P a g e

Page 16: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

iChannel0LeftIn = iRxBuffer1[INTERNAL_ADC_L0]; //Data from DAC left to left channel-in. iChannel0RightIn = iRxBuffer1[INTERNAL_ADC_R0]; //Data from DAC right to right channel-in. iChannel1LeftIn = iRxBuffer1[INTERNAL_ADC_L0]; //Data from DAC left to left channel-in. iChannel1RightIn = iRxBuffer1[INTERNAL_ADC_R0]; //Data from DAC right to right channel-in.

iChannel0LeftOut = iChannel0LeftIn; //Data from left channel-in to left channel-out.

iChannel0RightOut = iChannel0RightIn; //Data from right channel-in to right channel-out.

iChannel1LeftOut = iChannel1LeftIn; //Data from left channel-in to left channel-out.

iChannel1RightOut = iChannel1RightIn; //Data from right channel-in to right channel-out.

iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_R0] = iChannel0RightOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_L1] = iChannel1LeftOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_R1] = iChannel1RightOut; //Data from channel-out to DAC.

*point++ = (short)(iChannel0LeftIn>>8); //Load data self-increment into SDRAM, forward playback }void Process_Data2(void){

iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_R0] = iChannel0LeftOut; //Data from channel-out to DAC.

}

void Process_Data4(void){

iTxBuffer1[INTERNAL_DAC_L0] = iChannel0LeftOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_R0] = iChannel0LeftOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_L1] = iChannel0LeftOut; //Data from channel-out to DAC. iTxBuffer1[INTERNAL_DAC_R1] = iChannel0LeftOut; //Data from channel-out to DAC.}

16 | P a g e

Page 17: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

Talkthrough.h

#ifndef __Talkthrough_DEFINED#define __Talkthrough_DEFINED

//----------------------------------------------------------------------//// Header files ////----------------------------------------------------------------------//#include <sys\exception.h>#include <cdefBF533.h>

//----------------------------------------------------------------------//// Symbolic constants ////----------------------------------------------------------------------//

// addresses for Port B in Flash A#define pFlashA_PortA_Dir (volatile unsigned char *)0x20270006#define pFlashA_PortA_Data (volatile unsigned char *)0x20270004#define pFlashA_PortB_Dir (volatile unsigned char *)0x20270007

//new#define pFlashA_PortB_Data (volatile unsigned char *)0x20270005

// new#define pSDRAM_open (unsigned int *)0x00000000

//SDRAM begining address for pointer.!!!!#define pSDRAM_end (unsigned int *)0x01FFFFFF

//SDRAM end address for pointer !!!!

// names for codec registers, used for sCodec1836TxRegs[]#define DAC_CONTROL_1 0x0000#define DAC_CONTROL_2 0x1000#define DAC_VOLUME_0 0x2000#define DAC_VOLUME_1 0x3000#define DAC_VOLUME_2 0x4000#define DAC_VOLUME_3 0x5000#define DAC_VOLUME_4 0x6000#define DAC_VOLUME_5 0x7000#define ADC_0_PEAK_LEVEL 0x8000#define ADC_1_PEAK_LEVEL 0x9000#define ADC_2_PEAK_LEVEL 0xA000#define ADC_3_PEAK_LEVEL 0xB000#define ADC_CONTROL_1 0xC000#define ADC_CONTROL_2 0xD000#define ADC_CONTROL_3 0xE000

// names for slots in ad1836 audio frame#define INTERNAL_ADC_L0 0#define INTERNAL_ADC_R0 2#define INTERNAL_DAC_L0 0#define INTERNAL_DAC_R0 2

#define INTERNAL_ADC_L1 1#define INTERNAL_ADC_R1 3#define INTERNAL_DAC_L1 1#define INTERNAL_DAC_R1 3

17 | P a g e

Page 18: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

#define INTERNAL_ADC_L2 4#define INTERNAL_ADC_R2 6#define INTERNAL_DAC_L2 4#define INTERNAL_DAC_R2 6

// size of array sCodec1836TxRegs#define CODEC_1836_REGS_LENGTH 11

// SPI transfer mode#define TIMOD_DMA_TX 0x0003

// SPORT0 word length#define SLEN_24 0x0017

// DMA flow mode#define FLOW_1 0x1000

#define buffer 8000

//----------------------------------------------------------------------//// Global variables ////----------------------------------------------------------------------//

extern int iChannel0LeftIn;extern int iChannel0RightIn;extern int iChannel0LeftOut;extern int iChannel0RightOut;extern int iChannel1LeftIn;extern int iChannel1RightIn;extern int iChannel1LeftOut;extern int iChannel1RightOut;extern int SDSTORE;extern int PLAY;extern int FILTERCYCLE;extern int SPKRCYCLE;extern int *point;extern int *end;

extern short ChannelLeftOut;extern short ChannelRightOut;extern short sLight_Move_Direction;extern short LEDLOAD;

extern volatile int iRxBuffer1[];extern volatile int iTxBuffer1[];

extern volatile short sCodec1836TxRegs[];

//----------------------------------------------------------------------//// Prototypes ////----------------------------------------------------------------------//

void Init_EBIU(void);void Init_Flash(void);void Init1836(void);

18 | P a g e

Page 19: Lab#7 - The Effects of Capacitors on an NMOS Amplifiervkepuska/ece3551/Projects...  · Web viewMicrosoft Word 2007. Microsoft PowerPoint 2007. Procedure: Before powering on the board,

Final Project – The Chipmunk Finale

void Init_Sport0(void);void Init_DMA(void);void Init_Interrupts(void);void Enable_DMA_Sport(void);void Enable_DMA_Sport0(void);void Init_Flags(void);

void Loading(void);void Process_Data2(void);void Process_Data4(void);

EX_INTERRUPT_HANDLER(Sport0_RX_ISR);EX_INTERRUPT_HANDLER(FlagA_ISR); EX_INTERRUPT_HANDLER(Timer0_ISR);

#endif//Talkthrough_DEFINED

19 | P a g e