12.07.2015 Views

Experiment # 1 Introduction to Matlab, Simulink, Code Composer ...

Experiment # 1 Introduction to Matlab, Simulink, Code Composer ...

Experiment # 1 Introduction to Matlab, Simulink, Code Composer ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>to</strong> you. Follow this procedure:• Select the “Solver” tab. Click on “Solver Options” and select type “Fixed-Step”;• Next, select the “Real-Time Workshop” tab. Click on the “Browse” but<strong>to</strong>n on the Configurationarea. A new window will appear, with a list of “.tlc” files. Select the “ti c6000.tlc”file and click on the OK but<strong>to</strong>n.• Under the same “Real-Time Worshop” tab, go under Category and look under “TI C6000Target Selection”. You should have the C6711DSK selected, and must not change any otherselections.• Click on OK and you are ready <strong>to</strong> download your model on<strong>to</strong> the DSP platform.You are ready <strong>to</strong> build the model. There are two ways <strong>to</strong> do it: by going under Tools/Real-TimeWorkshop/Build or by pressing Ctrl-B. At this stage, progress messages will appear on the <strong>Matlab</strong>Command Window. If any error occurs, you will be showed a new window with the specific detailsof the error. Try <strong>to</strong> resolve it, and if you cannot proceed, ask for assistance from your labora<strong>to</strong>ryT.A..After the code for your model has been generated, <strong>Matlab</strong> will load it on<strong>to</strong> Texas Instruments’ DSPprogramming environment, called C ode <strong>Composer</strong> Studio(CCS). This program will be opened in anew window, and progress messages will appear indicating that your model has been turned in<strong>to</strong> a“Project” and that the compiled and assembled project is being loaded on<strong>to</strong> the DSP platform. Theprogram will run au<strong>to</strong>matically. A window will appear within CCS, which is the “Disassembled”code that is running on the platform.Now that the project is visible in <strong>Code</strong> <strong>Composer</strong> Studio, explore the files avaliable on the projecttree (left-hand side). Take a careful look at the code, in both .c files and .h files. From this briefsurvey, you should have a picture of how the project was generated. You can run or halt theprogram as you wish. Try <strong>to</strong> identify how the code is generated <strong>to</strong> allow for the handling of inputand output. That might come in handy in some future experiments.At this point, you can design a more complex system. Add <strong>to</strong> the signal path the adder and thenoise genera<strong>to</strong>r (watch out for the 2-element paremeters). In order <strong>to</strong> see the noise generated, youwill need a gain block just after the genera<strong>to</strong>r. You must multiply the output of the noise genera<strong>to</strong>rby a fac<strong>to</strong>r of 5 ∗ 10e7. This is done <strong>to</strong> adjust the numbers generated <strong>to</strong> be placed at the rightposition within the word passed between the CODEC and the DSP. Feel free <strong>to</strong> add gain blocksas you wish <strong>to</strong> play with the signal-<strong>to</strong>-noise ratio (SNR) and observe the output wave form on theoscilloscope.5 Spectrum AnalyzersUp <strong>to</strong> this point in the experiment, you have become familiar with two forms of visually representingthe signal you measure from the output of the system: the time-domain scope and the”FFT-based” scope. You are also very familiar with oscilloscopes, signal genera<strong>to</strong>rs and multimetersfrom labora<strong>to</strong>ry experiments in other courses. On this part of the experiment, you will be5


introduced <strong>to</strong> the use of the spectrum analyzer, which at this point is added <strong>to</strong> the set of mainmeasurement instruments that you will use in communications. Should you go <strong>to</strong> work in thedesign of communication systems, most certainly you will make use of a spectrum analyzer. Asthe oscilloscope displays signals in the time domain, the spectrum analyzer does it in the frequencydomain.You will not be using the DSP platform in this section of the experiment.Connect the output of the signal genera<strong>to</strong>r <strong>to</strong> the input (50 Ohm) of the spectrum analyzer. Fromthe signal genera<strong>to</strong>r, output a sine wave of 100KHz, 1V pp . Your objective is <strong>to</strong> have on the screenof your spectrum analyzer the frequency domain representation of the 100KHz sine wave. Similarly<strong>to</strong> the oscilloscope, you will have <strong>to</strong> set the axis parameters, which in this case will be frequency(bandwidth) on the x-axis and amplitude on the y-axis. Most of your parameter selection will bedone through the but<strong>to</strong>ns located around the screen. After you set the desired parameters, try <strong>to</strong>explain what you see. Vary the frequency and amplitude of the sine wave and verify the changeson the screen. Spectrum analyzers allow for the user <strong>to</strong> set the desired “span” of frequencies <strong>to</strong> bedisplayed. The three main controls (Amplitude, Frequency and Span) can be modified by meansof a dial or by punching in the numbers and the proper units, as labeled.Now change the input wave <strong>to</strong> a square wave (same frequency, same amplitude). Re-set the bandwidthon the spectrum analyzer. Try <strong>to</strong> explain what you see in light of what you have learnedin Signals and Systems. Modify the frequency and amplitude of the square wave and verify thechanges <strong>to</strong> the displayed result on the spectrum analyzer.Since through the semester you will study modulation in amplitude and frequency, you should trythem out with the signal genera<strong>to</strong>r <strong>to</strong> see the corresponding frequency-domain representation withthe spectrum analyzer. Use a T-connec<strong>to</strong>r <strong>to</strong> see the same signal in time-domain on the oscilloscope.Set the signal genera<strong>to</strong>r for amplitude modulation. Set the carrier frequency for a 100KHz, sinusoidand the modulating signal <strong>to</strong> a 20KHz, 1V pp sinusoid. Observe the output displayed on the spectrumanalyzer. Keep in mind that you will be looking for a similar display when you do the amplitudemodulation experiment (that is <strong>Experiment</strong> #3). Change the modulating signal <strong>to</strong> be a squarewave, with 20KHz and 1V pp . Observe the resulting display on the spectrum analyzer. Vary thefrequency of the carrier and observe the result.Now set the signal genera<strong>to</strong>r for frequency modulation, with the carrier signal as a 100KHz, 2Vppsinusoid, and the modulating signal as a 20KHz, 1V pp sine wave. Vary the frequency of the carrierand observe the result.6 Going The Extra MileIn this experiment, a simple attempt is <strong>to</strong> generate the code for the straight-through block diagram(i.e. ADC connected directly <strong>to</strong> DAC) and add a gain (say, multiply by a fac<strong>to</strong>r of 2) directlyon the C code. Do not forget <strong>to</strong> recompile and rebuild the project before running it from <strong>Code</strong><strong>Composer</strong> Studio. As the course progresses, you will feel more comfortable with the way the codeis generated and will be able <strong>to</strong> modify it more easily.6


Another extra step you may want <strong>to</strong> try is <strong>to</strong> modify the C code of the generated project and makeyour own project.References[1] S. Haykin Communication Systems, 4th Edition. Toron<strong>to</strong>: John Wiley & Sons, Inc., 2001.[2] B. P. Lathi, Modern Digital and Analog Communication Systems, 3rd Edition. New York: OxfordUniversity Press, 1998.[3] The Mathworks, Inc., Using <strong>Matlab</strong>.[4] Tme Mathworks, Inc., Using <strong>Matlab</strong> Graphics[5] The Mathworks, Inc., Using <strong>Simulink</strong>.[6] The Mathworks, Inc., Real-Time Workshop.7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!