PHY 406 - Microprocessor Interfacing
Techniques
Module 1 - Simple Analog Input and
Output
Objective
In this module we will examine the basic ideas of analog input and output using a LabVIEW
system. We will use single point and multi-point methods of input and output to see the relative
merits of each type.
There are three parts to this module: Analog Output, Analog Input and Advanced. The
Advanced section is optional and carries no marks.
Preparation
You should have worked your way through the LabVIEW tutorial and have a basic understanding
of how to run a Microprocessor Laboratory computer and the LabVIEW system.
We will be using functions from the Functions>>Data Acquisition>>Analog Input and
Functions>>Data Acquisition>>Analog Output pallettes.
You will need the following Vis
- Functions>>Data Acquisition>>Analog Input>>AI Sample Channel
- Functions>>Data Acquisition>>Analog Input>>AI Acquire Waveform
- Functions>>Data Acquisition>>Analog Output>>AO Update Channel
- Functions>>Data Acquisition>>Analog Output>>AO Generate Waveform
If you stick with channel 0 as the input and output channels, you can use the default values for
the device and channel. You can also ignore the "limits" inputs.
Remember that Ctrl-h brings up help on any VI
Equipment
- Interface cable to LabVIEW system with "box" to break out AD0 and DA0
- Oscilloscope
- Waveform generator
- Connecting cables
Analog Output
Using the example VI E:\l_view\examples\anlg_ot1 compute and output a sine wave of 100
points, one sample at a time. You will need to add a timing control to this VI so that you know
what the sample rate is.
- What is the largest size of sine wave you can produce?
- How does this relate to the fact that this is a 12-bit digital-to-analog converter?
- What is the highest frequency of sine wave which you can produce which looks "reasonable"?
- If an output is to be produced at fixed sample rate such that every state of the converter is to
be used, what is the maximum output frequency as a function of the sample output rate?
Using the example VI E:\l_view\examples\anlg_ot2:
- Replace the constant update rate with a variable number (ie a control).
- Repeat the above exercise with a multi-point output variable output rate.
- How do your conclusions for 1, 2, 3 and 4 above change or not with this new configuration?
- Why doesn't the output sine wave look like a sine wave at high frequencies even if there are
enough points per cycle?
Analog Input
Construct a similar VI to the examples above to measure the voltage on channel 0 of the A/D
converter one point at a time using the VI
Functions>>Data Acquisition>>Analog Input>>AI Sample Channel
and display the result as a chart on the front panel. You should include a control to vary the rate
at which the samples are taken. You can use the signal generator as an input.
- Your chart is in volts, but the A/D converter is described as a 12-bit converter. If the
maximum range of the converter is 10V, what is the smallest theoretical change in input
which can be detected? - Can you devise any practical test to see if this is in fact the case?
- What is the fastest rate of input that you can get?
- What is the highest frequency of sine wave that you can realistically examine at any given
sampling rate? - (ie how many samples/cycle of the sine wave are required)
- If it is required that the input changes less than the smallest measurable change (ie changing a
single bit), what is the relationship between the sampling frequency, bit resolution, sine wave
amplitude and sine wave frequency?
Change your VI to get an array of 100 points using the multi-point input VI and show it on a
graph and then repeat the process. (You will need to adjust the sampling rate input of the
multi-point VI).
- How do your conclusions for 1, 2, 3 and 4 above change or not with this new configuration?
Advanced
This section is for the intelligent/bored or otherwise fascinated. There are no marks for this
section - only the satisfaction of solving a problem or two.
- The waveform in the first example "jitters" because there is no trigger point - a point at which
the waveform always starts. Devise a means to produce a trigger and then display a steady
waveform.
- The problem of the sine wave not looking like a sine wave in the second part can be addressed
by using a more sophisticated buffering scheme. It is possible to use a better buffering
scheme with the VIs AO Config, AO Write, AO Start and AO Clear. Make a better sine
wave generator.
- Build a VI which "listens" to a waveform, locates a single cycle, and then repeatedly outputs
the waveform. This is the basis of an "intelligent" arbitrary waveform generator.
Notes
The reference to a 12-bit converter means that the output of the converter can be represented by a
binary number with 12 "bits" - the equivalent of "digits" in decimal. This means that the
converter can represent 2^12 different numbers, but this includes the sign, so that half these
numbers are positive and half negative. Thus it is more precise to say that this is an "11-bit +
sign" converter.