AIM OF THE EXPERIMENT: To interface the LEDs to the 8051 and blink them continuously.
SOFTWARE REQUIRED: Keil Software
HARDWARE REQUIRED: Computer System, 8051 kit
COURSE OUTCOME/S:ETC/ECE 5.4.5: Design and implement microcontroller based applications
OBJECTIVES (SKILL SET / KNOWLEDGE TESTED / IMPARTED):
The main objective is to get familiar LED interfacing with 8051
To get familiar with 8051 kit
PROCEDURE:
- Open Keil
- Click on Project
- Select New Project
- Give name for the Project and Save.
- Go to SST dialogue box
- Go to SST89X516RD2( Click Ok.
- Click NO (Since the code is in Assembly not C)
- Target ( Source Group 1
- Add a File
- Go to File ( Click New( Save
- Give filename.asm and Save.
- Go to Source group1 ( Add existing file type to asm source file
- Select File
- Add (Close
- Open Source group1 ( File gets added
- Type the Program ( Save
- Click on options for Target
- Change the crystal frequency to 11.059 MHz
- Go to output tab ( Select Hex file ( OK ( Save
- Build the Program
- Select the Target( Go to Project ( Build Target( this will create a Hex file.
- Double click on SST on Desktop
- Click on Start ( Go to My Computer
- Right click and manage ( Go to Device Manager(Ports( Check which port
- Press Reset and keep it pressed ( Go to options ( Select the correct COM port
- Now release the reset at the same time you press OK
- You will see IAP status ( Default target ‘’ is successful
- Click on download( go to filename .hex, which is created after build.
- Click Open ( OK ( Yes
- Done ( Status will be displayed.
- Press Reset on the kit to see the LEDs blinking.
PROGRAM:
; LED Blinking
; Switch setting: SW25: (1-2), SW24: (1-2), SW26: (2-3).
org 00h
ljmp start ;jump to start on reset
;Delay routine approx. 1.5 seconds
delay:
mov r3,#0x02
mov r4,#0x0
mov r5,#0x0
loop:
djnz r5, loop
djnz r4, loop
djnz r3, loop
RET
; LED Blinking main program
start:
mov P2, #00h
acall delay
mov P2, #0FFh
acall delay
sjmp start
END
RESULTS:LED blinking was observed on the 8051 kit
CONCLUSION: LED Program was successfully loaded and run on 8051 kit and LED blinking observed.
DISPLAY OF DIGITS ON THE SEVEN SEGMENT DISPLAY USING 8051
AIM OF THE EXPERIMENT: To interface the Seven Segment Display to the 8051, and display numbers 0-9 continuously.
SOFTWARE REQUIRED: Keil Software
HARDWARE REQUIRED: Computer System, 8051 kit
COURSE OUTCOME/S:ETC/ECE 5.4.5: Design and implement microcontroller based applications
OBJECTIVES (SKILL SET / KNOWLEDGE TESTED / IMPARTED):
The main objective is to get familiar with the Seven Segment interfacing with 8051
To study the Seven segment display
PROCEDURE:
- Open Keil
- Click on Project
- Select New Project
- Give name for the Project and Save.
- Go to SST dialogue box
- Go to SST89X516R02( Click Ok.
- Click NO (Since the code is in Assembly not C)
- Target ( Source Group 1
- Add a File
- Go to File ( Click New( Save
- Give filename.asm and Save.
- Go to Source group1 ( Add existing file type to asm source file
- Select File
- Add (Close
- Open Source group1 ( File gets added
- Type the Program ( Save
- Click on options for Target
- Change the crystal frequency to 11.059 MHz
- Go to output tab ( Select Hex file ( OK ( Save
- Build the Program
- Select the Target( Go to Project ( Build Target( this will create a Hex file.
- Double click on SST on Desktop
- Click on Start ( Go to My Computer
- Right click and manage ( Go to Device Manager(Ports( Check which port
- Press Reset and keep it pressed ( Go to options ( Select the correct COM port
- Now release the reset at the same time you press OK
- You will see IAP status ( Default target ‘’ is successful
- Click on download( go to filename .hex, which is created after build.
- Click Open ( OK ( Yes
- Done ( Status will be displayed.
- Press Reset on the kit to see the LEDs blinking.
PROGRAM:
/*------------------7 Segment Display---------------------*/
/*Switch setting: SW22: (1-2), SW23: (1-2)*/
/*Peripheral: Common Anode 7 Segment Display.* /
/*Interfacing Pins:
P0.0------> A
P0.1------> B
P0.2------> C
P0.3------> D
P0.4------> E
P0.5------> F
P0.6------> G
P0.7------> H
-----------------------------------------------------------------------------------------
Jumper Settings:
J1: 1-2 J2:Any J3:2-3 J4: 1-2 J5:Any J6:2-3
======================================================================*/
org 0x00
ljmp start ;Jump to start on reset
delay: ;delay routine: approx 1.5 second
mov r3,#0x04
mov r4,#0x0
mov r5,#0x0
loop:
djnz r5, loop
djnz r4, loop
djnz r3, loop
RET
;Lookup table for bit patterns for numerals
;TBL: DB 0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10
TBL: DB 0xF6,0x90,0xE5,0xB5,0x93,0x37,0x77,0x94,0xF7,0xB7
start:
mov P0,#0xFF ; Turn off all LEDs
mov r1 ,#0x0A ; Load the count equal to no of digits to be
; Displayed, use register other than used in delay function
mov dptr ,#TBL ; Load the pointer to the start of look up table
LOOP1:
mov a,#00 ; clear the accumulator
movc a ,@a+dptr ; Load the bit pattern for the digit pointed by DPTR
cpl a
mov P0,a
inc dptr ; increment the pointer
lcall delay
djnz r1, LOOP1 ; Loop till all 0-9 digits are displayed on 7-seg
sjmp start ; Go to the start, REstart the numbers 0-9
END
RESULT: Seven Segment displaying numbers 0-9 were observed on the 8051 kit
CONCLUSION: 7-segment Program was successfully loaded and runon 8051 kit and 7-segment display was seen displaying numbers from 0-9 continuously