[Solved] Experiment 9: Analog Signal Sampling and Reconstruction

30 $

File Name: Experiment_9:_Analog_Signal_Sampling_and_Reconstruction.zip
File Size: 518.1 KB

SKU: [Solved] Experiment 9: Analog Signal Sampling and Reconstruction Category: Tag:

Or Upload Your Assignment Here:


ECE 362 – Experiment 9 Rev 10/13Bigger Bytes Lab Manual -1- © 2013 by D. G. MeyerExperiment 9: Analog Signal Sampling and ReconstructionInstructional Objectives· To illustrate how analog signals can be sampled using the ATD and reconstructed using the PWM (used in conjunction with a low-pass filter)· To illustrate the effects of input sampling rate and output sampling rate on the quality of signal reconstructionParts Required· 2 x 16 LCD and 16-pin single-row header (previous experiment)· GAL22V10 programmed as 8-bit shift register (previous experiment)· One 10 KΩ potentiometer· Breadboard and wirePreparation· Read this document in its entirety· Review material on the ATD, PWM, TIM, and SPI· Complete interface wiring on your breadboardIntroductionIn lecture you have been introduced to the concept of data acquisition using a microcontroller. Here, the analog-to-digital converter (ATD) can be used to uniformly sample a continuous-time input signal, an encoding process referred to as pulse code modulation (PCM). Recall that the minimum frequency at which a continuous time signal should be sampled (Fs) is twice the highest frequency component that signal contains (referred to as the Nyquist frequency).Traditionally, PCM data can be reconstructed using a digital-to-analog (DTA) converter, the output of which is low-pass filtered (to remove “images” of the reconstructed signal centered at integer multiples of Fs). In the absence of an integrated DTA, another peripheral that can be used for signal reconstruction is the PWM unit. Here, the uniformly sampled data from the ATD is converted into a time-varying PWM duty cycle. The resulting “naturally sampled” square wave is then “transformed” into a continuous time signal by low-pass filtering it. One of the goals ofthis experiment is for you to witness this seemingly “magical transformation” first hand, as well as qualitatively compare the effects of input and output sampling frequencies on the reconstructed waveform.Demo ProgramA simple demo program is provided to help you get started as well as test your low-pass filter and function generator setup. This program initializes the TIM, ATD, and PWM modules to sample an analog input at 10,000 Hz and sample the PWM output signal at 47,059 Hz. It also includes provisions for a “digital volume control”.DP Step 1: Set the function generator to produce a 1000 Hz, 5.0 V peak-to-peak sine wave that is offset by +2.5 V DC (carefully verify this with the oscilloscope before connecting the function generator output to your board!).NOTE: All “C” code for this experiment must be written and debugged during your scheduled lab period.ECE 362 – Experiment 9 Rev 10/13Bigger Bytes Lab Manual -2- © 2013 by D. G. MeyerDP Step 2: Connect the function generator output to PAD0 (ATD input channel 0) and to oscilloscope channel 1. Connect the wiper of your potentiometer (with the legs connected to +5V and GND) to PAD1 (ATD input channel 1). Connect channel 2 of the oscilloscope to PT0 (PWM channel 0). Assemble, load, and run the demo programprovided on the course web site. Verify that the potentiometer works as expected (i.e. as a “digital volume control”) and set it to its maximum output. Print the display obtained for one period of the input sine wave (show both channels: the input sine wave and the “raw” PWM output signal).DP Step 3: Using a 1 KΩ resistor and a 0.1 μF capacitor, construct a single-pole low-pass filter (LPF) for the PWM output and connect it between the PWM output pin and the oscilloscope input (channel 2). Leave channel 1 of the oscilloscope connected to the function generator. Calculate the -3 dB cutoff frequency (f-3 dB) of the LPF. Vary the sine wave input frequency from 0.5 f-3 dB to 2 f-3 dB and print the LPF output waveforms obtained for the cases 0.5 f-3 dB, f-3 dB, and 2 f-3 dB.DP Step 4: Vary the input signal frequency and the waveform type. Set the function generator to produce sine, triangle, and square waves at 100 Hz, 1000 Hz, and 2000 Hz (total of 9 cases). Note which waveforms are produced with the greatest accuracy, and which are produced with the least.BONUS CREDIT: Print and carefully label each LPF output waveform obtained.LPF -3 dB cutoff frequency (f-3 dB ) =Waveform comparison notes:ECE 362 – Experiment 9 Rev 10/13Bigger Bytes Lab Manual -3- © 2013 by D. G. MeyerSoftware DescriptionWrite an application program in C that allows the input and output sampling frequencies to be changed, thus facilitating an efficient comparison of signal reconstruction quality. Similar to the demo program provided, ATD Ch 0 will be used to input the analog signal from the function generator, ATD Ch 1 will be interfaced to a 10 KW potentiometer (“digital volume control”), and PWM Ch 0 (output on PT0) will be used to provide the output signal. The left and right pushbuttons on the docking module will be used to “cycle” among the input and output samplingfrequency choices available, respectively. Pushing the left pushbutton will allow the user to cycle through the choices available for input sampling frequency: 5000 Hz, 10,000 Hz, and 20,000 Hz.Note that the input sampling frequency can be controlled by changing the value loaded in TC7. Pressing the right pushbutton will allow the user to cycle through the choices available for output sampling frequency: 23,529 Hz, 47,059 Hz, and 94,118 Hz. Note that the output sampling frequency can be controlled by the PWM clock pre-scalar.Use the LCD to display the current input sampling frequency (ISF) and output sampling frequency (OSF) settings, as illustrated in the example.The RTI will be used to sample the pushbuttons on the docking board every 2.048 milliseconds. Data for the LCD display will be shifted out to an external shift register (GAL22V10) and will be interfaced to the SPI module through Port M (PTM). The description of the LCD interface used previously is reproduced below for your convenience.An external 8-bit shift register (GAL22V10) will be used to interface LCD to the microcontroller via the SPI module (MOSI, port pin PM[4]; and SCK, port pin PM[5]). The LCD will be interfaced as described to the microcontroller module as described in the table below:LCDPin # LCD Pin Description Connected toMicrocontroller1 Vss (ground) Vss (ground)2 Vcc (+5V) Vcc (+5V)3 VEE (contrast adjust) Vss (ground)4 R/S (register select) PTT[2]5 R/W’ (LCD read/write) PTT[3]6 LCD Clock PTT[4]7 DB[0] (LSb) Q[0]8 DB[1] Q[1]9 DB[2] Q[2]10 DB[3] Q[3]11 DB[4] Q[4]12 DB[5] Q[5]13 DB[6] Q[6]14 DB[7] (MSb) Q[7]15 Not connected16 Not connectedNOTE: DB[#] are the LCD data inputs and Q[#] are the dataoutputs of the shift register.ISF: 5000OSF: 47059ECE 362 – Experiment 9 Rev 10/13Bigger Bytes Lab Manual -4- © 2013 by D. G. MeyerSome of the LCD pins require a bit more explanation:Mnemonic Name DescriptionRS RegisterselectThis pin is logic 0 when sending an instructioncommand over the data bus and logic 1 whensending a character.R/W’ Read/write This pin is logic 0 when writing to the LCD,logic 1 when reading from it. For this lab, wewill only write to the LCD.LCDCLK LCD clock This pin latches in the data on the data[7:0]bus on the falling edge. Therefore, this lineshould idle as logic 1.SW Step 1:Complete the “C” skeleton file provided on the course website during your scheduled labperiod. Note that the “finished product” should work in a “turn key” fashion, i.e., yourapplication code should be stored in flash memory and begin running upon power-on or reset.After completing your C program, test its operation by selecting an input sampling frequency of10,000 Hz and an output sampling frequency of 47,059 Hz. Verify that the results obtained (LPFoutput waveforms) with a 1000 Hz sine wave as input are identical to those produced by thedemo program.SW Step 2: With a 1000 Hz sine wave as input, cycle through each possible combination ofinput and output sampling frequencies (total of 9 cases). Note which waveforms are producedwith the greatest accuracy, and which are produced with the least.BONUS CREDIT: Print and carefully label each LPF output waveform obtained.SW Step 3.Submit your “.C” solution file on-line after demonstrating it to your lab T.A. (but before leavinglab). Be sure identifying information (i.e., name, class number, and lab division) is included inthe files you submit – credit will not be awarded if identifying information is omitted.Waveform comparison notes:ECE 362 – Experiment 9 Rev 10/13Bigger Bytes Lab Manual -5- © 2013 by D. G. MeyerThought QuestionsAnswer the following thought questions in the space provided below:(a) In your own words, describe the difference between uniform sampling (PCM encoding) andnatural sampling.(b) Provided Nyquist-related input sampling constraints have been met, what is the mostimportant parameter that influences the quality (accuracy) of the reconstructed outputsignal? What is a “good working value” for this parameter?(c) Describe what you would expect to observe if the value of R and/or C in the LPF werechanged (thus changing the cut-off frequency).(d) Describe what you would expect to observe if a higher order LPF were used in place of thesingle-pole filter.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Experiment 9: Analog Signal Sampling and Reconstruction
30 $