Beruflich Dokumente
Kultur Dokumente
1|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering
INDEX
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
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
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
CIRCUIT DIAGRAM:
6|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering
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
END
CIRCUIT DIAGRAM:
8|Page
Indian Institute of Technology
(Indian School of Mines), Dhanbad
Department of Electronics and Communication Engineering
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
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:
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:
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
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
CIRCUIT DIAGRAM:
RESULT: We have designed the 8051 uC based circuit which generate the 8 bit pn sequence.
19 | P a g e