100% found this document useful (1 vote)
141 views18 pages

INTERFACING

Here are the key steps to interface switches to an 8051 I/O port: 1. Connect one side of each switch to ground 2. Connect the other side of each switch to a separate I/O pin 3. Configure the I/O pins as inputs using SFR registers like P0, P1, etc. 4. Read the pin states using IN instruction to detect switch presses 5. Process accordingly in software based on pin going low on press This allows detecting switch presses as logic 0 on the I/O pin with very low current draw, avoiding accidentally driving outputs high into the switch.

Uploaded by

Rajni Goel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
141 views18 pages

INTERFACING

Here are the key steps to interface switches to an 8051 I/O port: 1. Connect one side of each switch to ground 2. Connect the other side of each switch to a separate I/O pin 3. Configure the I/O pins as inputs using SFR registers like P0, P1, etc. 4. Read the pin states using IN instruction to detect switch presses 5. Process accordingly in software based on pin going low on press This allows detecting switch presses as logic 0 on the I/O pin with very low current draw, avoiding accidentally driving outputs high into the switch.

Uploaded by

Rajni Goel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

INTERFACING

ADC / DAC / I/ O Devices


The ADC 0808/0809 Chip
• The ADC 0808/0809 is an 8-bit analog to digital
converter. It has 8 channel multiplexer to
interface with the microprocessor.
• This chip is popular and widely used ADC. ADC
0808/0809 is a monolithic CMOS device. This
device uses successive approximation technique
to convert analog signal to digital form. One of
the main advantage of this chip is that it does not
require any external zero and full scale
adjustment, only +5V DC supply is sufficient.
Features of ADC
Some good features of ADC 0808/0809
• The conversion speed is much higher
• The accuracy is also high
• It has minimal temperature dependence
• Excellent long term accuracy and repeatability
• Less power consumption
Functional block diagram of ADC
Interfacing ADC with 8085
Microprocessor
Interfacing Details
• The PortA of 8255 chip is used as the input
port. The PC7 pin of Port Cupper is connected to
the End of Conversion (EOC) Pin of the analog
to digital converter. This port is also used as
input port. The Clower port is used as output
port. The PC2-0 lines are connected to three
address pins of this chip to select input
channels. The PC3 pin is connected to the Start
of Conversion (SOC) pin and ALE pin of ADC
0808/0809.
Interfacing Program
MVI A, 98H ; Set Port A and Cupper as input, CLower as output
OUT 03H ; Write control word 8255-I to control Word
register
XRA A ; Clear the accumulator
OUT 02H ; Send the content of Acc to Port Clower to select
IN0
MVI A, 08H ; Load the accumulator with 08H
OUT 02H ; ALE and SOC will be 0
XRA A ; Clear the accumulator
OUT 02H ; ALE and SOC will be low.
READ: IN 02H ; Read from EOC (PC7)
RAL ; Rotate left to check C7 is 1.
JNC READ ; If C7 is not 1, go to READ
IN 00H ; Read digital output of ADC
STA 8000H ; Save result at 8000H
HLT ; Stop the program
Control Word of 8255
D7 D6 D5 D4 D3 D2 D1 D0 Group B
Port C Lower PC3-PC0
1 = input, 0 = output
Port B
1 = input, 0 = output
Mode Selection
0 = Mode0, 1 = Mode1

Group A
Port C Upper PC7-PC4
1 = input, 0 = output
Port A
1 = input, 0 = output
Mode Selection
00 = Mode0, 01 = Mode1
1x = Mode 2
1 = I / O Mode
0 = BSR Mode
8255 Design Example

D0 D0
A
D7 D7
B
IOW WR
IOR RD
CL
A2 A0 A0
System A1 A1 CH
Address Bus CS

A7
Interface DAC to a CPU
• DAC (Digital-to-Analog Converter)
– Device used to convert digital pulses to analog
signals
– Two methods of making the DAC
• Binary weighted
• R / 2R ladder
• The vast majority of IC use R / 2R since it can achieve a
much high degree of precision
Criterion for Judging a DAC: Resolution
• Resolution is a function of the number of
binary inputs.  common ones are 8, 10, 12
pins
• The number of analog output levels is equal to
2n, where n is the number of data inputs
 8-input DAC (MC1408)
gives 256 discrete voltage/current levels of output
 12-input DAC  4096 voltage/current levels
 16-input DAC  65,536 voltage/current levels
MC1480 DAC (or DAC 808)
• In MC1480, the digital inputs are converted to
current (Iout) and by connecting a resister to the
Iout pin, we convert the result to voltage.
• The current provided by Iout is a function of binary
numbers at D0-D7 and the reference current.
• Iref is generally set to 2.0 mA.
• Iout = Iref . (D7/2 + D6/4 + D5/8 + D4/16 + D3/32 +
D2/64 + D1/128 + D0/256).
Interface DAC to CPU
• Example1
– Interface MC1480 to Microprocessor through PPI
8255
• Example2
– Interface AD558 directly to Microprocessor
Interface MC1480 to
Microprocessor through PPI 8255
+5

1k

1.5k
D0 D0 PA0 A8(LSB) Vref(+)
... ... . . .
. . .
D7 D7 2.5k
. . . Vref(-)
. . .
IOW WR
PA7 A0(MSB) To Scope
IOR RD
8255 Vout = 0 - 10v
MC1480
A0 A0
COMP R = 5k
A1 A1
A2 100 pf
... Decoding
A9 CS VEE
AEN
Circuitry RESET GND
-12 v

VCC
MOV AL, 80H
OUT PCtrl, AL Imax = 1.99 mA
MOV AL, 0 Vmax = 9.95 V
Cont: OUT PA, AL 9.95 v
INC AL
CMP AL, 0
JZ Stop
MOV CX, 0FFFFH
Here: LOOP Here
0v
JMP Cont
Stop: INT 6
• LED is directly connected to the microcontroller. The
negative terminal of the LED is connected to the
ground through a resistor. Value of this resistor is
calculated using the following formula.
R= (V-1.7)/10mA,
where V is the input voltage.
• Generally, microcontrollers output a maximum
voltage of 5V. Thus the value of resistor calculated for
this is 330 Ohms. Thus this can be connected either
to the cathode or anode of the LED.
8051 - Switch On I/O Ports

• Case-1:
– Gives a logic 0 on switch close
– Current is 0.5ma on switch close

• Case-2:
– Gives a logic 1 on switch close
– High current on switch close

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy