Thursday 9 June 2016

Interfacing of Led with LPC2148

Led (  Light emitting diode) : Light Emitting Diodes are the mostly commonly used components in many applications. They are made of semiconducting material. This article describes about basic interfacing of LEDs to the 8051 family microcontrollers.


Interfacing of led with LPC2148:


Circuit diagram for blinking a led:




Program for blinking a led:

1) C code:

#include<lpc214x.h>
void delay(int );
int i;
int main()
{
   
    PINSEL0=PINSEL1=PINSEL2=0;
    IO0DIR=0XFFFFFFFF;
   
    while(1)
    {
        IO0SET=IO0SET|(1<<0);
        delay(4000);
        IOCLR=IO0CLR|(1<<0);
        delay(4000);

    IO0SET=IO0SET|(1<<1);
        delay(4000);
        IOCLR=IO0CLR|(1<<1);
        delay(4000);
    }
    return 0;
}

void delay(int k)
{
    int i,j;
    for(i=0;i<k;i++)
    for(j=0;j<=1000;j++);
}



Simulation of led:



 

0 comments:

Post a Comment

if you have any doubt please let me know