Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "usbstk5505.h"
- #include "aic3204.h"
- #include "PLL.h"
- #include "sinewaves.h"
- Int16 left_input;
- Int16 right_input;
- Int16 left_output;
- Int16 right_output;
- #define SAMPLES_PER_SECOND 24000
- #define GAIN_IN_dB 0
- unsigned long int i = 0;
- /* ------------------------------------------------------------------------ *
- * *
- * main( ) *
- * *
- * ------------------------------------------------------------------------ */
- void main( void )
- {
- /* Initialize BSL */
- USBSTK5505_init( );
- /* Initialize the Phase Locked Loop in EEPROM */
- pll_frequency_setup(100);
- /* Initialise hardware interface and I2C for code */
- aic3204_hardware_init();
- /* Initialise the AIC3204 codec */
- aic3204_init();
- Int16 left[512];
- Int16 right [512];
- Int16 idx=0;
- /* Set sampling frequency in Hz and ADC gain in dB */
- set_sampling_frequency_and_gain(SAMPLES_PER_SECOND, GAIN_IN_dB);
- printf("\nRunning Sinewaves Project\n\n");
- printf( "Sinewave 250Hz on left HP output, 1000Hz on right HP output\n\n" );
- asm(" bclr XF");
- for ( i = 0 ; i < SAMPLES_PER_SECOND * 600L ;i++ )
- {
- aic3204_codec_read(&left_input, &right_input); // Configured for one interrupt per two channels.
- left_output = generate_sinewave_1(2000, 5000); // Sinewave 1 is 250 Hz.
- right_output = generate_sinewave_2(2000, 5000); // Sinewave 2 is 1000 Hz.
- aic3204_codec_write(left_output, right_output);
- left [idx] = left_output;
- right [idx] = right_output;
- idx=idx+1;
- if(idx==512)
- idx=0;
- }
- /* Disable I2S and put codec into reset */
- aic3204_disable();
- printf( "\n***Program has Terminated***\n" );
- SW_BREAKPOINT;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement