counter - E

advertisement
1
Topics
A.
B.
C.
D.
Hardware
Software
Architecture
Simulating a DAQ
device
Analog Input
E.
F.
G.
Analog Output
Counters
Digital I/O
A. Hardware
1.
2.
3.
4.
5.
Signal
Terminal Block
Cable
DAQ Device
Computer
3
A. Hardware – Terminal Block and
Cable
DAQ Signal Accessory—terminal block used in this course
4
A. Hardware – DAQ Device
 Most
DAQ devices have four standard elements:
analog input, analog output, digital I/O, and counters
 You can transfer the signal you measure with the DAQ
device to the computer through a variety of different
bus structures
 If you do not have a DAQ device, you can simulate one
in MAX (Measurement and Automation Explorer) to
complete your software testing
5
B. Software Architecture
 Driver
Engines: NI-DAQmx and Traditional NI-DAQ
 Configuration: MAX
 Application Software: LabVIEW, LabWindows™/CVI™,
and DAQ Assistant
6
B. Software Architecture –
Configuration
7
C. Simulating a DAQ Device
 Create
NI-DAQmx simulated devices in NI-DAQmx 7.4
or later
 Using NI-DAQmx simulated devices, you can try NI
products in your application without the hardware
 With NI-DAQmx simulated devices, you also can
export a physical device configuration onto a system
that does not have the physical device installed
8
Exercise 8-1:
Measurement and Automation Explorer
Concept Exercise
To use MAX to examine, configure, and test a device.
D. Analog Input
The process of measuring an analog signal and
transferring the measurement to a computer for
analysis, display, or storage
 An
analog signal is a signal that varies continuously
 Analog input most commonly measures voltage or
current
10
D. Analog Input – ADC
Acquiring an analog signal with a computer requires
analog-to-digital conversion, a process that transfers
an electrical signal into digital data so that a
computer can process the data
11
D. Analog Input –
Task Timing
 Acquire 1
Sample
 On-demand operation
 Acquire n
Samples
 Uses hardware
timing and a buffer in computer memory to
acquire data more efficiently at a consistent Δt
 Acquire Continuously
 Uses hardware
timing and a buffer in computer memory to
acquire data
 Each read operation extracts a subset of the buffer
 Stopped manually
12
D. Analog Input –
Task Triggering
 When
a device controlled by NI-DAQmx
does something, it performs an action
 Two very common actions are producing
a sample and starting a waveform acquisition
 Every NI-DAQmx action needs a stimulus or cause
 Causes for actions are called triggers
 The start
trigger starts the acquisition
 The reference trigger establishes the reference point in a set
of input samples
13
Exercise 8-2:
Triggered Analog Input VI
Acquire an analog signal using a DAQ device and a
digital trigger.
E. Analog Output
 The
process of generating analog signals from your
computer
 Performing digital-to-analog (D/A)
conversions generates analog output
 The available analog output types
for a task are voltage and current
 To perform a voltage or current
task, a compatible device must be
installed that can generate that
type of signal
15
E. Analog Output – DAC
 The
opposite of analog-to-digital conversion
 A digital-to-analog converter (DAC) accepts data and
uses it to vary the voltage on an output pin over time
 When used with a high speed clock, the DAC can
create a signal that appears to vary constantly and
smoothly
16
E. Analog Output – Task Timing
Generate 1 Sample
 Use
single updates if the signal level is more important
than the generation rate (constant, DC signal)
 Use software timing to control when the device
generates a signal
17
E. Analog Output – Task Timing
 Generate n
Samples
 Generate multiple
samples for one or more channels by
generating single samples repetitively using hardware timing
 Use Generate n Samples if you want to generate a finite
time-varying signal
 Generate Continuously
 Similar to
Generate n Samples,
except that an event must occur
to stop the generation
18
F. Counters
A
counter is a digital timing device typically used for event
counting, frequency measurement, period measurement,
position measurement, and pulse generation
A
counter has a fixed number it can count
to as determined by the resolution of
the counter
 For example, a 24-bit counter
can count to:
2(Counter Resolution) – 1 = 224 – 1 = 16,777,215
19
Exercise 8-3:
Count Events VI
Use the DAQ Assistant to input a counter value.
G. Digital I/O
 Digital
signals:
 Electrical signals
that transfer digital data (on/off, high/low,
1/0) using a wire
 Used to control or measure digital or finite state devices, such
as switches and LEDs
 Used to transfer data


program devices
communicate between devices
 Use digital
signals as clocks or triggers to
control or synchronize other measurements
21
G. Digital I/O
 Digital
Lines
 Use digital
lines in a DAQ device to acquire a digital value
 On some devices, you can configure the lines individually to
either measure or generate digital samples
 Digital
Ports
 Use the
digital port(s) in a DAQ device to acquire a digital value
from a collection of digital lines
 You can configure the ports individually to either measure or
generate digital samples
22
Exercise 8-4: Digital Count VI
OPTIONAL
Use the DAQ Assistant for digital I/O.
Summary—Quiz
1.
You are reading a signal at 50kHz. You want to acquire the signal
until the user clicks a stop button. Which task timing should you
use?
a)
b)
c)
2.
Acquire 1 Sample
Acquire N Samples
Acquire Continuously
Your VI monitors a factory floor. Part of the VI controls an LED
which alerts users to the status of the system. Which task timing
should you use?
a)
b)
c)
Generate 1 Sample
Generate N Samples
Generate Continuously
24
Download