close

Вход

Забыли?

вход по аккаунту

код для вставкиСкачать
MT3 Interfacing light-emitting diodes (LEDs) and push buttons to the microcontroller
MT3.1 Interfacing light-emitting diodes (LEDs) to a microcontroller
A light-emitting diode (LED) is a light source which is made out of semiconductor materials. A schematic
diagram of an LED is given in figure below. Its emitter comprises of a semiconductor die. It has a cathode
and an anode. An LED is a diode. Hence, it has nonlinear current-voltage characteristics. Usually a diode
allows an electric current to pass only in one direction. This is known as the diode's forward direction. It
blocks the current in the opposite direction of the diode. This is known as the reverse direction of the
diode. When an LED is connected to a circuit its forward current should not exceed a maximum
allowable limit.
Source: Wikipedia (http://en.wikipedia.org/wiki/Light-emitting_diode)
Some of the optical and electrical characteristics of an LED is given in table below. When interfacing an
LED the forward voltage should be taken into consideration. According to the diode characteristics the
forward voltage should be between 1.8 - 2.2 V. The operation voltage could be selected as any value
within this range. Once the forward voltage of a diode is known the maximum allowable current has to
be determined. This is done using the forward current vs forward voltage graph.
A typical forward current vs forward voltage graph is shown for the diode. It is seen from this graph that
if we select the operating voltage as 1.8 V, the forward current at this voltage is 20 mA. The LED should
be interfaced with the circuit so that the current across the LED does not exceed 20 mA. This is done by
connecting a resistor in series with the LED. This is known as a current limiting resistor.
Calculation of the value of the current limiting resistor for the given LED.
There are two methods for interfacing an LED to a MUNDer board.
Method 1:
In this method the cathode of the LED is connected to the ground. The anode of the LED is connected to
a current limiting resistor. The other end of the resistor is connected to a pin in the MUNDer board. The
LED is blinked by making the pin high (1) and low (0).
Method 2:
In this method the cathode of the LED is connected to a pin in the MUNDer board. The anode of the LED
is connected to a current limiting resistor as before. However the other end of the resistor is connected
a +5 V voltage. The LED is blinked by making the pin high (1) and low (0).
MT3.2 Interfacing push buttons to the microcontroller
Switches are used to make, break or change connections in an electrical circuit. Push button switches
are usually spring loaded so it returns the moving element to the original position when the pushing
force is removed. There two types of push buttons. These are namely normally open and normally
closed types.
A “normally open” push button is shown in figure below. It is in open circuit when it is not pressed.
A “normally closed” push button is shown in figure below. It is in short circuit when it is not pressed.
Interfacing a “Normally Open" Push Button
Interfacing a “Normally Closed" Push Button
Switch Bounce
When the switch is closed or opened, the switch contacts bounces against each other before settling.
Sometimes the microcontroller picks this up as bouncing noise. This could lead to undesirable
conditions. For example the microcontroller may receive multiple triggers even when the button is
pressed only once. The simplest way to correct this is by adding a time delay in the code after each
initial button press so that the switch contacts settle down.
In the above figure it shows the undesirable effects due to switch bouce. It has multiple triggers even if
the push button is pressed only once. So by considering a time delay between the high and low states of
the logic this problem could be overcome.
1/--страниц
Пожаловаться на содержимое документа