banner
Home Microcontrollers Abbreviations Useful Tools Gallery hot links feedback
 

LEd

The first thing usually done while learning any microcontroller or embedded system is blinking an LED. The diagram below shows the circuit for Interfacing an LED.

LED circuit

 



Here an LED connected to the first pin of port0 (P0.0) is blinked continuously. The assembly program given below is simple and self explanatory.

;*************************************************
;
;Program: Blinking LED.
;Author: Srikanth
;Website: http://shree-electronics.com/
;Description: Blinks an LED connected to P0.0
;continuously
;
;*************************************************


led equ P0.0

org 00h
up:  setb led   ;Turn ON the LED
acall delay     ;call delay subroutine
clr led         ;Turn OFF the LED
acall delay     ;call delay subroutine
sjmp up         ;Loop
delay:mov r7,#0ffh   ;delay subroutine
loop:mov r6,#0ffh
djnz r6,$    
djnz r7,loop
ret

end

 

back