Function: Implement a frequency scrambler,
changing high frequency spectrum to
low frequencies, and the low frequency spectrum into high frequencies.
Location: ftp://ftp.ti.com/pub/tms320bbs/c5xxdskfiles/scrm.exe
By:
Thomas Millikan
Scramble Application Code: dskpscrm.exe
Starting off:
The file "dskpscrm.exe" can be downloaded from the ftp site listed above to provide a demonstration of frequency scrambling using Amplitude Modulation and FIR filtering. First save "dskpscrm.exe" into it’s own directory. Then run the executable (in DOS or Windows) allowing it to explode into the following files:
dskpscrm.exe - The original file that was downloaded Ac01init.asm - Initializes the analog interface on the DSK Plus Main.asm - Main assembly program Main.lst - list file containing variable names for debugger Main.obj - object file for main assembly program (executable) Readme.txt - In depth explanation of the assembly code Coeffs.asm - Initializes coefficients for the filters Vectors.asm - Initializes the C542 interrupt vector table
By downloading and running the files in "dskpscrm.exe" you can learn how Amplitude Modulation (AM) and filters are necessary in the transmission and modulation of signals. "Dskpscrm.exe" also lends insight into the generation of digital sinusoidal signals. Scramble’s unique use of AM Modulation to create an inverse frequency spectrum will show you new ways to manipulate audio signals. (See AM Modulation or FIR Filtering at this web site for more information)
Load Main.obj onto the DSK and run it to scramble the voice/music introduced through the input mini-jack. The "scrambling" rendered by the DSP is a switching to the frequency content in your input signal. The new frequency spectrum is a mirror image of the input. After the signal is scrambled, it is sent out through the output mini-jack. (see the TMS320C54x DSKPlus User’s Guide page 1-4 for jack locations)
Theory:
Let us start with our input signal, x(t). First we apply a bandpass FIR filter (See FIR filtering for more detail) to x(t), effectively limiting it’s frequency content from 200Hz to 1800Hz. When we Fourier Transform x(t) into the frequency domain, we can generate the following graph:
Where: The gray area shows the frequency content of x(t), and the white area is a reflection of our input signal that develops from the absolute value of X(w) when we transform it.Now, let’s go back to the time domain. After we filter the signal , we modulate it. In Amplitude Modulation (AM) the signal x(t) is first put on a sinusoidal carrier signal, Cos(wc* t), of frequency wc (Hz). In other words the input signal is modulated or multiplied by the carrier frequency. Refer to the following graphic:
When y(t) = x(t) * Cos(wc* t), the relationship between the frequency content of y(t) and the frequency content of x(t) can be understood by the Fourier relationship:
where: |Y(w)| = The absolute value of the output |X(w)| = The absolute value of the input w = (Hz) wc = The carrier frequency of the sinusoidalIf we transform the signal y(t) into the frequency domain and graph it, the graph would look like the following:
As you can see from the graph, Amplitude Modulation shifts the frequency content of the signal to a higher frequency. On the right half we have our signal, and on the left half we have another reflection of the signal.
We then apply the same FIR bandpass filter with cutoff frequencies at 200Hz and 1800Hz. The output can be seen in the gray on the above graph. As you can see from comparing it to our original signal, the frequency content has been flipped, effectively giving us the mirror image of our previous signal.
If we wanted to recapture our original signal, we would apply a bandpass filter with cutoff frequencies at 2200Hz and 3800Hz.
Hints:
In order to recapture the original signal, You must edit 3 things. First, you must create another Coefficients file.-The new filter coefficient file should be 80 taps. -The coefficients should be in the same format as the coefficients in "Coeffs.asm" h0 .word 0 ; 40 0.0000 h1 .word 1 ; 39 0.0001 -Label your new coefficients as f0,f1,f2, etc. -Save the file as "Coeffs1.asm"Second, You must include your new coefficients into "Main.asm", look to the lines:
File: "Main.asm" ; filter coefficients bandpass @ flcut=200hz fhcut=1800hz .sect "filter" .copy "coeffs.asm" Type, ‘ .copy "coeffs1.asm" right below the above listed text.Third, you now need to apply your new coefficients to the final FIR filter:
File: "Main.asm" ;----------Select low-side only --------------------- AR1 = #LSLAST ; LOAD AR1 WITH ADDRESS OF LAST ; DELAY ELEMENT! repeat(#79) , A = 0 ; Zero Accumulator A and repeat ; next instructions 80 times macd(*AR1-,h0,A) ; Compute FIR output. The extraReplace "h0" in the "macd" instruction with "b0" of your new coefficients.