Thursday, 3 October 2013

Interface One Led with 8051

Interfacing one Led to 8051 Micro-controller


Description About Interfacing Led to 8051

Led is a simple 1 bit out put device. So we need only one bit(or pin) to operate it.
Led can be configured as active low(i.e Glow when pin is Low ) or It can be configured as
active high(i.e Glow when pin is High).
In above figure it is configured as active low. So For Glowing of led the bit must be 0
and 1 for off the led.

Code for The Above configuration


  #include "./include/reg51.h"  /*contain 8051 specific definition*/
  #include "./include/delays_header.h" /* contain delay generation declaration*/
  /*AS LED IS CONFIGURED AS A NEGATIVE LOGIC DEVICE */
  #define ON 0
  #define OFF 1
  sbit LED1=P0^0;

  void main()
  {
   while(1)/*super loop for embedded application*/
   {
    LED1=ON;
    /*provide some delay so that led in ON state for some time*/
    delay_500_ms();
    LED1=OFF;
    /*provide some delay so that led in OFF state for some time*/
    delay_500_ms();
   }
  }

  

Links For Download Complete keil's Project

The above Link contain single Led as well as 8 leds(full port). Also contain Proteus Simulator Example.

No comments:

Post a Comment