© National Instruments
|
2-3
Change Detection
You can program NI 651
x
devices to send an interrupt when a change occurs on any input line.
The DIO device can monitor changes on selected input lines or on all input lines. It can monitor
for rising edges (0 to 1), falling edges (1 to 0), or both. When an input change occurs, the DIO
device generates an interrupt, and the NI-DAQ driver then notifies the software.
Note
Excessive change detections can affect system performance. Use digital
filtering to minimize the effects of noisy input lines.
The DIO device sends a change detection when any one of the changes occurs, but it does not
report which line changed or if the line was rising or falling. After a change, you can read the
input lines to determine the current line states. The maximum rate of change detection is
determined by the software response time, which varies from system to system.
An overflow bit indicates that an additional rising or falling edge has been detected before the
software could process the previous change.
Refer to the software documentation for information about how to set up and implement the
change detection.
Change Detection Example
Table 2-2 shows a change detection example for six bits of one port.
This example assumes the following line connections:
•
Bits 7, 6, 5, and 4 are connected to data lines from a four-bit TTL output device. The DIO
device detects any change in the input data so you can read the new data value.
•
Bit 1 is connected to a limit sensor. The DIO device detects rising edges on the sensor,
which correspond to over-limit conditions.
•
Bit 0 is connected to a switch. The software can react to any switch closure, which is
represented by a falling edge. If the switch closure is noisy, enable digital filtering for this
line.
Table 2-2.
Change Detection Example
Bit
7
6
5
4
3
2
1
0
Changes to detect
—
—
Enable rising-edge detection
yes
yes
yes
yes
no
no
yes
no
Enable falling-edge detection
yes
yes
yes
yes
no
no
no
yes