Aim:
Light Emitting Diodes (LED) is the most commonly used components, usually for displaying pins digital states. Typical uses of LEDs include alarm devices, timers and confirmation of user input such as a mouse click or keystroke. The main aim of this project is how to interface a single LED to LPC2148 microcontroller.
Description:
Interfacing LED:
Fig. 1 shows how to interface the LED to microcontroller. As you can see the Cathode is connected through a resistor to GND & the Anoode is connected to the Microcontroller pin. So when the Port Pin is HIGH the LED is ON & when the Port Pin is LOW the LED is turned OFF.
Interfacing LED with LPC2148
We now want to flash a LED in LPC2148 board. It works by turning ON a LED & then turning it OFF & then looping back to START. However the operating speed of microcontroller is very high so the flashing frequency will also be very fast to be detected by human eye.
The LPC2148 board has eight numbers of point LEDs, connected with I/O Port lines to make port pins high.
Pin Assignment with LPC2148
Point LEDs | LPC2148 direction | LPC2148 Lines | LED Selection | Connections | |
DIGITAL OUTPUTS | LED.0 | IODIRx=0x01 | IOSETx=0x01 | Connect Any one PORT from
PORT0, PORT1
| |
LED.1 | IODIRx=0x02 | IOSETx=0x02 | |||
LED.2 | IODIRx=0x04 | IOSETx=0x04 | |||
LED.3 | IODIRx=0x08 | IOSETx=0x08 | |||
LED.4 | IODIRx=0x10 | IOSETx=0x10 | |||
LED.5 | IODIRx=0x20 | IOSETx=0x20 | |||
LED.6 | IODIRx=0x40 | IOSETx=0x40 | |||
LED.7 | DDRx=0x80 | IOSETx=0x80 |
Block Diagram
Schematic:
Code:
// *********************************************************** // Project: Interfacing Single LED to LPC2148 // Author: Hack Projects // Module description: Operate single LED // *********************************************************** #include<lpc214x.h> int main() { PINSEL0=0x00000000; PINSEL1=0x00000000; PINSEL2=0x00000000; IO1DIR =(1<<16); //declare p1.16 as output pin IO1SET =(1<<16); //enable p1.16 pin }
Downloads:
The code was compiled in Keil uvision4 and simulation was made in Proteus v7.7.
To download code and proteus simulation click here.
Further Reading suggestions:
You may also like,
- Interfacing keypad with ARM(LPC2148)
- nterfacing DAC with ARM(LPC2148)
- Interfacing with UART of ARM(LPC2148) controller
- Interfacing SPI communication with PIC
- ARM(LPC2148) Displaying Custom Characters on LCD
- RTC interfacing using I2C in ARM(LPC2148)
- Interfacing Graphical LCD with ARM(LPC2148)
- Interfacing ultrasonic sensor with ARM(LPC2148)
- Interfacing GPS Modu with ARM(LPC2148)
- Interfacing GSM Module with ARM(LPC2148)
- Interfacing PWM in ARM(LPC2148)
- Interfacing ADC with ARM(LPC2148)
- Scrolling string on LCD using ARM(LPC2148)
- Interfacing keypad with ARM(LPC2148)
- nterfacing DAC with ARM(LPC2148)
- Interfacing with UART of ARM(LPC2148) controller
- Interfacing SPI communication with PIC
- ARM(LPC2148) Displaying Custom Characters on LCD
- RTC interfacing using I2C in ARM(LPC2148)
- Interfacing Graphical LCD with ARM(LPC2148)
- Interfacing ultrasonic sensor with ARM(LPC2148)
- Interfacing GPS Modu with ARM(LPC2148)
- Interfacing GSM Module with ARM(LPC2148)
- Interfacing PWM in ARM(LPC2148)
- Interfacing ADC with ARM(LPC2148)
- Scrolling string on LCD using ARM(LPC2148)
No comments:
Post a Comment