Page 1146 - The Mechatronics Handbook
P. 1146

For example, an interrupt may occur when a digital logic level changes at a device pin, indicating a sensor
                                 condition, or it may occur when the user presses a button on a keypad, indicating that an action is desired
                                 and is to be performed immediately.
                                   The implementation of a real-time software system may either be custom designed or may make use
                                 of a commercial real-time operating system (RTOS). Since the design of an interrupt-driven real-time
                                 system has many potential pitfalls, the usage of a mature RTOS can greatly speed development time.
                                 Embedded Modules
                                 The functionality of commercially available embedded computing modules has been steadily increasing.
                                 It is common to find powerful microcontrollers, an Ethernet interface, and basic Internet protocol support
                                 all combined in a very small form factor for less than $50 in single quantities. This level of integration
                                 can greatly speed development time for network-enabled control or remote sensing applications.

                                 Hardware Interfacing

                                 Mechanical Switches
                                 Switches are easily interfaced to digital logic with a resistor as shown in Fig. 43.3. The mechanical nature
                                 of the switch may lead to bounce or oscillation of the digital signal for a brief period during the switch
                                 opening/closing action. This bounce may be eliminated in the software or with a small amount of
                                 additional hardware.
                                 Analog Inputs
                                 Analog inputs that indicate one of the two conditions can be interfaced to a digital logic input with a
                                 simple comparator (Fig. 43.4). A threshold voltage is set with a resistor divider. The comparator generates
                                 a digital signal, which indicates whether the analog input voltage is above or below the threshold voltage.
                                 This approach can be used for sensors such as optical interrupters (for part counting, motor movement
                                 detection, etc.), temperature limit sensors, and many others.
                                   When the analog voltage itself is of interest (as in, for example, temperature measurements), an analog-
                                 to-digital converter (ADC) can be used to provide either a serial or a parallel representation of the voltage
                                 with a precision ranging anywhere from 8 bits to 16 bits and above. A serial ADC may require as few as
                                 two digital I/O pins on a microcontroller for transferring data, while a parallel ADC requires at least as



                                                                             +5V



                                 FIGURE 43.3  A mechanical switch is easily interfaced  to digital input
                                 to a digital input on a microcontroller using a single
                                 resistor.


                                                                                      +5V





                                                                           analog input  +     to digital input
                                                                                        -

                                 FIGURE 43.4  A digital input driven by a comparator
                                 detects whether an analog voltage signal is above or below
                                 a threshold voltage (set with a resistor divider network).

                                 ©2002 CRC Press LLC
   1141   1142   1143   1144   1145   1146   1147   1148   1149   1150   1151