[go: up one dir, main page]

0% found this document useful (1 vote)
664 views2 pages

Adc Interfacing With 8051

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

ADC 0808/0809 INTERFACING WITH 8051

AIM:
To interface ADC with 8051 to generate digital output by giving an analog input voltage.
APPARATUS REQUIRED;
8051 Trainer Kit
ADC Interface Board
This program selects channel 0 as input channel reads from it & saves in the accumulator.
NOTE: In the LAB, ADC is interfaced with 8051 Microcontroller through 8255 PPI.
Port 2 of 8051 is connected to Port C of 8255, Port 1 of 8051 is connected to Port A of 8255,
Port C is for interfacing signals and Port A is for Reading data from ADC.

PROGRAM:

MOV DPTR, #2023


MOV A, #90: PA-I/P PORT, PORT B, C-O/P PORTS
MOVX @DPTR, A
BEGIN: MOV DPTR, #2022; Select CH-0
MOV A, #00
MOVX @DPTR, A
MOV A, #0DH; Set PC6 (OE)
MOV DPTR, #2023

MOVX @DPTR, A
MOV A, #0FH; SET SOC
MOVX @DPTR, A
LCALL DELAY
MOV A, #0EH
MOVX @DPTR, A
MOV A, #0CH
MOVX @DPTR, A
MOV DPTR, #2020
BACK: MOVX A,@DPTR
JB 0E7, BACK
MOV DPTR, #2020
REP: MOVX A,@DPTR
ANL A, #80H
JNB 0E7, REP
MOV A, #0DH
MOV DPTR, #2023
MOVX @DPTR, A
MOV DPTR, #2020
MOVX A,@DPTR
MOV DPTR, #9000H; Read the digital output from this address
MOVX @DPTR, A
SJMP BEGIN
DELAY: MOV R3, #30H
AGAIN: MOV R4, #FFH
BACK: NOP
NOP
DJNZ R4, BACK
DJNZ R3, AGAIN
RET

You might also like