Computer Interfacing

advertisement
Digital Electronics and Computer
Interfacing
Tim Mewes
5. Computer Interfacing – DAQ cards
5.1 Basics
• Data acquisition is the process of gathering a
signal and digitizing it for presentation, analysis
and storage on a computer
• Signals can be either
Analog
or
Digital
Digital Electronics and Computer Interfacing
2
5.1 Basics
• Today a wide variety of different DAQ devices
are available:
– PCI cards
– PCMCIA cards (Notebooks)
– USB solutions are becoming popular
• Most DAQ devices allow to acquire and create
signals (Input/Output)
Digital Electronics and Computer Interfacing
3
5.2 DAQ Setup
• DAQ setup can be done using the
Measurement and Automation Explorer (MAX)
• MAX also allows to test basic hardware
functionality
• The latest version of DAQ device drivers are
called NI-DAQmx
• A DAQ setup configuration is called
NI-DAQmx task
Digital Electronics and Computer Interfacing
4
5.2.1 Creating a new NI-DAQmx task
• Open MAX
• Go to devices &
Interfaces
• Select NI-DAQmx
devices
• Choose the card you
want to use for the task
(NI PCI-6014)
• Select “Create Task”
Digital Electronics and Computer Interfacing
5
5.2.1 Creating a new NI-DAQmx task
• Select the type of task
you need (Digital I/O)
• Select whether you want
to input or output data
(example: Line Output)
• Select the physical
channels you want to use
(example: P0.0 – P0.3)
• Name the task
• Select Finish and then
test the hardware
Digital Electronics and Computer Interfacing
6
5.2.2 Using a NI-DAQmx task in LabVIEW
• Go to Measurement I/O
NI-DAQmx
• Choose Read or Write
• Create a constant for
the task input
• Select the task to be used
as the constant
Digital Electronics and Computer Interfacing
7
5.2.2 Using a NI-DAQmx task in LabVIEW
• Configure the SubVI to
input/output data as
needed
The NI-DAQmx VIs are examples for
so called polymorphic VIs
Digital Electronics and Computer Interfacing
8
Polymorphic VIs
• Polymorphic VIs accept different data types for a
single input or output terminal
• Polymorphic VIs automatically adapt to accept
input data of different data types
Digital Electronics and Computer Interfacing
9
5.3 Counter
• A counter is a digital timing device
• Can be used to
– Count rising and/or falling edges
– Measure the frequency/period of a signal
– Measure the pulse width of a signal
• The count register stores the current count of the
counter
• Counter gates can be used to externally
enable/disable counting
Digital Electronics and Computer Interfacing
10
5.3.1 Creating a NI-DAQmx counter task
• Open MAX
• Select “Create Task”
• Choose “Counter Input”
• Example: “Frequency”
• The NI PCI-6014 has two
counters choose one of
them
Digital Electronics and Computer Interfacing
11
5.3.1 Creating a NI-DAQmx counter task
• Modify the task
properties if
necessary
• Save the settings
• Note the PIN to which
the signal has to be
connected!
• Make the physical
connection
• Test it
Digital Electronics and Computer Interfacing
12
Download