Figure 2.8-2. Open-Collector (NPN) Connection To Digital Input
Figure 2.8-2 shows typical connections. Rground is typically 0-100 Ω, Rseries is typically 0 Ω, and Rpullup, the external pull-up
resistor, is generally not required. If there is some uncertainty about whether the signal is really open-collector or could drive a
voltage beyond 5.8 volts, use an Rseries of 22 kΩ as discussed in Section 2.8.1.1, and the input should be compatible with an
open-collector signal or a driven signal up to at least 48 volts.
Without the optional resistors, the figure simplifies to:
Figure 2.8-3. Simplified Open-Collector (NPN) Connection To Digital Input Without Optional Resistors
Note that an individual ground connection is often not needed for every signal. Any signals powered by the same external supply,
or otherwise referred to the same external ground, should share a single ground connection to the U3 if possible.
2.8.1.3 - Input: Mechanical Switch Closure
To detect whether a mechanical switch (dry contact) is open or closed, connect one side of the switch to U3 ground and the other
side to a digital input. The behavior is very similar to the open-collector described above.
Figure 2.8-4. Basic Mechanical Switch Connection To Digital Input
When the switch is open, the internal 100 kΩ pull-up resistor will pull the digital input to about 3.3 volts (logic high). When the switch
is closed, the ground connection will overpower the pull-up resistor and pull the digital input to 0 volts (logic low). Since the
mechanical switch does not have any electrical connections, besides to the LabJack, it can safely be connected directly to GND,
without using a series resistor or SGND.
When the mechanical switch is closed (and even perhaps when opened), it will bounce briefly and produce multiple electrical
edges rather than a single high/low transition. For many basic digital input applications, this is not a problem as the software can
simply poll the input a few times in succession to make sure the measured state is the steady state and not a bounce. For
applications using timers or counters, however, this usually is a problem. The hardware counters, for instance, are very fast and will
increment on all the bounces. Some solutions to this issue are:
Software Debounce: If it is known that a real closure cannot occur more than once per some interval, then software can be
used to limit the number of counts to that rate.
Firmware Debounce: See Section 2.9.1 for information about timer mode 6.
Active Hardware Debounce: Integrated circuits are available to debounce switch signals. This is the most reliable hardware
solution. See the MAX6816 (maxim-ic.com) or EDE2008 (elabinc.com).
Passive Hardware Debounce: A combination of resistors and capacitors can be used to debounce a signal. This is not
foolproof, but works fine in most applications.
14