Sie sind auf Seite 1von 19

Indian Institute of Technology

(Indian School of Mines), Dhanbad


Department of Electronics and Communication Engineering

Indian Institute of Technology


(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

3 Year M.Tech. Programme


(Electronics and Communication Engineering)

Name Ayushi Gaur


Roll No. 17KT000247
Course M.Tech. (ECE)
Subject Embedded System Lab

1|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

Indian Institute of Technology, (ISM), Dhanbad


Institute Industry Interaction Facility, New Delhi

INDEX

S. Experiment Name Page No Remarks


No.
1 Design an 8051 μC based circuit and its associated program to 3
implement 4 bit binary counter using LEDs
2 Write a program to implement up/ down counter using two general 6
purpose I/O pins as control inputs.
3 Write a program to implement up/ down counter using one interrupt 8
pin as a control input.
4 Write a program to Interface 2 seven segment displays (in 10
multiplexing Mode) with an 8051 μC to realize digital (seconds)
clock. Two general purpose I/O pins as control inputs.
5 Write a program to Interface a DAC with 8051 μC and generate a 12
ramp output through it.
6 Write a program to Interface a LCD t display a message 16
‘WELCOME” with 8051 μC .
7 Write a program to Design an 8 bit pn sequence generator 18
circuit based on 8051 μC. .

2|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 01
Design an 8051 μC based circuit and its associated program to implement 4 bit binary
counter using LEDs.
Aim: Design an 8051 μC based circuit and its associated program to implement 4 bit binary
counter using LEDs
Apparatus Required: Personal Computer, NI Multisim 2013, Keil Software for Program
Verification
Program:
4 Bit Binary COUNTER (0 to 9)

ORG 0000h
MOV A, #00H
REPEAT: MOV P2, A
INC A
LCALL DELAY
SJMP REPEAT
DELAY: MOV R1, #0FFH
HERE1: MOV R2, #0FFH
HERE: DJNZ R2, HERE
DJNZ R1, HERE1
RET
END

BCD COUNTER (0 to 9)

ORG 0000h
REPEAT:MOV A, #00H
L1:MOV P2, A
LCALL DELAY
INC A
CJNE A, #0AH, L1
SJMP REPEAT
DELAY: MOV R1, #01FH
HERE1: MOV R2, #01FH
HERE: DJNZ R2, HERE
DJNZ R1, HERE1
RET
END

CIRCUIT DIAGRAM:

3|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

Circuit Diagram Using LEDs

Circuit Diagram Using Seven Segment Display (0 to 9)


RESULT: We have design the 8051 uC based circuit for 4 bit binary counter using LEDs and also
interfacing of seven segment display with 8051.

4|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 02
Write a program to implement up/ down counter using the following input specifications.
a) Two general purpose I/O pins as control inputs.
b) One interrupt pin as a control input.
Aim: Write a program to implement up/ down counter using two general purpose I/O pins as
control inputs.

Appratus Required: Personal Computer, NI Multisim 2013, Keil Software for Program
Verification
Program:
Using LEDs
$MOD51 ; This includes 8051 definitions for the Metalink assembler

ORG 0000h
SETB P3.0
SETB P3.1
MOV A, #00H
LOOP:JNB P3.0, UP
JNB P3.1, DOWN
MOV P1, A
SJMP LOOP
UP: MOV P2, A
INC A
JNB P3.1, DOWN
LCALL DELAY
SJMP UP
DOWN: MOV P2, A
DEC A
JNB P3.0, UP
LCALL DELAY
SJMP DOWN

DELAY: MOV R0, #01FH


HERE1: MOV R1, #01FH
HERE: DJNZ R1, HERE
DJNZ R0, HERE1
RET
END

Using Seven Segment Display

$MOD51 ; This includes 8051 definitions for the Metalink assembler

org 0000h
SETB P3.0
SETB P3.1
MOV A, #00H
LOOP:JNB P3.0, UP
JNB P3.1, DOWN
MOV P1, A
SJMP LOOP
UP: MOV A, #00H

5|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

L1: MOV P2, A


LCALL DELAY
INC A
JNB P3.1, DOWN
CJNE A, #0AH, L1
SJMP UP
DOWN: MOV A, #09H
L2: MOV P2, A
LCALL DELAY
DEC A
JNB P3.0, UP
CJNE A, #00H, L2
SJMP DOWN
DELAY: MOV R0, #015H
HERE1: MOV R1, #015H
HERE: DJNZ R1, HERE
DJNZ R0, HERE1
RET
END

CIRCUIT DIAGRAM:

Circuit Diagram Using LEDs

6|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

Circuit Diagram Using Seven Segment Display (0 to 9)


RESULT: We have used two pins of port 3 as a general purpose interrupt for up down counter.

7|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 03
Write a program to implement up/ down counter using the following input specifications.
a) Two general purpose I/O pins as control inputs.
b) One interrupt pin as a control input.
Aim: Write a program to implement up/ down counter using one interrupt pin as a control input.

Appratus Required: Personal Computer, NI Multisim 2013, Keil Software for Program
Verification
Program:
org 0000h
LJMP MAIN

ORG 0003h
L1: MOV P2, A
LCALL DELAY
DEC A
LCALL DELAY
CJNE A, #00H, L1
LCALL DELAY
MOV A, #09H
RETI

MAIN: MOV IE, #081H


MOV A, #00H
L2: MOV P2, A
LCALL DELAY
INC A
LCALL DELAY
CJNE A, #0AH, L2

DELAY: MOV R3, #010H


HERE1: MOV R4, #002H
HERE: DJNZ R4, HERE
DJNZ R3, HERE1
RET

END
CIRCUIT DIAGRAM:

8|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

Circuit Diagram Using Seven Segment Display (0 to 9)


RESULT: We have used INT0 as an interrupt for up-down counter.

9|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 04
Interface 2 seven segment displays (in multiplexing Mode) with an 8051 μC to realize
digital (seconds) clock. Two general purpose I/O pins as control inputs.
Aim: Write a program to Interface 2 seven segment displays (in multiplexing Mode) with an 8051
μC to realize digital (seconds) clock. Two general purpose I/O pins as control inputs.
Appratus Required: Personal Computer, NI Multisim 2013, Keil Software for Program
Verification
Program:
$MOD51 ; This includes 8051 definitions for the Metalink assembler
; This program is interfacing of clock display

ORG 0000h
REPEAT:MOV A, #00H
MOV R0, #00H
L2:MOV P0, R0
LCALL DELAY
INC R0
L1: MOV P2,A
LCALL DELAY
INC A
CJNE A, #0AH, L1
MOV A, #00H
MOV P2,A
CJNE R0,#06H, L2
MOV R0,#00H
MOV P0,R0
SJMP REPEAT
DELAY: MOV R1, #005H
HERE1: MOV R2, #005H
HERE: DJNZ R2, HERE
DJNZ R1, HERE1
RET
END

CIRCUIT DIAGRAM:

10 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

Circuit Diagram Interfacing of Two Seven Segment Display (0 to 59)


RESULT: We have design the 8051 uC based circuit for interfacing of two seven segment display
for clock timer generation.

11 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 05
Interface a DAC with 8051 μC and generate a ramp output through it.

Aim: Write a program to Interface a DAC with 8051 μC and generate a ramp output through it.

Appratus Required: Personal Computer, NI Multisim 2013, Keil Software for Program
Verification
Program:
TRIANGULAR WAVE

ORG 0000H
MOV P2,#00H
REPEAT:ACALL TRIWAVE ; GENERATE TRIANGULAR WAVE
SJMP REPEAT
TRIWAVE:MOV A,#00H
INCR:MOV P2,A
INC A
CJNE A,#0FFH,INCR
DECR:MOV P2,A
DEC A
CJNE A,#00H,DECR
RET
END

SQUARE WAVE

ORG 0000H
MOV P2,#00H
REPEAT:ACALL SQUARWAVE
SJMP REPEAT
SQUARWAVE:MOV P2,#0FFH
ACALL DELAY
MOV P2,#00H
ACALL DELAY
RET
DELAY:MOV R0, #10H
HERE:DJNZ R0, HERE
RET
END

RAMP WAVE

ORG 0000H
MOV P2,#00H
REPEAT:ACALL RAMPWAVE; GENERATE RAMP WAVE
SJMP REPEAT
RAMPWAVE:MOV A,#00H
INCR:MOV P2,A
INC A
CJNE A,#0FFH,INCR
MOV P2,#00H
RET
END

12 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

CIRCUIT DIAGRAM:

DAC Interface with 8051

13 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

14 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

RESULT: We have design the 8051 uC based circuit for interfacing of DAC to generate different
type of waveforms.

15 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 06
Interface a LCD t display a message ‘WELCOME” with 8051 μC .

Aim: Write a program to Interface a LCD t display a message ‘WELCOME” with 8051 μC .

Appratus Required: Personal Computer, NI Multisim 2013, Keil Software for Program
Verification
Program:
$MOD51 ; This includes 8051 definitions for the Metalink assembler

ORG 0000H
MOV 81H,#30H
MOV A, #3Ch
LCALL COMMAND
MOV A, #0Eh
LCALL COMMAND
MOV A, #01h
LCALL COMMAND
MOV A, #86h
LCALL COMMAND
MOV A, #'W'
LCALL DISPLAY
MOV A, #'E'
LCALL DISPLAY
MOV A, #'L'
LCALL DISPLAY
MOV A, #'C'
LCALL DISPLAY
MOV A, #'O'
LCALL DISPLAY
MOV A, #'M'
LCALL DISPLAY
MOV A, #'E'
LCALL DISPLAY
HERE: SJMP HERE
COMMAND: LCALL READY
MOV P2,A
CLR P3.2
CLR P3.3
SETB P3.4
CLR P3.4
RET
READY: CLR P3.4
CLR P3.2
MOV P2, #0FFH
SETB P3.3
READ: SETB P3.4
CLR P2.7
JB P2.7, READ
CLR P3.4
RET
DISPLAY: LCALL READY
MOV P2,A

16 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

SETB P3.2
CLR P3.3
SETB P3.4
CLR P3.4
RET
END

CIRCUIT DIAGRAM:

LCD Interface with 8051

RESULT: We have designed the 8051 uC based circuit for interfacing of 16x2 LCD Display.

17 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

EXPERIMENT NO: 07
Design an 8 bit pn sequence generator circuit based on 8051 μC.

Aim: Write a program to Design an 8 bit pn sequence generator circuit based on 8051
μC.

Appratus Required: Personal Computer, NI Multisim 2013, Keil Software for Program Verification
Program:
$MOD51 ; This includes 8051 definitions for the Metalink assembler

ORG 0000H
SJMP MAIN
ORG 0003H ; sets the starting address for the ISR
ACALL ISR ; calls the ISR subroutine when S2 is pressed
RETI ; return from interrrupt

MAIN:SETB IP.0 ; this part sets the initial conditions


SETB TCON.0
SETB IE.0
SETB IE.7
MOV P2,#00h
MOV P1,#00h
MOV DPTR,#LUT ; moves the starting address of LUT to DPTR

LABEL:MOV R6,#99D ; this part generates the random number


LOOP:MOV A,R6
DJNZ R6,LOOP
SJMP LABEL

ISR: MOV A,R6 ; Subroutine ISR displays the current random number
MOV B,#10D
DIV AB
SETB P1.2
ACALL DISPLAY
MOV P2,A
ACALL DELAY
MOV A,B
CLR P1.2
SETB P1.1
ACALL DISPLAY
MOV P2,A
ACALL DELAY
CLR P1.1
SJMP ISR
RET

DELAY: MOV R3,#02H ; this subroutine creates 1mS delay for switching the displays
DEL1: MOV R2,#03H
DEL2: DJNZ R2,DEL2
DJNZ R3,DEL1
RET

DISPLAY: MOVC A,@A+DPTR ; produces the digit drive pattern for the current digit in A

18 | P a g e
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering

RET

LUT: DB 3FH ; Look up table


DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH
END

CIRCUIT DIAGRAM:

LCD Interface with 8051

RESULT: We have designed the 8051 uC based circuit which generate the 8 bit pn sequence.

19 | P a g e

Das könnte Ihnen auch gefallen