User manual
LPCXpresso Experiment Kit - User’s Guide
Page 32
Copyright 2013 © Embedded Artists AB
Figure 7 – Breadboard Connections for LED1 (real photo)
The current through the Light Emitting Diode (LED) is limited and controlled by the series resistor. It
has to be limited since the voltage drop across the LED is fairly constant. The voltage difference
between the LED’s forward voltage drop and driving voltage must be absorbed by the series resistor.
The current through the LED (and series resistor) can be calculated as I = (Vsupply – Vleddrop) / R.
Different LEDs have different typical current levels. It can be 1, 2, 10, 20 mA for smaller LEDs. Bigger
LEDs can have much higher ratings.
The LED forward drop voltage is typically 1.5V for a red LED. Other colors have different forward
voltage drops. There are also variations between different brands. Consult the LED’s datasheet for
details about forward voltage drop and current level. The red LED’s included in the component kit has
a forward voltage drop of 1.5V and designed for 10mA current. With a 330 ohm series resistor the
current is limited to about 5mA, which is OK also. The light intensity at 5mA is acceptable for our
(experiment) purposes.
The current level determines the driving method. For moderate levels (typically below 4 mA) most
microcontrollers and logic gates can drive the LED directly. This is the method used in our
experiments. Some microcontrollers have high-current capacity outputs. The LPC1110 family
microcontrollers have a 20 mA output pin (PIO0_7, see datasheet for details).
Almost all output pins have higher current capabilities sinking current than driving current. It is
therefore common to connect LEDs like in Figure 4, with the cathode connected to the microcontroller
pin. When driving, current is flowing into the micro controller pin (i.e., sinking current).
Another reason for letting the microcontroller drive the LED by sinking current is that most
microcontrollers power-up with all pins as inputs with pull-up resistors enabled. This basically means
that the pin will be driven high weakly. The LED will not turn on shortly during a power-up. It will be at a
known (off) state until the application program controls the LED actively.
If the driving current is higher (> 5 mA) a high-current driver chip can be used, or discrete
transistors/mosfets.
A LED is a polarized component, meaning that it matters how the two ends are connected. The two
ends are called anode and cathode, respectively. Current flows from anode to cathode, but blocks in
the reverse direction. Sometimes the anode is called the positive side and cathode the negative side.
The cathode is typically marked somehow on a LED (shorter pin, cut in plastic package, etc).
Mounting a LED the wrong way has no catastrophic result. The result is that the LED will not light
(since current through the LED will be blocked). Failing to add the series resistor will have more sever
effects, though. Depending on high strong (how much current it can deliver) the power supply is, the
current level through the LED can become high enough to destroy the LED. Therefore, be careful to
always connect a series resistor with correct resistance value.
The LPC111x is a relatively low pin count processor with only 48 pins. This is true for the package
used on the LPCXpresso board. There are other packages with different number of pins for this
processor also. The external pins on the chip package are not enough for connecting all internal
peripheral units to unique pins. Instead each I/O pin has up to four alternative connections. Read the
LPC111x user’s manual for more information. You will have to read a lot in this document so you better
get started immediately. Have a look in chapter 7 - LPC1100/LPC1100C/LPC1100L series: I/O
configuration in the LPC111x user’s manual for a description of the how the alternative pin functions
can be controlled.
Pin PIO0_2 is controlled by register IOCON_PIO0_2. In the description for this register we can see that
there are three alternative pin functions:
- PIO0_2, a general purpose input/output, port #0, pin #2