Digital Signal Processing Reference
In-Depth Information
duration determined by the variable in the program
on-time
. A slider is used to vary
on-time
between 1 and 10 seconds. Unlike Example 1.1, after switch #0 is pressed,
the sine is generated but only for
on-time
seconds.
Build and run this project as
sine_led_ctrl
. Press switch #0 and verify that
both LED #0 toggles and a 1-kHz sine wave is generated for 2 seconds, with
on-
time
set at 2 sec in the program. Load the gel file
sine_led_ctrl.gel
(on the CD) to
obtain the slider. Increase the slider value to 8. Is the sine wave generated and LED
#0 toggles for approximately 8 seconds after switch #0 is pressed?
Note that the delay associated with turning on the LED is incorporated within
delay
in determining the value of the delay loop set in the program.
Example 2.18: Use of External Memory to Record Voice (
record
)
This example illustrates the use of the
pragma
directive in a C source program to
store data in external (in lieu of internal) memory. The DSK board includes 16 MB
of SDRAM external memory that provides a larger section of memory than the
on-chip internal memory. Figure 2.28 shows the C source program
record.c
that
implements this project example. It defines a buffer size of 2400000 allowing
approximately (2.4
10
6
)/8000
5 minutes of speech to be recorded
and stored in external memory, sampling at 8 kHz.
The
pragma
directive specifies a section called
buffer
to reside in a memory
section specified by .
EXTRAM
. The following lines need to be added in the linker
command file. Within
SECTIONS
, add
¥
=
300 seconds
=
.
EXTRAM
:
>
SRAM
_
EXT
and within
MEMORY
, add
SRAM
_
EXT
:
org
=
0x80000000
,
len
=
0x01000000
Note that SDRAM could have been specified in lieu of
SRAM_EXT.
External
memory starts at the address 0x80000000.
To use voice as input with a microphone into the DSK, the header file
c6713dskinit.h
needs to be changed so that register 4 is 0x0015 in lieu of 0x0011,
as discussed in Chapter 1 and illustrated in Example 2.1. If you have a microphone
with the appropriate preamplification, you can connect it directly into the line input
in lieu of the mic input (not with most microphones).
Build this project as
record
. Load/run the program.
1.
Press switch #3 and input voice for approximately a few seconds. Verify that
LED #3 is turned on to indicate that the input voice is being recorded and
stored in a buffer. Release switch #3 to stop recording.
2.
Connect the output to a speaker. Press switch #0 and verify that the input voice
(stored in external memory) is replayed. LED #0 should turn on to indicate
that. Release LED #0 to stop replaying.
Search WWH ::
Custom Search