0% found this document useful (0 votes)
192 views

Lab9 Report

This document summarizes a lab experiment on interfacing an analog to digital converter (ADC0804) with an 8051 microcontroller using assembly language. The objectives are to explain the interfacing and use assembly programming. The tasks involve creating an assembly program to convert analog voltage to digital and display on LEDs. The code samples show interfacing definitions, the conversion subroutine, and driving LEDs depending on the conversion result. Simulation in Proteus is used to verify the interface and program functionality. The conclusion is that the lab helped understand microcontroller concepts through practical simulation exercises.

Uploaded by

ASAD REHAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
192 views

Lab9 Report

This document summarizes a lab experiment on interfacing an analog to digital converter (ADC0804) with an 8051 microcontroller using assembly language. The objectives are to explain the interfacing and use assembly programming. The tasks involve creating an assembly program to convert analog voltage to digital and display on LEDs. The code samples show interfacing definitions, the conversion subroutine, and driving LEDs depending on the conversion result. Simulation in Proteus is used to verify the interface and program functionality. The conclusion is that the lab helped understand microcontroller concepts through practical simulation exercises.

Uploaded by

ASAD REHAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CPE-342 MSI

LAB # 9
To interface an Analogue to Digital Converter (ADC) with 8051 MCU using
Assembly Language programming

Name Asad Rehan

Registration No# FA17-BCE-005

Batch FA17-BCE-A

Instructor’s Name Sir Usman Rafique


Objectives :
• To explain the interfacing of ADC0804 with the AT89C51 MCU using PROTEUS.
• To interface an Analogue to Digital Converter (ADC) with 8051 MCU using Assembly
Language programming
Lab Tasks:
TASK 1:
Create an assembly language program the converts the analog voltage into digital value and
displays it on LED bar display

Code:
ADC_WR EQU P2.0
ADC_RD EQU P2.1
ADC_INT EQU P2.2
LED EQU P1
ADC EQU P3
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
CALL DELAY
CALL CONVERT ;RESULT IS IN A
MOV LED, A ;WRITE RESULT TO BAR DISPLAY
JMP MAIN
CONVERT:
SETB ADC_WR
SETB ADC_RD
NOP
CLR ADC_WR
NOP
SETB ADC_WR
JB ADC_INT,$ ;POLL FOR INTR = 0
CLR ADC_RD
NOP
MOV A, ADC ;READ ADC PORT IN A
SETB ADC_RD
RET
;SUBROUTINE GENERATES SOME DELAY
DELAY:
MOV R1, 250
LOOP1:
MOV R0, #0FFH
DJNZ R0, $
MOV R0, #0FFH
DJNZ R0, $
MOV R0, #0FFH
DJNZ R0, $
MOV R0, #0FFH
DJNZ R0, $
DJNZ R1, LOOP1
RET
END

Proteus Simulation:

TASK 2:
Code:
ADC_WR EQU P2.0
ADC_RD EQU P2.1
ADC_INT EQU P2.2
LED EQU P1
ADC EQU P3
ORG 0000H
LJMP MAIN
ORG 0030H
MAIN:
CALL DELAY
CALL CONVERT ;RESULT IS IN A
CJNE A,#150,LEDOFF
JMP LEDON
JMP MAIN
CONVERT:
SETB ADC_WR
SETB ADC_RD
NOP
CLR ADC_WR
NOP
SETB ADC_WR
JB ADC_INT,$ ;POLL FOR INTR = 0
CLR ADC_RD
NOP
MOV A, ADC ;READ ADC PORT IN A
SETB ADC_RD
RET

;SUBROUTINE GENERATES SOME DELAY

LEDOFF:
MOV LED, #0FFH ;WRITE RESULT TO BAR DISPLAY
LEDON:
MOV LED, #00H ;WRITE RESULT TO BAR DISPLAY
DELAY:
MOV R1, 250
LOOP1:
MOV R0, #0FFH
DJNZ R0, $
MOV R0, #0FFH
DJNZ R0, $
MOV R0, #0FFH
DJNZ R0, $
MOV R0, #0FFH
DJNZ R0, $
DJNZ R1, LOOP1
RET
END

Conclusion:
This lab experiment proved to be crucially helpful in understanding basic concepts of different
scenarios related to this specific microcontroller and so with the help of proteus and different simulation
softwares, this purpose was achieved.

You might also like