Documente Academic
Documente Profesional
Documente Cultură
DIs Inside
42 Look-up table eliminates the need for an IC 44 Operate circuits from voltages as high as 540V ac 46 Microcontroller supervises 0- to 20-mA protection circuit 47 LED indicates power source
to see all of EDNs design ideas, visit www.edn.com/designideas.
The circuit in this Design Idea controls the speed of a 5V permanent-magnet dc motor through the PCs parallel port (Figure 1). You use the C++ computer program, available at www. edn.com/100826dia, to run the motor at three speeds. The circuit uses PWM (pulse-width modulation) to change the average value of the voltage to the dc motor. You connect the motor to the PCs parallel port with an interface circuit. The design comprises IC 1, a 74LS244 buffer; IC2, a ULN2003 driver; relay switches S1, S2, and S3; IC3, a 555 astable multivibrator circuit; and Q1, a 2N2222 driving transistor. The 555 timer
operates as a variable-pulse-width generator. You change the pulse width by using relays to insert or split resistors in the 555 circuit. The computer program controls these resistors. When S1 is on and both S2 and S3 are off, the timer output is set to logic one, thereby driving the motor with its maximum speed. When S1 and S2 are on, the 555 timer generates a pulse signal with a 50% duty cycle. In this case, the charging resistor, RA1, is equal to the discharging resistor, RB. In the third case, S1 and S3 are on, and the charging resistor is RA2,where RA2=0.1RB, reducing the on time of the pulse signal and,
5V
consequently, the speed of the motor to the lower limit. Table 1 summarizes the on/off-operation conditions of the relays and the corresponding dc-motor speeds.
S2
5V
IN4148
RA1 47k
4 7
10 1 19
IC3 NE555 3 6 2 1 5
R1 1k 5V C2 0.1 F
+ M
5V DC MOTOR
Q1 2N2222
S1
Figure 1 This circuit controls the speed of a 5V permanent-magnet motor through the PCs parallel port.
designideas
The code prompts you to select a certain speed, stores your selection as an integer variable choice, generates the proper digital sequence, and stores it at another integer variable. You place the value of the integer variable data at a PCs parallel port using the outportb function. The program uses the kbhit function to stop the motor when you hit any key on the keyboard.EDN
COMMON CATHODE a a b c d e f g a b c d e f g
ment decoder. Figure 1 shows a typical circuit that uses a CD4511 to translate a 4-bit code into BCD. Unfortunately, a limited size and budget may force you to omit components whenever possible. This requirement is especially critical with consumer products. Simple firmware allows you to overcome this limitation by directly connecting the display to a microcontroller (Figure 2). A recent project used the 8-bit Freescale (www.freescale.com) MC68HC-
A B C D
CD4511
g e c
a NuMerIc dISPLay NeedS a SPecIaL SeVeN-SeGMeNt cOde, the VaLue Of whIch dePeNdS ON the cOMMON POINt Of the dISPLay Leds.
908QY4 microcontroller. When you write code for a microcontroller, you often represent data in decimal, hexadecimal, or BCD formats. A numeric display needs a special seven-segment code, the value of which depends on the common point of the display LEDs common cathode or common anode and on microcontroller outputs you choose for display. Tables 1 and 2 show how to obtain seven-segment code values for common-cathode and commonanode displays, respectively. No mathematical connection exists between seven-segment code and any of these formats. Thus, you must use a table that a previous Design Idea
5V
COMMON CATHODE a pB0 pB1 pB2 MC68HC908QY4 pB3 pB4 pB5 pB6 a b c d e f g a b c d e f g
g e c
Figure 2 The look-up table lets the microcontroller produce a seven-segment output.