Vous êtes sur la page 1sur 47

LabVIEW Course

Leiden University




2
Index
I NDEX........................................................................................................................................................... 2
I NTRODUCTI ON........................................................................................................................................ 4
LABJ OURNAL............................................................................................................................................... 4
SAVING YOUR VIS...................................................................................................................................... 4
TIPS, TRICKS & SHORTCUT KEYS................................................................................................................ 4
[E]-QUESTIONS........................................................................................................................................... 4
PRACTICUM 1............................................................................................................................................ 5
FRONT PANEL & BLOCK DIAGRAM............................................................................................................. 5
COMPUTER SETTINGS.................................................................................................................................. 5
AUTOMATIC TOOL SELECTION.................................................................................................................... 6
Hello World............................................................................................................................................ 6
DATA TYPES: FLOATS, BOOLEANS, ETC...................................................................................................... 7
EXECUTION HIGHLIGHTING......................................................................................................................... 8
LOOPS......................................................................................................................................................... 8
DATA TYPES: ARRAYS................................................................................................................................ 9
DATA TYPES: STRINGS.............................................................................................................................. 10
IEEE 488: GPIB Communications....................................................................................................... 11
Synthesizer............................................................................................................................................ 13
SEQUENCE STRUCTURES........................................................................................................................... 13
WAIT STATEMENTS................................................................................................................................... 13
INDEXING.................................................................................................................................................. 14
A/D CONVERSION..................................................................................................................................... 15
Loudspeaker ......................................................................................................................................... 15
PC Operated Frequency Sweep............................................................................................................ 15
I/O CARDS................................................................................................................................................. 17
DAQMX SINGLE POINT OUTPUT ............................................................................................................... 17
DAQMX MULTIPLE POINT OUTPUT .......................................................................................................... 18
BASIC PLOTTING: WAVEFORM GRAPH...................................................................................................... 20
DATA TYPES: CLUSTERS........................................................................................................................... 20
DAQMX CONTINUOUS OUTPUT ................................................................................................................ 20
CASE STRUCTURE ..................................................................................................................................... 21
A LabVIEW Function Generator.......................................................................................................... 22
SINGLE POINT INPUT ................................................................................................................................. 24
MULTIPLE POINT INPUT ............................................................................................................................ 24
CONTINUOUS INPUT .................................................................................................................................. 24
CONTINUOUS INPUT: DETAILS................................................................................................................... 25
AUTOMATED DATA STORAGE................................................................................................................... 27
DATA TYPES: PATHS................................................................................................................................. 27
Check the 5V Voltage Source............................................................................................................... 27
ADC LIMITATIONS.................................................................................................................................... 28
CUSTOM SUB-VIS..................................................................................................................................... 28
The Temperature Converter ................................................................................................................. 28
USING CUSTOM SUB-VIS.......................................................................................................................... 29
DATA TYPES: WAVEFORMS....................................................................................................................... 29
MEASUREMENT & AUTOMATION EXPLORER............................................................................................. 29
PROPERTY NODE....................................................................................................................................... 30
RS232 COMMUNICATION.......................................................................................................................... 30
PRACTICUM 2.......................................................................................................................................... 31
INTRODUCTION.......................................................................................................................................... 31
THEORY .................................................................................................................................................... 31



3
BASIC DIGITAL FEEDBACK MECHANISMS................................................................................................. 32
Proportional Feedback......................................................................................................................... 33
Integrating Feedback............................................................................................................................ 33
Differential Feedback........................................................................................................................... 34
COMBINED FEEDBACK MECHANISMS......................................................................................................... 34
Proportional & Integrating Feedback.................................................................................................. 34
Proportional, Integrating & Differential Feedback............................................................................. 35
THE PHYSICS OF NTC RESISTORS............................................................................................................. 36
THE HEATING DEVICE............................................................................................................................... 37
EXPERIMENT ............................................................................................................................................. 38
Precautions........................................................................................................................................... 38
Hardware.............................................................................................................................................. 38
Thermal Response Time........................................................................................................................ 39
Software................................................................................................................................................ 39
TEMPERATURE CONTROL WITH PI FEEDBACK ........................................................................................... 40
Optimization of the feedback parameters............................................................................................. 40
References............................................................................................................................................ 41
PRACTICUM 3.......................................................................................................................................... 42




4


Introduction

LabVIEW is a programming language developed by National Instruments, and designed to
facilitate communication between different types of hardware, such as personal computers,
function generators, A/D converters, et cetera. It has a graphical way of depicting pieces of code,
instead of being text-based.
Labjournal
For practicum 1 you are only required to write down the answers to the questions in your
labjournal, perhaps adding prints of some block diagrams; you will be asked to do so when
necessary. In practicum 2 and 3, you are required to keep a labjournal
1
, as you would make with
laboratory experiments. Note that the course schedule for this year is not yet updated: LV 1,2 and
3 in the schedule together form practicum 1, LV 4 is practicum 2 and LV 5 is practicum 3.
Saving Your VIs
Be sure to save your VIs regularly, preferably every time it is required in the course to add new
functionality. This will facilitate debugging, and can be handy for future reference. Saving
subsequent versions of VIs is also a standard laboratory practice.

There are several saving options when you select File|Save As in LabVIEW 8.x. Choosing
Substitute copy for original is most convenient if you just want to save the current VI as version
x.y and continue with programming. If the LabVIEW Help is open, you can see what the
different saving options exactly mean.
Tips, Tricks & Shortcut Keys
You can find them in the addendum by National Instruments, included in this manual. Learning
them by heart immediately is possible, but it is easier to learn them while you learn to use
LabVIEW.
[E]-Questions
Sometimes an [E]-symbol is added to a question in this manual. This means the question is not
mandatory. Skip it if you do not have enough time to complete the necessary questions; you can
always do it later.


1
The words report and labjournal will be used interchangeably.



5

Practicum 1
In this practicum you will be introduced to the basics of LabVIEW. To start, open LabVIEW and
create a Blank VI.
Front Panel & Block Diagram
What you should see in front of you are two panels: a white and a grey one. The grey one is the
Front Panel, and will contain the interface of your program, with buttons, indicators, and so on.
The white one is called the Block Diagram, and will contain the actual code itself, so the for-loops,
the multiplications, et cetera. There are several ways to arrange these panels on your desktop: in
Window|, you can select the tiling Left and Right or Up and Down, which creates a non-
overlapping tiling of the two panels. You can also keep the panels overlapping, and use Ctrl-E to
swap between the two while programming. The programs you make can be run with this button:

Ctrl-R has the same effect; try this. The button next to it can be used to run a program over and
over again, but handle this button with care; sometimes it will make LabVIEW crash. Note also
that it is bad practice to use this button as some sort of while- or for statement. To stop programs
while running use Ctrl-. (Ctrl-dot) or the Stop Button depicted in Figure 2. This button is
depicted as inactive, but will be active when a program is running.
Computer Settings
The LabVIEW interface can be customized to a large extent. However, to keep this manual
readable and to facilitate teaching assistant supervision during the course, it is more convenient
to use standard settings. These settings can be found in the Tools|Options section. Another part
of the interface that can be modified (but for convenience should be kept as it is for the duration
of the course) is the look of the Functions Palette that you can open with right-click on the block
diagram. Its view, which can be changed after clicking on the drawing pin by clicking the button
next to the button the magnifying glass, should be set to Category (Standard)

Figure 1: Run.
Figure 2: Abort Execution.
Figure 3: Tools Palette.



6
Automatic Tool Selection
Open now View|Tools Palette. The settings you have just seen make (among other things) sure
that while using LabVIEW, the proper tool is selected for your needs automatically. This is done
by hovering over objects in your front panel and the block diagram; this will make the pointer
change into one of the objects in Figure 3, with the following functionality:

Wrench and Screwdriver: turn on/off automatic tool selection
Finger: push buttons
Pointer: select, resize
Text Tool: write text or numbers
Bobbin: create wires between objects, create connected controls/indicators
Menu Tool: same as right-click
Hand: pan
Breakpoint: create point where program pauses (execution can be resumed)
Probe: show contents of wire during execution
Pipette: assume color
Brush: paint with color

Hello World

Save your VIs before you run them. This can save you hours of work; some students have
learned this the hard way.

The first programming task you are going to complete is actually not creating a Hello World
string output, but it comes close. It will be an exercise to demonstrate the basic functionality of
LabVIEW, and will therefore be fairly trivial. Follow the text and, if you get stuck, check the
footnotes for tips. Right click on the front panel and click on the drawing pin on the pop-up
screen. This will lock this pop-up screen. Now place a Numeric Indicator on the front panel and
Figure 4: Create numeric indicator.



7
obtain a picture
2
as in Figure 4. Now go to the block diagram via Window|Show Block Diagram
or Ctrl-E, and connect a Control to the indicator you just made. This can be done with the pop-
up menu opened by right-clicking on the indicator
3
. See Figure 5. This will create an object that
allows you to insert any number at that point into the program. Double-click now on this newly
created control in the block diagram; this will make you jump to front panel (alternatively, Ctrl-E
will get you back to the front panel as well), where you can enter a number in the control. The
control accepts many different notations: 1E2, 2e3, 3.4, 5k, 6m and 7M are all allowed. Now use
the run button to use your first LabVIEW program.
Data Types: Floats, Booleans, etc.
Just as many other programming languages, LabVIEW also supports different types of data types.
Examples are integers, Booleans, complex numbers, and double precision floats, as the one you
just used. To see how the Booleans look like (remember: this is a graphical programming
language, so all its elements have a certain look), we shall now extend the program with an
element that can check whether the number you just typed is larger than a pre-specified number.
To do this, right-click on the block diagram, and select Programming|Comparison|Greater (from
now on the Programming|-division shall be assumed unless otherwise stated). Place this icon on
the block diagram, somewhere close to the line between the two orange boxes. You have now
placed a sub-VI on your block diagram. Compared to C++, this would roughly be a function that
you can call from main. LabVIEW comes with a large library of sub-VIs with all sorts of
functionalities, and they can be accessed via the function palette. In addition, you can make
custom sub-VIs; that will be the subject of a later section of this practicum.
Connect
4
your control to the x-terminal of the comparison sub-VI. Create a control on the y-
terminal with the steps outlined above. Create
5
an indicator for the Boolean that comes out of the
Greater? sub-VI. Now go to the front panel and check whether your program responds the way
you expect it to respond.

Q.1
How does the Boolean indicator change if it changes from False to True (or vice versa)?


2
Click on Numeric, and select the Numeric indicator (hover over the icons to see how they are
called). Now place this indicator somewhere on your front panel.
3
Hover over the box and notice how the pointer changes into a bobbin.
4
Click with the bobbin on the orange line in your program, and connect the dotted line to the x-
terminal.
5
Right click on the left terminal and select Create|Indicator.
Figure 5: Create Control.



8
This might be the first place where you encounter a bug in your program. If your program
cannot be run, the Run-button will have changed. If this is the case, you can click on this button
to see where the bug(s) is (are) located.
Execution Highlighting
Once you have a program that works properly, you can look at the following functionality which
makes LabVIEW very convenient at times. Go to the block diagram and click the following button
(Figure 6):


Now run the program and observe what happens. This Execution highlighting can be quite
handy to debug your program. It slows down the program, and allows you to observe the values
on all the wires, controls, indicators, et cetera, in your program. If you do not want to slow down
your program, but nevertheless want to see what data is on a certain wire, right-click on the wire
and use the Probe, while running the program.

Q.2
Give the difference(s) between the icons that represent inputs and outputs. Do this for the
block diagram only, and watch for the differences that are independent of the datatype
represented by the in- or output.
Loops
To repeat certain operations, LabVIEW can execute while- and for loops. Their function is
virtually identical to those bearing similar names in C++. To illustrate their behavior, go to the
functions palette
6
, select Structures|While Loop, and place
7
it on your block diagram.

Q.3
The program is not executable now. What is the problem according to the message you
get from the broken run button?

If you need to drag a very large while-loop around you program, your program is probably
taking up too much space. Make your program more compact by click-and-dragging the icons
on the block diagram more closely to each other. This will make your program easier to read,
which will become especially useful when your programs contain more and more elements.
Compare this with using indentions in C++ for instance: strictly speaking the code will work
without it, but it will be easier to read.

6
This palette is only available when the block diagram is the active window on your desktop.
7
Click-and-drag this loop around the program you have already made.
Figure 6: Execution Highlighting.



9

Now connect the Loop condition to the green line carrying the Boolean. Use Execution
highlighting while you do a few test runs with your program, to see what this Loop condition is
meant for and how you can change it. Then use the LabVIEW Help, available via Ctrl-H, F1 or the
menu to check whether you ideas about it are correct.
A for loop is a loop that is executed only a predetermined amount of times. With the counter from
the while loop (the blue box with an i inscribed) and the comparison elements in your while loop,
you can however build the same functionality in your own program. Modify your program in such
a way that you get the following block diagram (Figure 7).

Q.4
If y is N (with N an integer), what then is the value of Numeric after execution of the
loop? Explain this.

Sometimes it is necessary to carry over information from one loop iteration to the next. The value
of the counter is an example; this memory is already implemented in the blue box with the i
inscribed. But think of a situation in which you would like to compare, say, the measured
temperature (yes, with LabVIEW one can ultimately measure physical observables like
temperature) in the current iteration with that from the previous. For these situations one can
create an additional memory element called the Shift Register. To make this memory element,
simply right-click on the side of the while-loop and select Add Shift Register. You should see the
two elements visible in Figure 8: Shift register. At iteration N one can wire any data type into the
right element on the edge of the while loop, which will then become available in the subsequent
iteration N+1 from the left side of the loop.

Data Types: Arrays
An array is just an ordered collection of items. In this section you shall make a one dimensional
array of integers that can be used for plotting, calculations, et cetera, with the while-loop we just
created. Now if one wants to stack numbers, what one has to do in words is the following:

Get the existing stack from the memory, if there is any
Add one number to the stack
Put the appended stack back into the memory

To add a number to the stack, or in general, to build an array, you need a sub-VI that builds an
array. Luckily, there is just such a VI in LabVIEWs standard library. On the block diagram, place
Figure 7: While loop.
Figure 8: Shift register



10
the Array|Build Array-icon in your while loop. By default, this VI has one input and one output.
Wire the while loop counter to the input. In order to complete the building process, you need the
existing stack, and another input for this stack. This existing stack comes from the shift register
(the left box on the edge of the while loop is a data source). To build the array by adding the
existing stack to the element from the counter, add this extra input by expanding the sub-VI
8
.
Alternatively, you can right-click on the icon and select Add Input. Now wire the output of the
Build Array sub-VI to the shift register sink (the box on the right side of the loop) and you will
see that it changes color. Once the shift register sink is connected, the source for the subsequent
iterations can be connected to the remaining open input from the build array sub-VI.
9

Unfortunately, you have no access now to the contents of the array. In order to see the contents of
the array, right-click on the Shift register outside the while loop, and create an indicator. Now go
to the front panel and find the array. What you should see is depicted in Figure 9. You recognize
the grey box: that is the indicator that shows what value is inside. But the array has more than one
element, and to visualize the, you can perform the same expansion trick as with the Build Array
VI. The white box with the number in it is the coordinate of the first element of this row. If you
have two or more white boxes, you actually have a two (or higher) dimensional array.

Note the change in thickness of the wire that carries the array; all different data types have a
different wire.

Q.5
Set y to 0 and run the program a few times. What array do you see in the output?

Q.6
What happens to the array when you reverse the inputs on the build array-elements?

The issue you encountered in answering question Q.5 in using the memory of the shift-register is
that it has to be erased at the beginning of the program, and now this step is not yet implemented.
To erase this memory before each execution of the program: right-click on the left connector of
the shift-register and create a constant. This constant is actually an empty array, which will
overwrite/delete everything that was in the memory reserved for the shift register from a previous
execution of the program.
Data Types: Strings
Apart from handling numbers and Booleans, LabVIEW can handle text strings. One particular use
of them is in automated data storage. In such an application, one would for example like to create
logically named data files in a particular directory. One way to program this is to use the Number
to Decimal String sub-VI in combination with Concatenate Strings. To find them, go to the block
diagram, open the functions palette with a right-click and click on the drawing pin. Then you can
locate them in the String section. Use the while loop from the previous exercises, or make a new
program to construct a piece of code that automatically creates numbered filenames, including
the drive and directory, as in: P:\data\measurement123.dat.
In one of the previous exercises you created an indicator to monitor the contents of an array (see
above). This indicator was positioned outside the while loop, and only showed the content of the
array after completion of the while loop.


8
Hover over the icon until an up/down pointing arrow appears, then click-and-drag, dragging
downward. This will create extra inputs.
9
When you connect the source of the shift register before the sink, a broken wire will appear,
since the content of the source is only determined by connecting the sink.
Figure 9: Array indicator.



11
Q.7
What happens when you connect an indicator to the output of the Number to Decimal
String sub-VI, and place the indicator inside the while loop? Describe what happens
when you run the program (if necessary with execution highlighting).

Q.8
Save the VI you made and include a copy of its block diagram in your report.

Q.9
Usually file managing programs, such as Windows Explorer, order files on name by
looking at the first digit they encounter in the filename, starting from the left. Therefore,
in order to get a properly ordered list, you usually have to add zeroes to the number in the
data filename. Extend you program to add a predefined number of zeroes to the number
in the filename [E].
IEEE 488: GPIB Communications
Since you are now familiar with most of the basics of LabVIEW, you
can now put LabVIEW to use where it is actually efficient to use: I/O.
You will now see that LabVIEW can be used for communication with
external devices and instruments.
Apart from PCs, you will find special purpose electronic hardware in
almost all experimental physics setups. These devices have knobs
mostly, but being able to control these devices electronically can come
in handy sometimes. Additionally, in some situations these special
purpose devices actually gather your data (think of voltage or
temperature readers), and transferring this data to your PC via a cable is more convenient than
via a solid-state memory module, such as a CD or an SD card (which is actually present in the
oscilloscope you are going to use).
To connect external devices to a PC, there are several standard ports available on a PC (USB,
Parallel/Serial Ports, FireWire). Some manufacturers choose to use their own communication
protocol to communicate with the device via on of these ports, and write (proprietary) software
for this, which they then supply with the device. However, more and more manufacturers choose
to use standardized communication protocols to serve as the information channel between their
device and a PC. Well-known examples of these standardized protocols are for example USB,
Ethernet, WiFi and FireWire
10
. These worldwide standards are defined by the Institute of
Electrical and Electronics Engineers (IEEE) organization. LabVIEW comes into this story as
being a programming language that has a software library that allows you to implement and use
many of the IEEE-protocols rather easily. The title of this section already shows which
communication protocol you are going to use now: the IEEE 488 protocol, or GPIB. It is a rather
old and slow protocol, but it is still quite common. The GPIB port is not available on PCs by
default, so one has to a GPIB extension module for a PC (usually a PCI or PCI-e card, but there are
also USB-to-GPIB converters) to use this protocol. Anyway this port is available on the PC you are
working with.
Check whether the Tabor Function generator is connected to your PC via the GPIB cable. If not,
do so now. Open a blank VI and go to block diagram. Now you need sub-VIs with which you can
communicate via the GPIB protocol. To find VIs in the library, LabVIEW also has search
functionality. Go to the search of the functions palette
11
. In the search field, type gpib (the search
is not case sensitive). LabVIEW will find a list of GPIB commands for you. The one you need now
is GPIB Write. Select it, and place it one the block diagram. Connect all the terminals with
controls and indicators.

Be careful not to use the search all the time to find all the VIs you need. Using the search can be
slower then simply memorizing where you can find VIs on the function palette. Moreover, in this

10
Firewire refers to the port as well as to the communication protocol itself.
11
The magnifying glass.
Figure 10: GPIB cable.



12
functions palette of the block diagram the VIs with similar or related functionality are grouped
together, and sometimes simply by browsing you find quite useful VIs there you did not know
existed.

With the GPIB protocol you can hook up more than one machine on a single connector, so one
needs to include a reference to the specific device you are sending a command to. This is the
function of the Address; the address of the Tabor is set in the Tabor itself and equals 15 in this
practicum. To communicate with the Tabor, you need to know which commands it understands
(remember: the GPIB protocol only tells machines how to talk to each other, but not what to say).
These commands can be found in the manual of the Tabor, on Table 4-5. This table is an
additional sheet of paper often stapled into the official booklet. Note that once you have used the
GPIB to set a function, the Tabor cannot be operated via its panel anymore. Press the LCL button
to activate the panel again.

Q.10
What are the commands to set the frequency, amplitude and type of waveform?

Q.11
Find out how to change the address of the Tabor. You should be able to find this
information in the manual. What is the exact procedure [E]?

Do not press Enter after typing a command such as FRQ500 in the String Control on your
front panel. An Enter is also a string constant, and will stay in the string control box, making
all subsequent commands invalid. One of the first things to check when you encounter a
malfunction of your VI while it is running is the content of the string control. To run your VI just
click run or press Ctrl-R.

It is also possible to acquire information from the Tabor, for example the waveform amplitude. To
get this information, you have to send a so-called query command. These commands can be found
in the same table mentioned before. After you have sent this command, you can read what the
Tabor is saying by using the GPIB Read sub-VI
12
. Note that you have to send a query command
before you can read something on the GPIB bus. Moreover, after reading, the message will be
deleted from the bus.

Q.12
With what command can you query the frequency or the amplitude? Do not use these
commands yet, some more LabVIEW functionality is necessary to make this work
properly.

Q.13
What text is displayed on the Tabor when you send an undefined command? What
message is displayed when you specify a valid parameter (say the frequency) but out of
range? Send the following string: STP1000; SWT10; FRQ1 hook up a scope to the Tabor
(see below) and describe what this particular command does.

Observing a changing amplitude or frequency on the display of the Tabor is one thing, but it
would be nice if you can actually check the signal on the output BNC connector from the Tabor.
To visualize this signal, normally one uses an oscilloscope. Connect the output of the Tabor to the
oscilloscope (with a BNC cable) and check the signal that it produces, by sending different
commands to it. The command strings are case sensitive, by the way. Note that the Tabor can
produce signals with frequencies up to 20MHz. Try to create different waveforms with the Tabor
via your PC, such as a linear and logarithmic sweep, a DC output, et cetera.


12
All the GPIB sub-VIs can also be found via the Instrument I/O|GPIB section on the functions
palette.



13
The oscilloscope has an auto-set button that you can use after you turned it on. This makes it
easier to visualize your waveform for the first time. Try to learn how to use it without the
autoset button though it does not always show you what you want to see.
Synthesizer
We can use the Tabor in combination with Labview and a loudspeaker to construct a synthesizer,
be it a very modest one. To get there, there are a few Labview things to learn.
Sequence Structures
In using the GPIB commands, you have probably already noticed that the order in which you
execute commands is sometimes essential. Usually LabVIEW executes code from left to right, but
two separate pieces of code on the same block diagram might be executed virtually
simultaneously, resulting in undesired or unpredictable behavior. To solve this issue, one can use
a Sequence Structure that forces a sequential execution of pieces of code. This structure comes
in two types, their difference being only their appearance. In Figure 11 you see the Flat Sequence
Structure, the other sequence structure is the Stacked Sequence Structure. The sequence
structure can be useful to make an automated GPIB-query program that first sends the desired
query command, and then reads the message on the GPIB bus immediately afterwards.

Q.14
Build such a VI and include its block diagram in your labjournal. If you encounter strange
behavior, try reading the next section (not the next question) first.

Q.15
If you use a stacked sequence, you cannot simply pass data from one frame to a
subsequent frame by e.g. dragging a wire. What function is available on these stacked
sequences to circumvent this?

Wait Statements

When you send a very long string over the GPIB bus, it might take a while before the whole string
is received by the Tabor. This is due to the fact that the GPIB bus is slow (9600 Baud usually,
where Baud means number of symbols per seconds). However, once LabVIEW has completed
executing the Write GPIB-subVI itself, it will continue with the rest of the program, regardless of
the fact that the GPIB controller may still be sending data.
To compensate for the fact that LabVIEW is not always aware of when your hardware has finished
the operations you ordered it to execute, you can use wait-statements manually, preferably in the
Figure 11: Flat sequence structure.
Figure 12: Two different 'wait' statements



14
sequence structure you just learned. There are two different wait statements: Wait (ms) and
Wait Until Next ms Multiple; Figure 12 shows how they look. The first one is used if you want
your program to wait a certain amount of time at a specific location in the execution order of your
program. Typically you place this sub-VI in a sequence, in order to enforce the proper moment of
execution.
The operation of the second timer is more complicated. In order to understand its behavior, you
have to know that Labview has an internal clock, counting the number of milliseconds passed
since some arbitrary starting point. The value of this clock is an integer (32 bit) and will count
zero when it has reached 2
32
. When you execute the Wait Until Next ms Multiple-sub-VI, with,
say, 100 millisecond as input, the program will wait until this internal millisecond clock has
reached a value that is an integer multiple of 100. Therefore, the first time you run this sub-VI,
you never know how far you are from this number, and the first waiting time after calling this VI
is therefore arbitrary, but bounded from above by the number you specified. This VI is however
quite handy if you use it in a while loop for instance; it will make sure your while loop is executed
at regular intervals. This can be useful for e.g. synchronization purposes.

Indexing
The synthesizer you are going to make initially will be able to play a predefined number of tones
with certain duration. By now you should roughly be able to see how this can be put together with
a for-loop, the GPIB library, sequences and wait statements. There is however a feature of loops
that can be quite helpful in this and other applications. This feature is called automatic indexing.
Figure 13 shows an example; one can create similar functionality in while-loops. In this figure the
basic functionality is that the for-loop automatically runs through all the elements in the array,
making them individually (in the indicator in this case) available. The number of iterations in this
code is equal to the length of the array.

Q.16
What happens when you connect two arrays of different length via indexing to a single for
loop?

A simpler version of an array building technique discussed earlier is shown in Figure 14. Here, the
indexing technique is used to create arrays automatically. This method is not as flexible as the one
using the build array sub-VI, since one cannot, for example, change the order of elements in the
array. Another drawback is that the array that is being built up is not accessible inside the loop, so
one cannot for example show its contents in a graph while the loop is being executed. Note that
indexing is usually automatically applied on data lines crossing a loop boundary. If you do not
want this to happen, it can be manually turned of via the menu that pops up after a right click on
the square with the brackets inscribed.

Figure 13: Indexing in loops.
Figure 14: Build array with indexing.



15
A/D Conversion
You will encounter the abbreviations DAC and ADC quite often in this manual. The
abbreviations stand for Digital to Analog Converter and Analog to Digital Converter. They refer in
most cases to the microchip that converts digital to analog signals, or vice versa. These microchips
are of course essential for performing electronic measurements.

Q.17
To see that these converters are indeed microchips, look up the datasheet
13
of one
particular example of an A/D converter, the AD7248. Include a print of a small part of the
datasheet in your labjournal.
Loudspeaker
The loudspeaker you will be using to produce sound is a 6 loudspeaker (in principle the
impedance of the coil in the loudspeaker is frequency dependent), with a maximum power
consumption of 10W. These numbers set a limit on the voltages you can use to modify the
amplitudes of the sounds produced. Usually though the loudspeaker starts to behave non-ideally
far below these upper limits. In any case, if you want to test your synthesizer (or any other piece of
equipment!), start gently, with small amplitudes. The calculation you shall do below, will tell you
what gently actually means in this case.

Q.18
Derive what the maximum voltage is you can apply to the speaker, and what current then
flows through the coils inside the speaker at that maximum. Once you know the upper
limit of what the hardware can bear without breaking down, what would be a gentle
initial test voltage?

The Tabor can only produce a 50mA current, so it will not be able to drive the speaker directly (or
only very softly). To amplify a current without modifying the voltage, you can use a buffer
amplifier. This device simply consists of an electronic amplifier with an amplification factor of 1.
It is only meant to beef up the amount of current you can supply, without changing the voltage.
The amplifier itself is a so-called active circuit element, requiring a power supply, so the power it
funnels into the circuit can be larger than it gets from the circuit (for passive elements such as
resistors or capacitors this is not true of course),. The circuit in this case is the 50mA current
source. The buffer amplifier is a relatively large box with one bipolar input and one bipolar
output; you will find it on your workbench.

Q.19
Now build a synthesizer with which you can play a certain amount of tones sequentially,
whose frequency, amplitude and length can be modified via the front panel. Include the
front panel and block diagram in your report. Dont forget to save the VIs you build for
your own reference; you might be able to use pieces of code to make now later on in the
practicum.
PC Operated Frequency Sweep
With the string operators used in the previous section and a for-loop you can make a VI that will
make the Tabor produce a frequency sweep of which you can set the start frequency and the stop
frequency in LabVIEW. This functionality you have already seen in Q.13.

Q.20
Make this program. Make sure that the frequency steps are smaller than unity for a
smoother updating of the waveform. Check the sweep with the oscilloscope, and the
loudspeaker. Include the block diagram of this VI in your labjournal [E].


13
Datasheets are sometimes also called specsheets, where spec comes from specification.



16
Q.21
Make a sweep with a sine wave that starts at 100 Hz, and stops at 0.001 Hz. Change the
setting of the scope from DC to AC. What do you observe[E]?

This effect is caused by the response of the internal high pass filter
14
you switch on when to put
the scope to AC. This setting is useful if you want to observe low amplitude Alternating Currents
(AC) on a signal that also has a large Direct Current (DC) component.

Setting the wrong AC/DC input setting by mistake on the scope happens easily and often causes
confusion. Check this setting first in case you experience problems with the scope.






14
You should have seen high and low-pass filters in the first year practicum. You will learn more
about them in the course called SVR. It might be useful to remember the sweep-function; you can
use it to measure the transfer function of filters.



17

I/O Cards
15
The functionalities built into the Tabor and the oscilloscope, namely digital to analog signal
conversion and vice versa, respectively, can also be achieved by other hardware. This hardware is
specifically designed to fit into your PC
16
, so-called input/output (I/O) board. Depending on the
type, other functionality is usually also available on these boards: digital clocks (5V square wave
generators), digital ports that can either sense or output digital signals, for example for TTL
circuits. These cards
17
can be bought at different manufacturers, but not all work equally well with
LabVIEW. The card installed on your PC is the PCI-6014 from National Instruments.

Q.22
Download the datasheet from ni.com and write down what type of I/O functionality
(inputs/outputs/speed etc.) is available on this card.

So why use an oscilloscope if you can use a more flexible I/O board? Why use a function generator
if the same output can be achieved with a cheaper PCI card? There are advantages and
disadvantages in both solutions: familiarity with the programming language is for example a
strong boundary condition for using LabVIEW-based solutions. Flexibility in use usually also
means hard to set up: you will see that programming a very basic function generator in LabVIEW
takes quite some time and skill, while the Tabor works when you turn it on. Another
consideration is hardware demands: to measure picoamperes or gigahertz signals, dedicated
hardware is usually required; I/O boards that do that are simply not available. Lets also not
forget that all PCs run on complicated operating systems which are far more likely to stop
functioning properly than a custom programmed microchip in e.g. a function generator. Yet
another consideration is that a function generator might keep working for >20 years; hoping for
full software and hardware compatibility guarantees for the duration of 20 years is a utopian
dream. Typically, when your application is either very demanding or very simple, or when a quick
solution is needed, dedicated hardware is the preferred piece of equipment. For a versatile basis
of doing moderately intricate experiments, involving different pieces of hardware or which have
to be tailored to specific demands that are too expensive or simply inexistent commercially,
Labview can be an indispensable tool.
DAQmx Single Point Output
An easy way to get used to the basics of I/O is to learn how to create a potential difference
18

between an analog output port and the ground of the I/O card. The ingredients can be deducted

15
This part of the manual is an adaptation of the original course material Data Acquisition
Fundamentals by Sarah Finney, Arizona State University.
16
Although nowadays also USB-I/O cards are available.
17
The words card and board are synonyms here and will be used interchangeably.
18
to write a voltage in the text below refers to the same operation.
Figure 15: Single point write.



18
from the contents of the previous sentence: you will have to tell the computer which port you
want to address, and how large the potential difference should be. This can be achieved by
building the code depicted in Figure 15. The sub-VIs depicted there can be found in Measurement
I/O|DAQmx. The physical channel constant refers to Dev1, which is the 6014 card you have. The
1 in this constant is equivalent to the address in the GPIB protocol; you could have more than
one I/O card installed. ao0 refers to the AO0 BNC connector on the connector box. The settings
in the purple boxes on your block diagram are not depicted think about what you need for
analog output (AO) and a single channel, single point output. Modify the content of the purple
boxes by clicking on the inscribed triangle. Make sure you do not select the Waveform option.
This small program should be able to write a voltage to the AO0 BNC connector on the connector
box. You can check whether this works with the scope.
DAQmx Multiple Point Output
The program from Figure 15 can write the voltage to an output port only once. What if you want to
output, say, a (discretized) sine wave? From what you have learned so far, you might expect the
following solution to work:



If the Sine Wave array contains a discretized sine wave, in fact this solution will work! This
solution is however severely limited: remember that the clock in LabVIEW has only millisecond
accuracy. That means that, theoretically, the for-loop cannot be accurately synchronized at a rate
faster than 1000x per second. That means that the voltage on AO0 cannot be updated faster than
1000x per second
19
. This limits the frequency of your sine wave to 500Hz
20
; nothing compared to
the 20MHz of the Tabor.

Q.23
Check the statement above by building the code from Figure 16, and using zero (0) for the
millisecond multiple. Using a sine wave is not required; just make of a small array that
contains voltage steps you can visualize on the scope. What is the maximum output rate
of this code?


19
In practice the execution of the DAQmx sub-VIs takes a few milliseconds at least (depending on
the computer hardware), which makes the code even slower.
20
The largest frequency component you can generate is f
max
/2, where f
max
is the output (or input!)
writing (reading) frequency. This is the Nyquist theorem. You will learn more about this in the
SVR course.
Figure 16: Finite multiple single points output



19
There is however a hardware clock present on the 6014 board that actually goes up to 20MHz
21

(you might have seen that in the datasheet). This clock, along with some other hardware can be
addressed with LabVIEW. Example code is depicted in Figure 17. To build this code, you have to
select the 1Chan NSamp-option from the purple box below the DAQmx Write sub-VI. Again
select the DBL-option. In addition to this modification, to specify the rate at which the content of
the array is written to the output port (in Figure 16 this is done with the metronome sub-VI), you
can use a DAQmx sub-VI that can configure the output rate. The Staircase-array should be a one
dimensional array containing 10 numbers: 1,2,3,4,5,4,3,2,1,0. The auto start setting in this figure
(find it yourself!) has to be set to true.

Q.24
What do you observe on the scope when you run this VI?

Since the total duration of the waveform on the scope is 1ms, you might need to adjust the time
base of the scope, and configure the trigger level properly. Remember what the trigger is? The
trigger sets the point where the scope starts plotting the voltage you have to set at least the
level and whether the scope needs to start when the voltage has a positive of negative slope at
that voltage.

Q.25
Now decrease the rate to 10. You should in theory observe the same waveform, but its
completion should now take 1 second (adapt the time base of the scope accordingly). Do
you still observe the same waveform? If not, what do you observe?

After completing the code, LabVIEW stops the scheduled task immediately, resetting all the
hardware. In the code depicted in Figure 17, this happens irrespective of whether the hardware
actually completed writing the full array to the analog output. In the DAQmx subsection of the
function palette, in fact in the subsection where you found the other DAQmx sub-VIs, there is
another sub-VI that solves this problem.

Q.26
What is the name of this sub-VI? Find it, include it in your code (where?), and check
whether it actually works.

Have you already used the possibility to include comment in your code? The yellow boxes in
Figure 17 are just that. Double click on an empty piece of block diagram to make one.

21
The similarity with the 20MHz limit of the Tabor is most likely coincidental; the
microelectronics used in both pieces of hardware is not fully disclosed.
Figure 17: Finite N points output.



20
Basic Plotting: Waveform Graph
Visualizing the staircase waveform on the scope is a useful tool to check the behavior of your VI,
but it would be convenient if you can plot simple graphs directly, inside LabVIEW. This option is
indeed available: place a Waveform Graph on the front panel and hook up the staircase array to
it. Running the program will not show a staircase however. Right click on the control box at the
top right corner of the graph display (with Plot 0 inscribed) to find a menu where you can change
the appearance of the plot.

Q.27
Change the settings of the Waveform Graph in such a way that you see both the actual
datapoints, and a real staircase. Print this graph and include it in your report.

Important remark on using the printer:
In order to save the toner in the cartridge, make your graphs small. A convenient way of
copying and printing graphs from your VI front panel is using Print Screen. Paste the saved
picture from a buffer into MSWord document window by pressing Ctrl-V. Adjust the picture
(crop, size) by using Word Picture tools. You can put several pictures on a single page. Print the
page via the printer on the 4th floor (studprn3).
Data Types: Clusters
In order to transfer more than a single data type on a single wire, you can use the Cluster data
type. Apart from being optically neat, it can also be convenient to create special purpose custom
data types. One example of that is the Error Cluster of which a connection can be found on most
advanced sub-VIs you have used. Connecting these properly throughout your program is not
required but can be really helpful when debugging your program. The error cluster contains a
Boolean that is true whenever an error occurred, an integer as an error code, and a string constant
for some basic error explanations. More extensive explanation of error numbers is available via
Help|Explain Error in the program menu. Usually that help also indicates where the error
occurred.

Q.28
Which three types of cluster bundling sub-VIs exits? Where can you find them?
DAQmx Continuous Output
The output types encountered above are limited to the extent that one is limited to low output
rates, or to the use of increasingly larger arrays to write data for longer periods at high rates. As
an example: if you want to output a sine wave of changing amplitude at 20kHz for a few days, you
would need around 10
8
data points in your array. To avoid working with these impractically large
numbers, there is a way to write data to the analog output in a streaming way. The technique
employed is similar to the one used in Youtube video streams. Instead of directly streaming data
from the server to your monitor, a virtual buffer is created, which is continuously filled with new
videodata from the Youtube server. After a short delay, these data are also continuously written to
the monitor. This method of data streaming can make the data stream to your monitor insensitive
to small fluctuations of data influx from the server into the buffer, and that is precisely what is
necessary: the video should run smoothly on your screen irrespective of (small) network
interruptions. In the LabVIEW context one would say that LabVIEW cannot directly supply a
DAC element at say 1MHz with data, but it can write bursts of data (say 1000 points) every
millisecond or so quickly to a virtual buffer. If then the hardware on the card makes sure this
buffer data in transferred at a constant rate of 1Mhz to the DAC (and from there to the output
port), the effective, averaged influx and efflux of data to and from the buffer is 1 million data
points per second: the buffer will never be empty, and it will also never be full!


In Figure 18 you can see code that might give you the desired continuous output of an array. The
little sub-VI with the word status inscribed is a cluster unbundle VI that you have seen before, if



21
you answered Q.28. In fact building this VI will not give a broken Run button. Running it
however will result in an error and will stop the loop after one iteration.

Q.29
What is the problem? Find it out with the error cluster. In which iteration of the loop does
it occur? How can you solve it?

Q.30
If you use the staircase array described above as output array, and if you configure the
trigger on the scope properly, you can find out what the slewrate of the DAC is. Is this in
accordance with maximum output rate you found in the datasheet [E]?

Two useful notes on using LabVIEW: Ctrl-B erases all broken wires on your block diagram. In
the Edit menu you can find the option Make all current values default that setting saves the
current settings for all input and output variables of the current VI, so you dont have to insert
them again the next time you start LabVIEW.

You can also solve the problem you found in the code from Figure 18 also in a different way that
reveals slightly more about the functioning of the DAQmx software-hardware interaction. In the
DAQmx subsection of the function palette, there is a subVI called DAQmx Start Task, and
obviously when the auto start option on the DAQmx write sub-VI is turned off, this is the VI to
use instead. The only minor difficulty is that you have to call this sub-VI only in the first iteration
of the while loop. This can be done with LabVIEW functionality introduced in the next section.
Case Structure
The switch-case statement in C++ has an equivalent in LabVIEW: the case statement. This
functionality can be found in the subsection of the functions palette where the for- and while loop
are located. By default it selects the case to apply on the basis of the value of the Boolean you wire
into the box with the question mark inscribed, but you can modify the structure to work with
integer ranges too. Examples a and b in Figure 19 therefore have the same functionality.
Coincidentally in this figure you can immediately see how to implement the DAQmx Start Task
sub-VI.

Q.31
Figure 18: Continuous N points output.



22
What do you have to do to the False or 0-cases in order to make the case structure
work?
A LabVIEW Function Generator
You should now be able to build your own LabVIEW function generator, with a similar or even
more extensive functionality than the Tabor has.

Q.32
Make such a function generator, and print its block diagram. It should be able to give
sine, triangle and square waves. Make sure the amplitude and phase can be modified
easily from the front panel. Can you now audualise a square- or triangle wave (be careful
not to destroy the speaker with too large amplitudes)?

Note: there are sub-VIs that can generate arrays filled with sine, triangle and/or square wave
signals. Find them by using the search. And again: save the VIs you make for future reference.

Q.33
You can customize and beautify the front panel to a large extent. Try to build a user-
friendly interface for your function generator [E].

Please be aware of the fact that the rate at which you fill the buffer with data that are to be written
should be, on average, equal to the rate at which these data are transferred to the DAC and
written to the output port. If you are too slow writing samples, the card will start to write old
samples to the DAC. If you are too fast, the card will not be able to generate the waveforms you
want it to generate. Note that you will be able to see that this happens by monitoring the error
cluster.

LabVIEW determines the size of the buffer automagically with the samples per channel control
on the DAQmx Timing sub-VI. If you encounter problems with the buffer, you might want to do
that yourself; this is possible by using the Buffer Property Node. Do not however revert
Figure 19: Case structures.



23
immediately to this rather involved way of solving DAQmx problems before consulting one of
the course assistants.



24

Single Point Input
In the previous sections you have seen how to build your own function generator, the Tabor
functionality so to speak. The functionality of the oscilloscope, in other words the input
functionality, can also be implemented with by the 6014; it is an I/O card after all. Fortunately the
software structure of data acquisition is very similar to that of data writing. It will not surprise
you then that Figure 20 represents code that enables you to read a single voltage value on input
port AI0. One important setting is the maximum input voltage the hardware can read; make sure
you set it to +/- 5 or 10V. This input limitation can be set on the DAQmx Create Virtual Channel
sub-VI.
Multiple Point Input
Knowing how finite N point writing works immediately tells you how to generalize the code above
to finite N point data acquisition.

Q.34
Build this N-point data acquisition LabVIEW code, based on Figure 20. With this code
you acquire a single buffer of size A at rate B. If the rate is low, the default timeout (10
seconds) setting on the DAQmx Read sub-VI might be too small. Implement a solution
to this problem. Include a print of your VI in your labjournal.
Continuous Input
As is the case for writing data to an output, you cannot use the multiple point acquisition code for
both long and fast data acquisition. You could insert the whole single- or multiple point
acquisition code in a for- or while loop. Schematically that would create reading schemes as in
Figure 21 a) and b). You can see that these reading modes are slow and impose only limitedly
strict timing on the acquisition. The constants N and t
r
in this figure can be set by the user.
Figure 20: Single point read.
Figure 21: Reading modes: a) single point acquisition, b) single buffer read, c)
continuous read. N is the number of samples, ti is the time between two executions
of the code, tr is the rate at which data is acquired.



25

Q.35
With which inputs on which sub-VIs can one control the two variables N and
r
?

t
i
Depends on other factors you do not have explicit control over. Examples are the background
processes running on the computer, and, in case you execute the single point acquisition or the
single buffer read in a while loop, on the other things you execute in the while loop. Figure 22 is
by far superior to the solutions mentioned above. Be aware however that it is not always necessary
to implement continuous reading. If reading speeds are of the order of 100 Hz or slower, a while
loop with single of finite N-point input will suffice and is far easier to implement, certainly in
combination with the possibility to create your own sub-VI that will be introduced below.

Q.36
Build the code shown in Figure 22. What happens when you disconnect the number of
samples per channel on the DAQmx Read sub-VI? Explain this by using the help, or
even the advanced help.

Q.37
You can also measure the voltage on two ports simultaneously: simply enter Dev1/ai0,
Dev1/ai1 in the channel constant and modifying the DAQmx Read sub-VI setting to
NChan NSamp will do the trick. What type of output from the read sub-VI does this
generate?
Continuous Input: Details
The continuous input code for you most likely contains some mysterious settings. One of them is
probably the input terminal configuration. This nontrivial setting has to do with the fact that you
usually (this depends on computer settings which sometimes get messed up) by default measure
the potential difference between the input port and the ground of the I/O card, the Referenced
Single Ended (RSE) setting. Now in some applications the ground of the I/O card (the reference)
and the ground of the source of the voltage (e.g. a force sensor or light meter) you measure are
only connected via some convoluted and remote ground loop. This loop will pick up the 50Hz
electromagnetic field that permeates all modern living areas since it originates from power lines
(in the US this would be 60Hz). You will see that as a 50 Hz ripple on your signal. Try to use a
NRSE or differential measurement instead (they are identical for single input acquisition). If your
measurement circuit is not properly connected, you can also end up measuring the potential
difference across loose connectors, basically a capacitor of fluctuating capacity and charge
content: any sort of noise (spikes, drift) can be expected in that case.

In short: if you encounter 50Hz noise or intermittent noise with no obvious source, check the
grounding wires and settings. Consult an assistant if you cannot solve the problem yourself, but
Figure 22: Continuous input.



26
sometimes grounding problems seem to defy logic; dont be surprised if finding the source of the
noise takes some time.

The other perhaps surprising thing is the location of the DAQmx Start Task sub-VI. In the
DAQmx writing protocol, this sub-VI was optional in the first place (now it is required), but is
was also executed after the DAQmx Write sub-VI. To explain the logic behind this change of
order, take a look at Figure 23. If you follow the order in which the write-protocol is executed,
you start at the top of the left stack at the LabVIEW code, where the value for output voltage is
determined. After that has happened, this voltage value is transferred to the buffer by the
DAQmx Write sub-VI. After that, the digital value can be transferred to the DAC, where it is
converted to an analog signal. The transfer to the DAC is initiated, roughly speaking, by the
DAQmx Start Task sub-VI. Then the reason for the reversal of the order of the Start and Read
sub-VIs is obvious: since the Start sub-VI operates between the ADC in this case and the buffer,
this sub-VI has to be executed first, otherwise there is no data to be read from the buffer, which is
what DAQmx Read will try to do.


If every while loop iteration in the code from Figure 22 takes too much time to complete, you
might be reading data from the buffer slower than the buffer is being filled up. This can result in
data loss, and is undesirable. You can however observe that this happens (at high sample rates,
say 100k, and a small samples per channel setting, e.g. 1) by creating an error indicator
connected to the DAQmx read sub-VI. Figure 19 even shows how to make sure the program stops
working in case such an error (or any other error) occurs.

Q.38
Which error number occurs when you read too slowly? Which solutions are suggested?

You found out earlier in this practicum that the I/O card you are working with actually has 16
channels, and it might just happen that you want to read two independent signals simultaneously
via the channels. This is possible with the VI you just made, and can be done by Analog|Multiple
Channels|Multiple Samples from the drop-down menu on the DAQmx read sub-VI. Currently
this will not be necessary, but for Practicum 3 you might want to do just that.
Figure 23: LabVIEW I/O structure.



27
Automated Data Storage
LabVIEW also enables you to store the numbers you measure in your experiment in a text file by
using the sub-VI File I/O|Write To Spreadsheet File. This technique is usually an indispensible
tool (whether you use LabVIEW or some other language), since permanent storage of
measurement results allows for post processing and (re)interpretation of results. Storing (large
amounts) of measurements results efficiently in such a way that they are still recoverable after a
certain amount of time is an art (and also involves a proper use of your labjournal), and having
some proficiency in it can make a real difference. Anyway, you can find this VI in the functions
palette under the icon with the floppy (if you still know what that is). Note that this sub-VI
requires a data type called Path to know where to create the data file itself. This data type is
introduced below. You can create a control for this input for now.

Q.39
If you write a one dimensional array with numbers to a file, will the Write To
Spreadsheet File sub-VI by default write this to a file as one long column with numbers,
or as a long row? How can you modify this?
Data Types: Paths
You have just seen the data type Path being introduced. Earlier in this practicum you made a VI
in which you concatenated different (sub) strings into one long string containing a full path. This
string can be converted into a path with a standard sub-VI depicted in Figure 24. After this
conversion it can be wired to the spreadsheet write (and read) sub-VIs.

Automation in data storage is, apart from being convenient, also useful to append references
information consistently to data files. You can for example automatically append measurement
parameters (a date, temperature, et cetera) or a unique reference number to the name of the
data file.

Q.40
Include the string to path conversion in the string-path creation program you made
earlier. Print this in your report.
Check the 5V Voltage Source
The I/O card you have also features a 5V voltage source. With the continuous input program you
have (check the input limits!), you can monitor whether this voltage actually is equal to 5V or
whether it fluctuates a bit over time.

Figure 24: String/Array/Path conversions.



28
Q.41
Measure the 5V voltage source for at least 10 seconds at a sampling rate of 10kHz. Store
the measurement data in a single, long column on your hard drive, and plot this data with
Origin or Excel. Include this plot, with proper labels on the axis, in your report, together
with a print of the block diagram of your program.

The default number of significant digits LabVIEW uses in writing numbers to a text file is three.
For Q.41 this might not be sufficient.
ADC Limitations
The analog to digital converter on the I/O card has a limited resolution. You have probably seen
in the datasheet that the card has a 16 bit ADC, but what does that mean? Check the DAQmx
Create Channel sub-VI in, say, Figure 22. That sub-VI has inputs for the minimum and maximum
value that can measured on the configured input ports
22
. The total analog measurement range is
then divided into 2
16
-1 discrete bins. A voltage to be measured is then rounded off to the nearest
bin delimiter; that will then be the digital value of the analog signal. That determines
23
the
resolution.

Q.42
Visualize the bit-levels by performing a continuous measurement, with the input and the
ground shorted. Plotting the data on a Waveform Graph that is acquired thus reveals the
bit levels, and the Gaussian noise around zero. Print this plot, and include it in your
report.
Custom Sub-VIs
As with other programming languages, it can be useful to build your program from small sub-
programs. This will make the eventual code neater, easier to debug, you can use the functionality
from the sub-programs multiple times without copying the actual code, and you might even be
able to re-use the sub-programs in other/future applications as well. If you are for example
required to make a program that includes measuring, say, a temperature every 10 seconds, you
might want to build the DAQmx structure into a single sub-program, or rather sub-VI as it
should be called of course.
The Temperature Converter
Open a new, blank, VI to make a sub-VI you can use later on in Practicum 2. This VI should be
able to convert any temperature in Fahrenheit, Celsius or Kelvin to all these three different
temperature standards. So it should be able to return the Celsius and Kelvin equivalents of 90F,
but also the Celsius and Fahrenheit equivalents of 923K.

Q.43
Build this functionality. Note that this sub-VI should be able to accept any temperature
standard as input, and regardless of the input also convert it into the remaining two.
Include the block diagram of this program in your report.

The default values appearing in the controls and indicators when you open a program can be
modified: fill in the desired default settings into the controls, go to Edit|Make current values
default, and save your (sub-)VI.


22
It can change these limits by dynamically amplifying the real input signal after which the
amplification factor is divided out again.
23
Naturally if you set the limits to 1nV, the ADC wont be able to measure a pV; there is a natural
noise floor for this ADC (you can find that in the datasheet too). In typical LabVIEW applications
though, you will not encounter this hardware limitation.



29
The program you have made should have at least two (temperature and type), but possibly three
inputs and at least two outputs, possibly three. This program can now be made into a sub-VI. To
do so, you have to define what the in- and outputs are of this sub-VI. This can be done on the
front panel: right-click on the icon in the upper-right corner of the front panel-window, and select
Show Connector. You will probably see something like Figure 25.


Now all these little squares and rectangles can become in- and outputs, but now there are too
many of them. In order to get a connection scheme with the desired amount of in- and outputs,
again right-click on this connector-scheme, and go to Patterns and select the appropriate
connection scheme. The convention with these connectors is that you connect
24
the inputs to the
left, and the outputs to the right, since LabVIEW operates code from left to right.
Using Custom Sub-VIs
To use the custom sub-VI you just made, open a blank VI with Ctrl-N and choose Select a VI
from the functions palette. Now open the VI you just made. It will appear as an icon with an in-
and output on the block diagram. Create controls and indicators for your custom sub-VI, and test
it.
Data Types: Waveforms
A data type you will have encountered already but most certainly will encounter in the near future
is the Waveform. A Waveform is actually a cluster in which a signal (e.g. measurement data) in
an array is accompanied by timing information
25
. This timing information consists of the time
step between two elements of the array, in other words, the inverse sample rate. It also includes
the precise starting moment (with day, month and year) of the signal in the array. The Waveform
data type is important enough to have its own subsection on the functions palette.
Measurement & Automation Explorer
On the desktop of your PC you should be able to find the icon depicted in Figure 26. This program
allows you to check the available hardware on your PC, and run some diagnostic tests on it. Run
this explorer, and expand the My Sytem|Devices and Interfaces|NI-DAQmx devices section.
Here you should click on the NI PCI-6014: Dev1. Open the Test Panels and select the Analog
Input tab.

24
Hover over a connector, and click on it with the bobbin. The connector will become black, and
the pointer will remain a bobbin. Click with this bobbin on the control or indicator in your front
panel you want to connect the terminal to, and you will see that the rectangle assumes the color of
this control.
25
It can also include information in Attributes, but that is beyond the scope of this manual.
Figure 25: Default connection pattern.
Figure 26: Measurement & automation explorer.



30


Q.44
Can you explain which reading modes are available under Mode [E]?


Property Node
The looks and settings of objects on the front panel can be customized, even during the running of
the program. To do this one needs to create a Property Node for the object one would like to
customize. This can be done in the block diagram by right-clicking on the icon representing the
object to be customized. You can select the property to be changed in Create|Property Node.
Note that this affects mostly the looks of your program, and is seldom necessary to change
functionality.

RS232 Communication
Suppose now that you want to measure a signal that contains relevant frequency components of
up to 10 MHz. The I/O card you have cannot measure these frequency components, since its
maximum sample rate is 200 kHz. The solution in this case can consist of using the Tektronix
oscilloscope. This scope (as most of its more modern relatives) features an extension module via
which it can communicate with a PC. Although nowadays USB connections become more and
more standard, the RS232 connection you find on the back of the scope can still be found on
many devices. The connector (the 9-pin sub-D connector) is still available on much equipment,
and most PC motherboards feature this communication port as well.

Q.45
Try to figure out how to communicate with the scope over the RS232 port. Hook it
directly to the Tabor and try to measure a sine wave with a frequency of 1 MHz
automatically [E].








31

Practicum 2
Introduction
The goal of this experiment is to build a LabVIEW-driven temperature control system, which
regulates the temperature of a small block of copper. The electronic parts of the system are
sketched in Figure 27, where the small block of copper is incorporated in the heater in the lower
right-hand corner. The complete system uses a temperature sensitive NTC resistor as a
temperature sensor, a simple heating resistor as a heater and a combination of ADC & DAC & PC
for the electronic feedback.


Theory
Figure 28 presents a very simple model for the thermal management in the system (copper
block). Energy can be fed into the system with a heating resistor that generates a heating power P
[W]. Energy leaks out of the system through thermal contact between the system and the
environment (thermal bath). Two parameters determine the temperature dynamics of this
system: (i) the systems heat capacity C [J/K], which quantifies the thermal energy increase per
Kelvin, and (ii) the thermal conductivity [W/K] between the system and its environment, which
quantifies the energy leak between system and bath per Kelvin temperature difference. With these
parameters in mind it is relatively easy to write down the time evolution of the systems
temperature as

where T
0
is the temperature of the environment (thermal bath).

I
PC
DAC
NTC
Cu
HEATER
( ),
0
T T P
dt
dT
C =
Equation 1
Figure 27: Experimental setup: DAC - Digital-to-Analog
Converter, I - Buffer Amplifier, ADC - Analog-to-Digital
Converter, Cu - Copper Block, NTC - Negative Temperature
Coefficient Resistor (temprature sensor).



32


At constant heating power P the solution of this differential equation is found as


where T
EQ
= T
0
+ P/ is the equilibrium temperature (at t - ) and T = T
0
T
EQ
, = C/ is the
thermal time constant. The temperature dynamics of this system is quite simple: the equilibrium
temperature T
EQ
of the system is P/ higher than that of the environment (T
0
) and the relaxation
of the system to any new equilibrium temperature is exponential with a time constant .

Q.46
Verify that Equation 2 solves Equation 1 and the expressions for T
EQ
and are correct and
have proper dimensions.

In practice the system might of course deviate from this simple system in several ways. The
temperature might not be completely uniform over the system and there will probably be some
time delay between the application of a heating pulse at one end of the system, and the
temperature rise observed with a sensor at the other end. The thermal contact between the system
and its environment might be more complicated then sketched in the model, which assumes that
the bath remains at a fixed temperature and must therefore be infinitely large. As a practical
example of the latter complication we note that the large white plastic box which supports the
copper system, might also heat up. In principle, one can model the temperature of this white
plastic box in a similar way, introducing a second heat capacity and thermal conductivity (now
between plastic block and larger environment). This type of modelling, however, goes way beyond
present needs. The point here is to develop a feedback/control circuit that, regardless of
subtleties, keeps the temperature constant.
Basic Digital Feedback Mechanisms
Feedback is a process whereby some proportion of the output signal of a system is passed (fed
back) to the input. Often this is done intentionally, in order to control the dynamic behavior of the
system.
The importance of the feedback in our daily life can be illustrated by a vital example a man
driving a car to some destination. Without a feedback system, provided by the mans eyes and his
( ) t T T t T
EQ
+ = exp ) (
Equation 2
Figure 28: Temperature dynamics of a simple system.



33
brain, the result would be disastrous: its almost impossible to predict uncontrollable external
influences like pedestrians, other cars, traffic lights etc. before the trip in order to overpass them.
The eyes as a comparator and the brain as a processor provide an indispensable feedback
assisting a successful arrival. Feedback can called positive or negative; this depends on the sign of
the response to the feedback. Positive feedback increases the quantity measured in the feedback
loop.
The basic idea of any electronic feedback system is the following. Suppose you want to control a
temperature T(t) and keep it at some fixed set-point T
S
. The first step is to compare these
temperatures and calculate the error signal e(t) = T(t)T
S
. The second step is to choose an
algorithm, the details of which are given below, that uses this time-dependent error temperature
e(t) to calculate the amount or feedback y(t) needed for quick reduction of the error voltage to
zero. The third and the last step is to apply this feedback under the usual assumption that the
system responds linearly to this control via dT(t)/dt = y(t).

Q.47
What type of the feedback will you use in the experiment positive or negative?

Systems which include feedback are prone to hunting, which is oscillation of output resulting
from improperly tuned inputs. If the input changes faster than the system can respond to it, the
negative feedback signal begins to act as positive feedback, causing the output to oscillate. To
avoid such problems, a wide range of feedback algorithms has been developed:
Proportional Feedback
P-control
Proportional feedback handles the present state of the system. The feedback signal y(t) is linearly
proportional to the error signal at every moment, with a dimensionless coefficient K
P
:

For our specific case the feedback signal is the power P(t), which we apply to our system:


Here is the thermal conductivity, necessary to get the units correct. The main advantage of
proportional or P-control feedback is its simplicity. The main disadvantage is that this type of
feedback can never reduce the error signal to exactly zero.

Q.48
Why not? Hint: solve Equation 1 assuming, that the heating power P changes linearly
with temperature (Equation 4). You can then reduce the acquired equation to the already
known one (Equation 1) via redefinition of some constants.

One can of course make the residual error signal smaller by increasing the proportionality
constant K
P
, but if you increase it too much the control system will become unstable and start to
oscillate. The main reason for this behavior is the presence of unavoidable time delays between
the temperature measurement and the heating response at that same position.
Integrating Feedback
I-control
This feedback handles the past of the system and the feedback signal depends not only on the
instantaneous error, but also on the past error values. The error is integrated (or
averaged/summed) over a period of time, and then multiplied by a constant K
I
:
( ) ( ) t e K t y
P p
=
Equation 3
( ) ( ) ( )
S P
T t T K t P =
Equation 4



34


The expression for heating power P(t) can then be given in a form of:

The main advantage of integrating feedback is that it has a memory of past perturbations and in
principle controls the system convergence to zero error signal.

Q.49
Why? Hint: Equation 1 with the heating power of a form Equation 6 can be reduced to a
second order differential equation for which it can be shown that its solution (T(t) T
S
)
approaches zero when t ).

This memory is at the same time a disadvantage, as it reduces the control speed; the low-
frequency fluctuations are much better controlled than the high-frequency ones.
Differential Feedback

D-control
This type of feedback handles the future, the first derivative of the error (its rate of change) is
calculated with respect to time, and multiplied by a constant K
D
. The differential term y
D
(t)
increases the feedback strength of high-frequency fluctuations and it makes the control more
susceptible to noise:

Which is equivalent to the following discrete representation of the time-derivative less sensitive
( )
i
t e to noise:

Combined feedback mechanisms

Proportional & Integrating Feedback
PI-control
This is a very popular control algorithm, which uses the combination of P- and I-controls:

( ) ( ). ' '
0

= =
i
i I
t
t
I I
t e K dt t e K y
Equation 5
( ) ( ) [ ] ( ) [ ]. ' '
0

= =
i
S i I
t
t
S I
T t T K dt T t T K t P
Equation 6
( )
dt
t de
K y
D D
=
Equation 7
( ) ( ) ( ) [ ] ( ) ( ) ( ) ( ) [ ] 6 3 3
3 2 1 1
+ = =
i i i i D i i D i D
t e t e t e t e K t e t e K t y
Equation 8
( ) ( ) '. '
0
dt t e K t e K y
t
t
I P PI

+ =
Equation 9



35

It combines the response speed of proportional feedback while its error signal does decay to is
zero. There is another (more physical) parameter to quantify the relative strength of the
integrating feedback (K
I
) as compared to the proportional feedback (K
P
). This parameter is called
the effective integration time t
I
= (K
P
/K
I
) and it equals the time it takes the integrating control
to build up to the same strength as the proportional control (at fixed error signal). In terms of this
parameter the PI feedback is:

Its important to note that the strength of the integrating feedback is not only proportional to K
I
,
but is also inversely proportional to the sampling time t
S
. More sample points per unit time will
increase the integrating feedback y
I
(t). Being applied to our system the expression for PI feedback
power is then:

where the thermal conductivity is incorporated into K
P
. You will use Equation 11 as a basis for
our feedback scheme. However feel free to make your VI more advanced and use PID-control,
which will be discussed below.

Proportional, Integrating & Differential Feedback
PID-control

PID control is the most advanced algorithm, combining all the tree controls we have considered:

Figure 29 shows the typical time traces of three controlled systems and summarizes their
differences. For P control the equilibrium does not correspond to the set-point. In theory, the
evolution towards this equilibrium should be a simple exponential decay. In practice some
overshoot can occur due to time delays between sensor read-out and actuator response. PI control
is better in the sense that the equilibrium does correspond to the set-point. Theoretically, this
equilibrium is reached after a damped (or possibly overdamped) harmonic oscillation. PID
controls can potentially be faster, albeit somewhat more noisy.

( ) ( ) . '
1
0

+ =

dt t e
t
t e K y
t
t I
P PI
Equation 10
T
T
S
t
T
T
S
t
P
T
S
Figure 29: Typical time traces for real P, PI and PID controls. TS is the set-point temperature.
( ) ( )
( )
. '
0
dt
t de
K dt t e K t e K y
D
t
t
I P PI
+ + =

Equation 12
( ) ( ) [ ] ( ) ,
0

+ =

=
t
t
S
I
S
S P
T t T
t
t
T t T K t P
Equation 11



36


The Physics of NTC Resistors
How can you measure a temperature electronically? The temperature sensor you will be using is a
so-called NTC resistor, where NTC stands for Negative Temperature Coefficient and refers to the
fact that the resistance of such a device depends on its temperature, the relation having a negative
coefficient; the resistance drops as the temperature increases. This decrease is quite rapid (the
resistance decreases typically by as much as 4% per degree Centigrade), making these sensors
ideal for accurate temperature measurements. An NTC resistor is nothing more than a piece of
semiconductor material with a bandgap that is small enough to allow for thermal excitation of
some of the electron from the valence band to the conduction band, or (equivalently) for the
thermal excitation of electron-hole pairs. When the temperature rises, the number of thermally
excited electron-hole pairs will increase and the resistance goes down, thus explaining the name
NTC. The conductivity of a semiconductor (proportional to the number of electrons in the
conduction band) follows an exponential law: =
0
exp(W/2k
B
T), where W is the band-gap
energy, k
B
= 1.3810
23
J/K is the Boltzman constant, and T is the temperature (in Kelvins),
respectively. The resistance therefore follows an inverse dependence and you can write R
NTC
as in
Equation 13:
where T
C
is related to the band-gap energy W and R
0
is the resistance at some reference
temperature T
0
. Our NTC resistors are specified for T
C
= (3528 18)K and R0 = 1.0k at T
0
= 25
o
C.
T, C R, Om
15 1508,4
20 1223,9
25 1000,0
30 822,5
35 680,9
40 567,0
45 474,9
50 400,0
55 338,6
60 288,1
65 246,3
10 20 30 40 50 60 70
100
200
300
400
500
600
700
800
900
1000
1100
1200
1300
1400
1500
1600
R, Om
T,
O
C
70 211,6
R,
Figure 30: NTC resistance versus temperature.

=
0
0
exp exp
T
T
T
T
R
T
T
C R
C C C
NTC
Equation 13



37
Based on these values you can calculate a reference table for NTC resistance versus temperature,
and plot the exponentially decaying function. These two are shown in Figure 30.
In the experiment, the NTC resistance R
NTC
(and the associated temperature T) can be determined
from the voltage over the NTC resistor, measured by a PC trough an ADC converter. The NTC
resistor is plugged into the circuit, consisting of a fixed resistor R
1
= 1k and a 5V power supply
from an I/O card.

Q.50
Derive the expressions for the voltage U
NTC
on the NTC resistor versus its temperature T
and vice versa, i.e. T(U
NTC
). Hint: use the expression Equation 13 for NTC resistance
versus its temperature R(T), consider the Ohms law for circuit on Figure 31 and find the
voltage drop U
NTC
on the NTC resistor. Write the derived formulas in your Lab Journal.
These conversion formulas will be necessary while building up the VI in LabVIEW.

The Heating Device
As heating device we use a simple high-power resistor (R
H
22 at room temperature) that is
driven directly from DAC via the buffer amplifier (up to 1A in the voltage range of 10 V). Such a
buffer amplifier is needed because the DAC, just like the Tabor you have seen before, cannot
supply more than 5 mA of output current. The dissipated power is equal to P
H
= (U
DAC
)
2
/R
H
. At
the maximum DAC output of 10 V about 4.55 W is dissipated. The quadratic relation between the
dissipated power P
H
and the regulating voltage U
DAC
has, of course, consequences for the
regulating feedback loop that you want to construct.


R
1
=1 kOm
NTC
R
V
5V
PC ADC
Figure 31: NTC resistor connection.



38
Experiment
Precautions
It is important to make sure that the system (Heater + Cu block + NTC resistor) is not overheated
and thus damaged. Overheating can occur when, for example, a nonzero voltage is sent to the
heater and the code (your VI) crashes the heater keeps going then. Check that the Cu block
doesnt get too hot and include the overheating protection into your VI. The maximum
temperature for the system is 55
0
C. If you are not sure of what you are doing, hook up the output
of the DAC to a scope to monitor the voltage directly. Calculate the maximum voltage on the the
NTC then for a double safety measure.
Hardware
The experimental setup (Figure 32) consists of the following elements:
Connection Box, comprising DAC output, ADC input and +5V power source.
Current (buffer) amplifier with banana-type In-Out sockets.
Heater + Cu block + NTC resistor and fixed 1k resistor R1 (see Figure 31), assembled in a
single box.
PC, plugged to Connection Box, with LabVIEW installed.

Connect the output of the DAC (AO0 Analog Output 0) to the input of the buffer amplifier
keeping in mind the polarity the banana plug ground should be connected to the black socket.
Set the DAC AO0 voltage to 0 volts you dont want to start heating immediately. The output of
Connection Box
(ADC & DAC)
to PC
In / Out Ground
Out
In
Current
amplifier
Heater
ADC +5V DAC
R
1
Cu
NTC
+5V
oo o
AI0 AO0
RED
BLACK
Figure 32: a) Connection scheme; b) BNC-to-banana adaptor
connection: ground should be plugged into a black socket.



39
the buffer amplifier is connected to the heater input. Connect the NTC resistor output to the AI0
(Analog Input 0) on the Connection Box. Finally, connect the +5V output from the Connection
Box to the NTC resistor circuit (BNC input on the box).

Compare your connections carefully with those depicted on the Figure 32, dont mix up the +5V
input with NTC resistor output the NTC can easily be burned. Show your setup to an assistant
before plugging +5V to the circuit.
Thermal Response Time
Before building your VI you have to know what sort of timescales you expect in the temperature
dynamics: this timescale determines what type of DAQmx measurement system (continuous,
single point, et cetera) you can or must use. What you have to estimate is the sampling time t
S
.
Make a reasonable guess for the sampling time based on how quickly you expect the system to
heat up under maximum heating
26
.

You can actually check the thermal time response of the system. For this purpose you have to
monitor the temperature over an extended period of time (say 20-25 minutes), and you have to be
able to plot the change in temperature afterwards. You must monitor the temperature excursion
under three consecutive conditions.

Monitor room temperature T
0
: heater OFF (~1 minute).
Measure speed of heating up: heater ON at constant voltage (set it to heat at 5V) (~10
minutes). Wait until the temperature stops noticeably increasing, i.e. until T ~ T
EQ
.
Measure speed of cooling down: heater OFF again (system cools down) (~10 minutes).

The system should settle at a constant value below the maximum temperature; if not set the
heating voltage lower to say 4V.

Software
Now write a VI that monitors the voltage U
NTC
(t) and corresponding temperature T(t) over the
NTC. You can use an Expression Node to implement your conversion formula between the
voltage and temperature. Put four digital controls on the front panel to set up the:

sampling rate (1/t
S
).
set-point (required) temperature T
S
.
strength K
P
of the proportional feedback term.
the effective integration time t
I
.

In order to preserve the Heater + Cu + NTC assembly from overheating (and possible breakage)
while the VI doesnt run, add a special control to your VI, which stops your VI via button on the
front panel, preliminarily setting the heating DAC voltage to zero. Derive the instantaneous error
temperature e(t
i
) = [T(t
i
)T
S
], by subtracting T
S
from the measured NTC. With these ingredients
you are ready to write the PI control that calculates the required heating power P(t) with this
error temperature, in combination with the feedback parameters K
P
and t
I
.

A few points tips and points of concern:

Realize the program with single point input first you can always make it better later.
Since feedback is of course not necessary for the thermal response time measurements,
first make a program that allows you to check the thermal response time. Only then add

26
You should estimate this by calculating how fast the copper element would heat up if it did not
loose heat to the environment; look up the heat capacity of copper and estimate the total volume
of the copper element. An order-of-magnitude estimate will suffice here.



40
the feedback breaking up the development of your code in this way makes building it
easier.
The calculation of the heating power involves quite some constants. It is convenient to do
this calculation in a Formula Node.
If you try to write more then the maximum output voltage to an output port, the DAQmx
sub-VIs will return an error. Include this restriction in your VI.
Note that negative voltages will also heat up your system! Active cooling is impossible in
this system
27

You might want to monitor the heating voltage, temperature and other variables directly,
and while you are measuring, in a graph. If so, make sure you call a Waveform Graph
you use to plot data from inside the while loop.
It might be convenient to start using the automatic data storage capabilities in LabVIEW;
you will need to analyze measured data after the actual acquisition has taken place.



Does the system heat up and cool down exponentially with time? If so, what is thermal response
time of your system? Using the acquired time traces of the system dynamics (temperature) and
measured values of T
0
and T
EQ
to determine the system thermal time constants for heating-up (
+
)
and cooling-down (

). You can do that by determining when the difference temperature (T)


increases/drops by factor e (Equation 2), or, when you have access to the data via Origin, by
fitting. Knowing these two time constants, do they compare well to the time constant you
estimated before?
Temperature control with PI feedback
By now you have a PI control system that can control the temperature of the copper element. It is
now time to optimize the values of the two free parameters in the theory.

Optimization of the feedback parameters
Optimization of the feedback parameters of a PI control requires some skill. A standard trick to
find the limitations of system & control is to search for the feedback constant K
P
= K
O
at which the
temperature of the system just starts an undamped oscillation under proportional feedback only
(K
I
= 0 or t
I
= ). As a rule of thumb, the optimum parameters for stable PI control are now
roughly K
P
K
O
/2 for the proportional term. t
I
Can be determined from the oscillation period of
the unstable system you just found at K
O
. Include several temperature measurements over several
oscillation cycles, recorded at different K
p
, and indicate which K
p
is the best.

Optimize the control system, with the protocol described above. Include time traces in your
labjournal of the temperature excursion for a few different K
P
. Determine the optimum value for
PI control K
O
from these data and mention what criteria you used to select this value.

Check how well the optimized feedback scheme controls the temperature and protects it from
external influences like air currents (e.g. blowing). Perturb the system, record a time trace and
include it in the labjournal.

If you still have time left, dress up the temperature control in any way you find suited. Choose
one, some or all from the following list:

Include differential feedback to make it a PID instead of a PI control. In principle, this
could speed up the control, but also makes it noisier.
Include averaging: measure much faster than the thermal response time and average the
measured temperatures to obtain a more accurate signal.

27
Unless you get a Peltier cooler!



41
You might have measured the actual value of the 5V line used in the NTC circuit: the 5V
drifts and is actually not 5V. This affects the temperature reading. You can correct for this
when you measure the 5V signal too.
The most elegant, final extension is to let the algorithm optimize its own feedback
constants. Such an intelligent control works by probing the systems dynamics during
the heating and cooling trajectories and uses the obtained information to optimize the
feedback parameters K
P
and t
I
(and possibly even K
D
).

Hats off if you can finish three out of four items from the list above!
References
I.M. Horowitz, Synthesis of feedback systems, Academic Press Inc., 1963
Wikipedia (the free encyclopedia), http://en.wikipedia.org/wiki/Feedback
LabVIEW PID Control Toolkit for Windows, ni.com.





42

Practicum 3
In this practicum you are supposed to write and implement LabVIEW code in an experiment you
design yourself. Your experiment should meet the following boundary conditions:

You can use the hardware that is available in the practicum room. If you have an idea for
an experiment that requires more hardware, feel free to ask for it.
You should at least use three afternoon sessions. More is optional, but can increase your
mark.
You should have used the LabVIEW capabilities to communicate with external hardware
(e.g.: GPIB, DAQ, et cetera).
Naturally you will keep a labjournal.

We have at least the following hardware available. Again: if you think you need something else,
just ask for it.

Light sources: LEDs/lasers
Stepper motor
Microphones
Photodetectors
Line scanners
USB camera
Speakers
Optics: mirrors/lenses
Force sensors

Examples of experiments you can do are:

Set up a communication channel between two PCs with a light source and a
photodetector.
Measure, analyse, and modify sound spectra.
Make use of a USB/Firewire camera to do some simple experiments.
Play Pong on the scope via analog I/O.

You are encouraged to come up with ideas for experiments yourself.



43

~~~~~~~~~
~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~
~
~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~
~~~~~
~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~
~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
~~~
~~~~~~~~~~~~~~~~~~~~~~~
~~~
~~~~~~~~~~~~~~~~~
~~
~
~
~~~~~~~~~~~~~~~~~~~

~~~~~~

~~~
~~~~~

~~~~~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