1.) Include files and configuration.
2.) UserTask and Initialization
3.) Reading and Writing using the PCM Codec
4.)Closing the Codec
Include files and configuration
The files 'dsk5416.h' and 'dsk5416_pcm3002.h' need to be included in your code.
The first one contains all the initialization information for the DSK board. The second contains the information about the PCM Codec.
Int16 *input is a pointer used for reading input from the codec. Int16 specifies a 16-bit integer.
setup is an instance of the structure type DSK5416_PCM3002_Config
which sets configuration values for four parameters used in the codec.
UserTask and Initialization
hCodec is an instance of the type DSK5416_PCM3002_CodecHandle.
This is the handle we use to communicate with the Codec.
hCodec = DSK5416_PCM3002_openCodec(0, &setup);
Here we set the Codec Handle equal to the ouput of the openCodec function. Notice that it uses the structure setup that we previously defined.
In the second line we set the sampling frequency of the Codec to 8000.
Reading and Writing using the PCM Codec
Here is an infinite loop the reads input from the input buffer and then writes it to the output buffer.
Closing the Codec
This simple command closes the PCM Codec using its handle.
The main function's only purpose is to call DSK5416_init() which is the initialization for the DSK board.
The UserTask function performs all the functionality of this program.
Below is the source code. Enjoy.
/************** Complete Source Code *****************/
// Start the codec
Send mail to firstname.lastname@example.org with
questions or comments about this web site.