7 Segment Assembly Code

;** ********************************************************
;** SEVEN SEGMENT LED
;** DATE: 14 FEBRUARY 2011
;** R1 IS USED TO SET VALUE OF 1-DIGITAL DISPLAY VALUE OF SEVEN SEGMENT
;** P1 IS OUT PUT OF SEVEN SEGMENT
;** R7-R6-R5 IS USED FOR DELAY
;** ********************************************************
;** DEVICE : INTEL MICROCONTROLER 8051 (809C51)
;** AURTHOR : SAHARA FOUNDATION – RAJENDRA MAN BANEPALI
;** ********************************************************
;

$MOD51
ORG 0000H ;** STARTING FROM 0H

;*** DEFINE SYMBOLE FOR FOR NUMBER
_ZERO EQU 3FH
_ONE EQU 06H
_TWO EQU 5BH
_THREE EQU 4FH
_FOUR EQU 66H
_FIVE EQU 6DH
_SIX EQU 7DH
_SEVEN EQU 07H
_EIGHT EQU 7FH
_NINE EQU 6FH

START:

;*** CALLING ZERO
ACALL ZERO
LCALL DELAY

;*** CALLING ONE
ACALL ONE
LCALL DELAY

;*** CALLING TWO
ACALL TWO
LCALL DELAY

;*** CALLING THREE
ACALL THREE
LCALL DELAY

;*** CALLING FOUR
ACALL FOUR
LCALL DELAY

;*** CALLING FIVE
ACALL FIVE
LCALL DELAY

;*** CALLING SIX
ACALL SIX
LCALL DELAY

;*** CALLING SEVEN
ACALL SEVEN
LCALL DELAY

;*** CALLING EIGHT
ACALL EIGHT
LCALL DELAY

;*** CALLING NINE
ACALL NINE
LCALL DELAY

;SJMP INC_LED2

;*** GOTO START AGAIN TO REPEAT DISPLAY OF NUMBER
SJMP START

;*** DIGITAL NUMBER DISPLAY VALUE PROCEDURES
ZERO:
MOV R1, #_ZERO
ACALL FLASH
RET

ONE:
MOV R1, #_ONE
ACALL FLASH
RET

TWO:
MOV R1, #_TWO
ACALL FLASH
RET

THREE:
MOV R1, #_THREE
ACALL FLASH
RET

FOUR:
MOV R1, #_FOUR
ACALL FLASH
RET

FIVE:
MOV R1, #_FIVE
ACALL FLASH
RET

SIX:
MOV R1, #_SIX
ACALL FLASH
RET

SEVEN:
MOV R1, #_SEVEN
ACALL FLASH
RET

EIGHT:
MOV R1, #_EIGHT
ACALL FLASH
RET

NINE:
MOV R1, #_NINE
ACALL FLASH
RET

;*** SET VALUE OF R1 TO ACC TO SEND INTO P1 AS SEVEN(7) SEGMENT DISPLAY
FLASH:
MOV A, R1
MOV P1, A
RET ;*** RETURN FROM FLASH

ORG 300H
;** LOOP **
DELAY: MOV R5, #01;
H1: MOV R6, #255;
H2: MOV R7, #255;
H3: DJNZ R7, H3
DJNZ R6, H2
DJNZ R5, H1
RET

END

Advertisements

2 thoughts on “7 Segment Assembly Code

    1. Dear Colleague,

      I have coded in Keil C51 V8.04 and test in Sim8051.

      Sepecially the programme was designed only for 8051 micro-controller.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s