Please update your Flash Player to view content.

                  FOLLOW  US





 
 
Delay Based LED Blinking Program
Code Library - 8051 Assembly

 

Here is a simple code for Blinking a LED. The LED is connected to P2.0 & 12MHz crystal is used. The Anode of the LED is given to Vcc through a resistor & the cathode is connected to the microcontroller pin. Please check this link to see how to interface LED to Microcontroller. The LED is ON for One Second & OFF for ONE Second. This delay of ONE Second can be changed by changing the values loaded into the R7, R6 and R5 in the delay subroutine. The higher the value loaded the higher the delay. Since the controller is 8 bit microcontroller values greater than 255 cannot be loaded.

 

led1 bit P       2.0
    

ORG 0000h

loop:

clr led1                                 

//TURN ON LED

call delay

setb led1    

//TURN OFF LED

call delay

ajmp loop 

delay:

 mov r7,#200

 

l1_delay:

mov r6,#217

l2_delay:

 mov r5,#10

 djnz r5,$

// "$" over here indicates jump at the same location

djnz r6,l2_delay

djnz r7,l1_delay

ret

 end

 .

 

Add comment


Security code
Refresh

 

Featured Products

 

Random Products











Latest Video

Random Articles

  • Capacitors in Series
    Capacitors in Series Capacitors are said to be connected together "in series" when...
  • RFID Based Projects
    RFID based Attendance System. RFID based Latch. RFID based Library Management. RFID based Health...
  • Introduction
    Introduction to Capacitors Just like the Resistor, the Capacitor, sometimes...
  • Light Emitting Diodes
    Light Emitting Diodes Light Emitting Diodes or LED´s, are among the most...

Search Products

User Login






 
 
.
 TUTORIALS
.
  8051 Tutorial
 
  Power Supply
 
CODE LIBRARY
.

  8051 Assembly
 
  C Code Library

.
 PROJECTS
.
  Project List
 
  Synopsis and Abstract
 
DOWNLOADS
.

  Datasheets
 
  Download

.
 POPULAR
.
  About Us
 
  DNA Shop
 
  Totorial
 
  Code Library
 
  Download
 

.
 CONTACT US
.

Mr. Amol Shah

DNA Technology Nashik,

Maharashtra 422009 India

Phone : 0253-3023939

Mobile : 09225145135

Email : contact@dnatechindia.com