Digital Signal Processing Reference
In-Depth Information
that the Application (.exe) file, included on the CD, also can be used to run the VB
project directly. This application file can be re-created within VB after loading the
project file and selecting File
Make rtdx_vbsine.exe .
The next example implements a loop using RTDX with VB, where the amplitude
of the output signal is changed using a gain value sent by the PC host to the C6x
processor.
Æ
Example 9.10: Visual Basic-DSK Interface Using RTDX for Amplitude
Control of Output in a Loop Program ( rtdx_vbloop )
This example extends the previous example with a loop program using VB and
RTDX to control the amplitude of an output signal. A window where the user can
enter a gain value is built in VB. That gain value is sent from the PC host to the C6x
processor. Figure 9.21 shows the C source program rtdx _ vbloop.c that implements
this project example. See also the previous example.
An RTDX input channel is created and enabled. When the RTDX channel is not
busy, the C6x processor reads the data from the PC. Create and add a configuration
file to set the interrupt service function, and add similar support files to the project,
as in the previous example.
Build this project as rtdx_vbloop . Input a sine wave with an approximate
amplitude and frequency of 0.5 V p-p and 2 kHz, respectively. Verify that the DSK
// rtdx_vbloop.c RTDX with Visual basic(or VC++)for loop gain control
#include "rtdx_vbloopcfg.h"
//generated by .cdb file
#include "dsk6713_aic23.h"
#include <rtdx.h> //codec-DSK support file
Uint32 fs=DSK6713_AIC23_FREQ_16KHZ; //set sampling rate
int gain = 1; //initial gain value
RTDX_CreateInputChannel(control_channel); //create input channel
interrupt void c_int11() //ISR
{
output_sample(gain*input_sample()); //output = scaled input
}
void main()
{
comm_intr(); //init codec,DSK,MCBSP
RTDX_enableInput(&control_channel); //enable RTDX channel
while(1)
//infinite loop
{
if(!RTDX_channelBusy(&control_channel)) //if channel not busy
RTDX_read(&control_channel,&gain,sizeof(gain));//read gain from PC
}
}
FIGURE 9.21. C program that implements a loop. It illustrates RTDX using VB to control
the amplitude of an output signal from the DSK ( rtdx_vbloop ).
Search WWH ::




Custom Search