Sie sind auf Seite 1von 2

LabVIEW

Exercise: Sampling and Digitizing a Signal

1. Open a new VI. Create two sine waves using the Signal Express Create Signals
Create Analog Signal block as in the demo. The first sine wave should 500Hz with a
1V magnitude, a 50K sampling rate and 200 block size. The second sine wave is
3KHz with a 0.2V amplitude and the same sampling rate and block size.

2. Add the two signals together and display the waveform on a Modern Graph
Waveform GRAPH. Change the name of the display to Original Signal. Run the VI
and confirm that it works. Stop the simulation.

3. Find Align and Resample block under Express Signal Manipulation and place it on
the block diagram. A window will open to set up this block. Leave all of the default
settings except for the Rate. Select specific dt and change the value to 2E-5. Recall
that the sample rate on the sine waves was 50K samples/sec. Does this correspond
to a time interval of 2E-5?

4. Add a second Waveform Graph to the block diagram. Name the graph Resampled
Signal.

5. Connect the output of the add block to the Signals input of the Align and Resample
block and connect the Resampled output of that block to the new Waveform Graph.
Run the VI. You should observe that both graphs are the same.

6. Stop the simulation and change the sample rate (specific dt) to 2E-4. Re-run and
note how that changes the output.

7. Add a horizontal slider to the front panel and label it Sample Time. Set the scale to
have a range between 2e-5 and 1e-3. Run the simulation and set the slider value to
2E-5. Note that the slider is NOT connected yet. Stop the simulation and right click
the slider and select Data OperationsMake Current Value Default Value.

8. Connect the output of the slider to the dt input of the Align and Resample block.

9. Run the simulation and verify that the slider controls the sample time of the signal.
10. In the block diagram, add Signal Express Processing Analog SignalsConvert
Analog to Digital to the right of the Align and Resample block. Set the Analog full
scale to 3, the resolution to 8, and the digital data format to 2s complement.

11. Add Signal Express Processing Digital SignalsConvert Digital to Analog to the
right of the Analog to Digital block. Set the Analog full scale value to 3 and the
Digital data form to 2s complement to match the previous block.

12. Reconnect the second waveform graph to the output of the Digital to Analog block.
Connect the output of the Align and Resample to the Convert Analog to Digital block
and the digital waveform output of the Convert Analog to Digital block to the input
of the Convert Digital to Analog block. Run the simulation. The results should be
the same as those observed previously.

13. Stop the simulation and modify the resolution in the Analog to Digital block from 8
down to 4. Re-run the simulation. Continue to reduce the resolution to view its
effect on the output.

14. Use this VI to observe the effect of sampling and quantization on the output
waveform.

15. Spend some time experimenting with the other features of LabVIEW.

Das könnte Ihnen auch gefallen