<< Chapter < Page Chapter >> Page >

Writing to the frequency registers is accomplished using the portw instruction. To write to the frequency or phase registers on the DDS, the second operand of the portw instruction must be 10xxxxxx , where the lower six bits are the address of the specific register to be written to. Theaddress of the most significant frequency register on the DDS is 04h , and the address of the second most significant frequency register on the DDS is 05h (see page 26 in the data sheet). It is important to note that the way our DDS boardswere built, you will not be allowed to make two consecutive writes. To solve this problem, a subroutine called nullop is called to waste some CPU time between writes. nullop does this by simply repeating the nop instruction 128 times.

After the program returns from the setcarrier subroutine, it enters an infinite loop in which it waits for a serial interrupt to occur. The serial interrupt occursevery time a new sample is acquired from one of the two input channels and is transmitted to the DSP via the serialport. When the interrupt occurs, an interrupt service routine called ANALOG_IFC (see core_mod.asm executes and calls the handle_sample subroutine. The handle_sample subroutine reads in the acquired sample from the serial port and scales that sample so thatit can be "mapped" to a frequency in the range of75 kHz

In FM radio, the amplitude of the message signal being transmitted determines the amount offrequency deviation from the carrier frequency of the passband signal.75 kHz is the largest frequency deviation allowed.
. The scaled sample therefore determines the frequency deviation and is added to 6Dh . The last step is to write the result to the second most significant frequency register so that thefrequency of the DDS output can be updated.

Programming the phase

The process for changing the phase of the DDS output is the same as it was for changing the frequency of the DDS output.To change the phase, you need to write a phase word to a phase-adjust register on the DDS. The phase-adjust registeris 14 bits wide and is split up into two smaller registers that you can write to (see page 26 in the data sheet). The upper 6 bits have address 00h , and the lower 8 bits have address 01h . The phase word can be calculated using :

Phase word Carrier phase 2 2 14
Once you've calculated the phase word, you can write it to the DDS using the portw instruction as before. Just make sure you use the correct address for the phaseregister.

Programming the amplitude

The DDS also allows you to program the amplitude, but this functionality is not addressed in this lab. You will beable to implement a digital communication system in ECE320 without having to program the amplitude. Interested readersare referred to the data sheet.

Fsk exercise

Now that you know how to use the DDS in single-tone mode, implement a simple FSK system that uses 2 frequencies: 120.005MHz, and 120.011 MHz. You don't need to encode any data for this exercise. In other words, your DDS output should justcontinuously alternate between the two frequency symbols. Also, the DDS automatically ensures continuous phase, so youwon't have to keep track of it. Use a symbol length of approximately 725s (the same length as your lab 5 symbols). Timer interrupts are an elegant way to control thesymbol lengths, but in this lab we will keep things simple and control the symbol lengths by creating a second (longer) nullop subroutine and calling it between writes to the DDS. The second nullop subroutine should waste approximately 725s worth of time.

Since we're not using input or output from the DSP, you don't need to use the WaitData or WaitAudiomacros.

Testing

Note that the corresponding baseband frequencies for 120.005 MHz and 120.011 MHz are 5 kHz, and 11 kHz, respectively.Since these baseband frequencies lie within the 22.05 kHz bandwidth of the DSP, you will be able to view your FSKsignal in real time on the oscilloscope without the contribution from the spectral replicas. Just feed the output of the DDS into asecond DSP (the anti-aliasing filter on the DSP will get rid of the spectral replicas), and pass it through to the outputand the scope. You should be able to verify that there is continuous phase between frequency symbols, and that yoursymbol length is approximately 725s. You should also view the spectrum of your DDS output on the VSA to verifythat your symbols have the correct frequencies.

Appendix

FM.asm

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 320 spring 2004. OpenStax CNX. Aug 24, 2004 Download for free at http://cnx.org/content/col10225/1.12
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 320 spring 2004' conversation and receive update notifications?

Ask