How To Use An LPC’s General Purpose Input/Output

The most basic thing to do with a microcontroller is to operate it’s GPIO pins. To use a PIN on a DipCortex (LPC11U/LPC1347) or SolderBridge (LPC11U24) as a GPIO you have to consider the following,

  • What peripherals are on this pin, it may not default to be a GPIO pin (most do)
  • What features of the pin do I want to enable/disable. Pull ups, Pull downs, Invert, Analogue input etc..
  • Do I want an input or an output
  • Is the pin 5v tolerant

First download the User manual it has all the info you need. It is quite large but has the answer to almost all questions when it comes to using the LPC.

LPC11U User Manual & LPC1347 User Manual

Step 1 – Configure The Pin’s Function

Select your pin and examine its description in chapter 8. Here you will find what peripherals the pin has and if it is 5v tolerant. To configure the pins mode, the periperhal in charge of it, you modify the value in the IOCON register associated with it.

For example lets pick Port1 Pin 13 – Referred to as PIO1_13. Section of of the user manual details the function of each bit in this register and what value each bit will be at reset.

LPC11U24  PIO1_13

LPC11U24 PIO1_13

If I wanted to use it as a GPIO, with a pull up enabled and Hysteresis (Ignores noise, good for button inputs) I would do the following :

Step 2 – Set The Direction

All micro-controllers use the concept of direction when referring to a GPIO Pin it’s either an Input or an Output. For ARM processors a set bit indicates it’s an output and a clear bit an input.

Step 3 – Use the Pin

To read the GPIO Pin there are a few different options :
If it’s an output you can write to the SET and CLR registers to modify only a single pin, leaving other outputs alone  

No comments yet.

Leave a Reply


cheapest viagra
buy viagra mesa
non prescription viagra
buy cheap generic viagra
best place to buy viagra
viagra and cialis and
buy viagra usa
buy viagra prescription
buy cheap generic online viagra
buy viagra now
viagra by the pill
cheap pill viagra
buy viagra new york
buy viagra onli
cheap price viagra
free viagra
viagra and cialas
buy online online viagra viagra
buy deal viagra
buy viagra on-line
buy cheap generic viagra online
viagra for sale
buy discount viagra
buy viagra without prescription