Digital Signal Processing Reference
In-Depth Information
// rtdx_vbsine.c Sine generation.RTDX with Visual Basic(VC++/LABVIEW)
#include "rtdx_vbsinecfg.h"
//generated by .cdb file
#include "dsk6713_aic23.h"
//codec-dsk support file
#include <rtdx.h>
// for rtdx support
Uint32 fs=DSK6713_AIC23_FREQ_16KHZ;
//set sampling rate
short loop = 0;
short sin_table[8] = {0,707,1000,707,0,-707,-1000,-707};
int gain = 1;
RTDX_CreateInputChannel(control_channel); //create input channel
interrupt void c_int11() //ISR set in .cdb
{
output_sample(sin_table[loop]*gain);
if (++loop > 7) loop = 0;
}
void main()
{
comm_intr(); //init codec,dsk,MCBSP
RTDX_enableInput(&control_channel); //enable input channel
while(1)
//infinite loop
{
if(!RTDX_channelBusy(&control_channel)) //if channel not busy
RTDX_read(&control_channel,&gain,sizeof(gain));//read from PC
}
}
FIGURE 9.19. C program that generates a sine wave. It illustrates RTDX using VB to
control the amplitude of the generated sine wave ( rtdx_vbsine.c ).
FIGURE 9.20. Volume slider to control the amplitude of the DSK output signal. Object
created with VB for the project rtdx_vbsine .
VB Component
The folder rtdx _ vbsine contains a subfolder PC that contains the support files asso-
ciated with VB. Click on the ( .vbp ) VB project file to open VB. The project con-
sists of the file slider.frm that describes the slider and the file boardproc _ frm.frm
that describes the board information. These two files are included with CCS. The
slider is the same as that used in an example (hostio1) included with CCS. Within
VB, select Run
Start. Press OK for the board information and the slider box
shown in Figure 9.20 should pop up. Connect the DSK output to a scope. Vary the
slider position and verify the change in the amplitude of the generated output sine
wave (keep the mouse cursor on the slider button to change the slider value). Note
Æ
Search WWH ::




Custom Search