Interfacing on LED
Push Button
Description:
The 89V51RD2 is the microcontroller used here. The circuit is so
designed that when push button suppose S1 is depressed the LED D1 goes ON.
Connection Of LED:
Never connect the LED directly with Vcc (output voltage which comes
directly) it may burn your LED. Always connect the led with resistance.
Electrical Switch: The switch is a
basic input device used to control operation of any output device using the
microcontroller or control unit. It basically breaks the electrical circuit and
interrupts the flow of current.
Connection of
Electrical Switch: In circuit pull up and pull down resistor use to convert
infinite or zero resistance into the digital signals. On the basis of pull up
and pull down resistor .We can interface the switch in two way.
Positive Logic: In this we use a
pull down resistor connected to the ground .When pressed the switch logic
assert high and when disconnect the switch logic assert low.
Negative Logic: In
this we use a pull up resistor connected to Vcc. When we press
switch the logic assert low and when disconnected logic assert high.
Algorithm to
control the led using the switch:
1 Microcontroller
pin connected to LED makes the output.
2 Microcontroller
pin connected to switch makes the input.
3 If switch is
pressed LED is high or either makes it low.
Comments
Post a Comment