© National Instruments
|
3-3
You can change these behaviors by configuring DAQmx Channel properties:
•
CI.CountEdges.InitialCnt—To specify the initial value of the count.
•
CI.CountEdges.Term—The signal-to-measure comes from an input terminal. To change
the signal-to-measure, specify a different terminal via this property.
•
CI.CountEdges.ActiveEdge—To specify on which edge, whether rising or falling, to
increment or decrement the counter.
•
CI.CountEdges.Dir—To set whether to increment or decrement the counter on each edge.
You can set this property to:
•
Count Up
•
Count Down
•
Externally Controlled
If you select Externally Controlled, the device monitors a hardware signal to determine the
count direction. When the signal is high, the counter counts up; when the signal is low, the
counter counts down. You can set which signal to monitor via CI.CountEdges.DirTerm.
Timing Settings
The timing settings determine when the device reads the count value.
On-Demand
By default, the counter uses On-Demand (no sample clock) timing. The counter starts counting
when software calls DAQmx Start Task. Each time you call DAQmx Read, the counter returns
the current count value. Figure 3-3 shows an example using On-Demand timing.
Figure 3-3.
Edge Counting: On-Demand Timing
Sample Clock
To precisely control when the device reads the count value, use the DAQmx Timing (Sample
Clock) VI or function. With this VI or function, you can set the source of the Sample Clock, the
rate of the Sample Clock, and the number of samples to acquire.
S
t
a
rt T
as
k
S
ign
a
l to Me
asu
re
Co
u
nt
1
0
5
4
3
2
Re
a
d V
a
l
u
e
DAQmx Re
a
d
DAQmx Re
a
d
3
5