Digital Signal Processing Reference
In-Depth Information
Waiting to write, and Write completed. Then, within MATLAB, the following should
be printed:
outdata
2 3 4...11, indicating that the values (1, 2,..., 10) in the
buffer
indata
sent initially to the DSK were each incremented by 1 due to the C
source program line of code:
buffer[i]
=
; executed on the C6x (DSK).
Example 9.5 further illustrates RTDX through MATLAB, acquiring external
real-time input data (from the DSK) and sending them to MATLAB for further
processing (FFT, plotting).
++
Example 9.5: MATLAB-DSK Interface Using RTDX, with MATLAB for
FFT and Plotting (
rtdx_matlabFFT
)
This example illustrates the interface between MATLAB and the DSK using
RTDX. An external input signal is acquired from the DSK, and the input samples
are stored in a buffer on the C6x processor. Using RTDX, data from the stored
buffer are transferred from the DSK to the PC host running MATLAB. MATLAB
takes the FFT of the received data from the DSK and plots it, displaying the FFT
magnitude on the PC monitor. The same support tools as in Example 9.4 are
required, including The Embedded Target for TI C6000 DSP (2.0) and MATLAB
Link for CCS, available from MathWorks. The following support files are also used
for this example and provided by TI: (1) the linker command file c67
13dsk.cmd
; (2)
the vector file
intvecs.asm
; and (3) the library support file
rtdx.lib
. In the init/comm
file
c6713dskinit.c
, the line of code to point at the IRQ vector table is bypassed since
the support file
intvecs.asm
handles that.
Figure 9.8 shows the program
rtdx
_
matlabFFT.c
to illustrate the interface. It is a
loop program as well as a data acquisition program, storing 256 input samples. Even
though the program is polling-based, interrupt is used for RTDX. An
output
channel
is created to provide the real-time data transfer from the C6x on the DSK to the
PC host.
Figure 9.9 shows the MATLAB-based program
rtdx
_
matlabFFT.m
. This program
provides board information, opens CCS and enables RTDX. It also loads the exe-
cutable file (
rtdx
_
matlabFFT.out
) within CCS and runs the program on the DSK.
Note that the output channel for RTDX is opened and data are
read
(from
MATLAB running on the PC). A 256-point FFT of the acquired input data is taken,
sampling at 16 kHz. The program obtains a total of 2048 buffers, and execution stops
afterwards.
Build this project as
rtdx_matlabFFT
within CCS. The necessary support files
are included in the folder
rtdx_matlabFFT
. Add the necessary support files,
including
rtdx
_
matlabFFT.c
,
c6713dskinit.c
,
intvecs.asm
(from TI),
c6713dsk.cmd
(from TI), and
rtdx.lib
(located in
c6713\c6000\rtdx\lib
). Use the following
compiler options:
-g -ml3
. The option
-ml3
(from the Advanced Category) allows
for Memory Models: Far Calls and Data. This process yields the executable
.out
file.
Search WWH ::
Custom Search