RadioLocman.com Electronics ru
Advanced Search +
  

10-11-2017

Single switch serves dual duty in small, microprocessor-based system

Vishay » TP0610

Steve Hageman

EDN

Traditional control-system designs use separate switches to control power and various system functions, but adding a few components to a small, microprocessor-based system can combine a control function with the system's on/off switch. For example, you can design a system to display relative humidity and temperature (Reference 1). This small, battery-powered system requires a microprocessor-controlled on/off power switch, which you implement with a pushbutton, and a function switch to change the display from degrees Celsius to degrees Fahrenheit, which you implement as a toggle switch. From ease-of-use and total- cost perspectives, combining these two functions in a single switch makes sense.

Figure 1 shows a circuit for this application. Initially, Q1, a P-channel MOSFET, is off because R1 holds Q1's gate-to-source voltage at 0 V. No input reaches voltage regulator IC1, and, thus, the system's microprocessor, IC2, also remains off. When the operator presses the normally closed momentary-contact pushbutton switch, S1, current flows through R1 and R2 to ground, developing sufficient gate-to-source voltage to turn on Q1 and apply power to voltage regulator IC1 and the microprocessor. Capacitor C1 debounces the switch contact and ensures that Q1 remains on long enough to start the microprocessor, regardless of how quickly the user presses and releases the switch. In addition, as its final task, the start-up firmware initializes the system's LCD, thus reinforcing the operator's tendency to hold the power switch in its on position long enough to ensure full start-up.

Single switch serves dual duty in small, microprocessor-based system
Figure 1. A single pushbutton switch can control power and select among
operating modes in a simple microprocessor-based system.

Immediately after the microprocessor powers up, it begins executing its firmware and turns on Q2, an N-channel MOSFET, by delivering a logic one of more than 3 V to Q2's gate. In turn, Q2 keeps Q1 switched on, and the system runs under software control. If the operator again presses the on/off button, Q1 remains on, and the microprocessor continues to run but pulls its mode line high. The mode line drives an interrupt input pin, and the software can use the interrupt as a toggling function or to access a wraparound, multiple-choice menu. After a suitable preprogrammed time interval, the microprocessor system turns itself off by placing a logic zero on Q2's gate. In turn, Q2 switches off Q1 to remove power from the system.

Reference

Materials on the topic

Slices ↓
Radiolocman facebook Radiolocman twitter Radiolocman google plus