User manual
LPCXpresso Experiment Kit - User’s Guide
Page 33
Copyright 2013 © Embedded Artists AB
- SSEL0, a control signal for peripheral block SSP
- CT16B0_CAP0, an input signal to 16-bit timer #0
Note that only one functional signal can be connected to the pin at any given point in time. It is
however possible to change during program execution. By default, after reset, the register is initialized
to PIO0_2, have a pull-up resistor enabled, input hysteresis disabled and to be a standard push/pull
GPIO output (if defined as an output). Another register controls the direction of the general purpose
digital input/output and this register initialize PIO0_2 to be an input after reset.
Hence, after a reset, PIO0_2 is an input with pull-up resistor enabled. The pin is pulled high weakly but
cannot source any larger current. That means that LED1 will be off after reset (because the LED will
turn on when PIO0_2 is pulled low and if enough current can sink into the pin).
All LPC111x registers are defined in file: LPC11xx.h. It is part of the framework needed to program
the LPC111x. Have a look in file LPC11xx.h. It is found in the CMSIS library, in the inc sub-
directory.
What address is register IOCON_PIO0_2 defined as? _________________________________
(you will have to derive the address in several steps – tip: start searching for the LPC_IOCON register
at the end of the LPC11xx.h file. The register will be accessed as: LPC_IOCON->PIO0_2)
Is the derived address the same as in the LPC111x user’s manual? ____________
Now, have a look in chapter 12: LPC111x/LPC11Cxx General Purpose I/O (GPIO) in the LPC111x
user’s manual for a description of how the general purpose I/O functionality is controlled. There is a
GPIO data direction register that controls the direction of each pin in a port. PIO0_2 belongs to port #0.
Bit #2 in register GPIO0DIR controls the direction of the pin. See Figure 8 for details.
Figure 8 – GPIO Data Direction Register
Register GPIO0DATA holds the current state of the pins in port #0. Bit 2 in this register reflects the
state of pin PIO0_2. This is regardless if the pin is an input or output. If a pin is an output the value in
GPIOxDATA is driven to the pin.
Figure 9 – GPIO Data Register
There are also several registers related to interrupt functionality. We will not work with that right now. In
later experiments we will return to this.