Interfacing LED with 8051 www.pantechsolutions.net
LED INTERFACE WITH 8051
Light-emitting diodes are elements for light signalization in electronics.  Initially the basic interface to any controller is LED They perform similar to common diodes with the difference that they emit light when current flows through them . The led’s are connected to port 1 from p1.0 to p1.7 LED
org 00h back:  mov a,#00h mov P1,a acall secdelay mov a,#0ffh mov P1,a acall secdelay Sjmp back secdelay: mov r5,#25 H3: mov r4,#55 H2: mov r3,#ff Djnz r3,h1 Djnz r4,h4 Djnz r5,h5 ret LED INTERFACING ASSEMBLY CODE
#include <stdio.h>  #include <REG51.H> #define LED P1 void delay(void); void led_left(void); unsigned int j; void led_left() { for (j=0x01; j<=0x80; j<<=1)  { LED = j; delay();  } }void delay(void) { unsigned int i; for (i=0;i<10000;i++); } void main (void)  { LED = 0x00; while (1) {   led_left(); delay(); led_right(); //scroll right } } LED INTERFACE C CODE
For More Tutorials www.pantechsolutions.net http://www.slideshare.net/pantechsolutions http://www.scribd.com/pantechsolutions http://www.youtube.com/pantechsolutions

Interfacing 8051 with LED

  • 1.
    Interfacing LED with8051 www.pantechsolutions.net
  • 2.
  • 3.
    Light-emitting diodes areelements for light signalization in electronics. Initially the basic interface to any controller is LED They perform similar to common diodes with the difference that they emit light when current flows through them . The led’s are connected to port 1 from p1.0 to p1.7 LED
  • 4.
    org 00h back: mov a,#00h mov P1,a acall secdelay mov a,#0ffh mov P1,a acall secdelay Sjmp back secdelay: mov r5,#25 H3: mov r4,#55 H2: mov r3,#ff Djnz r3,h1 Djnz r4,h4 Djnz r5,h5 ret LED INTERFACING ASSEMBLY CODE
  • 5.
    #include <stdio.h> #include <REG51.H> #define LED P1 void delay(void); void led_left(void); unsigned int j; void led_left() { for (j=0x01; j<=0x80; j<<=1) { LED = j; delay(); } }void delay(void) { unsigned int i; for (i=0;i<10000;i++); } void main (void) { LED = 0x00; while (1) { led_left(); delay(); led_right(); //scroll right } } LED INTERFACE C CODE
  • 6.
    For More Tutorialswww.pantechsolutions.net http://www.slideshare.net/pantechsolutions http://www.scribd.com/pantechsolutions http://www.youtube.com/pantechsolutions