123mylist.com

Simple Counter using 7 segment LED with 8051 microcontroller

Hello friends, Welcome back! In this post, I want to share with you a simple experiment that I did today. Basically this experiment uses the concept of interfacing of 7 segment LED with 8051 microcontroller. A simple counter has been made using 8051, which will display numbers from ‘0’ to ‘9’, one by one with a delay of few seconds.

The connections made in this circuit are shown in the block diagram:

Simple counter using 7 segmenet LED and 8051: Block Diagram

Please note that the 7 segment LED is connected in common anode mode, that means all 7 anodes of leds are connected together and should be connected to +5V and a particular LED will turn on when ‘Ground’ is applied to its terminal, which in this case is done using microcontroller.

The assembly language program for this experiment is given below:



;seven segment led
;Programmed by: Amit Biswal
;URL: http://amitbiswal.blogspot.com
org 0000h
;pin connections:
;pin 0.6=a
;pin 0.5=b
;pin 0.4=c
;pin 0.3=d
;pin 0.2=e
;pin 0.1=f
;pin 0.0=g
repeat:
mov p0,#10000001b ; displaying 0
acall delay
mov p0,#11001111b ; displaying 1
acall delay
mov p0,#10010010b ; displaying 2
acall delay
mov p0,#10000110b ; displaying 3
acall delay
mov p0,#11001100b ; displaying 4
acall delay
mov p0,#10100100b ; displaying 5
acall delay
mov p0,#10100000b ; displaying 6
acall delay
mov p0,#10001111b ; displaying 7
acall delay
mov p0,#10000000b ; displaying 8
acall delay
mov p0,#10000100b ; displaying 9
acall delay
sjmp repeat
delay:
mov r3,#010h
l3:mov r2,#0ffh
l2:mov r1,#0ffh
l1:djnz r1,l1
djnz r2,l2
djnz r3,l3
ret

Content is copyrighted © www.123mylist.com