You are on page 1of 19

8051 interfacing

ADC interfacing

Mov P1,#FFH
Setb P2.7
Back: Clr P2.6
Setb P2.6
Here: Jb P2.7, Here
Clr P2.5
Mov A, P1
Mov dptr,#4500h
Movx @dptr, A
Setb P2.5
Sjmp Back

DAC interfacing
Digital to analog converter converts digital data to analog
voltage/current signal
Basically two types: binary weighted and R/2R ladder
Most familiar is R/2R ladder type DAC0808

Sawtooth wave
Mov A,#00H
Back: Mov P1,A
Inc A
Sjmp Back
Square/Rectangular wave
Main Mov P1,#00H
Acall delay
Mov P1,#FFH
Acall delay
Sjmp Main

Temperature measurement system

Sensor are thermostats, thermisters or any other


temperature sensors
Usually LM34/35 IC temperature sensors are used;
whose output voltage is directly proportional to the
temperature.
For LM35 temperature range -55 to 150oC, 10mV/oC
sensitivity
Signal conditioner is either amplifier, I-V or V-I
converter etc. to provide suitable input signal to ADC.
ADC converts analog signal corresponding to
temperature into digital data
Microcontroller controls ADC and acquire digital data
corresponding to temperature and process it to get a
suitable signal to display

Mov P1,#FFh
Setb P2.7
Back : Clr P2.6
Setb P2.6
Here : Jb P2.7, Here
Clr P2.5
Mov A, P1
Acall Conv
Acall Data
Setb P2.5
Sjmp Back

Conv : Mov B, #10h


Div AB
Mov R7,B
Mov B,#10
Div AB
Mov R6, B
Mov R5, A
RET
Data : Mov P0, R7
Acall delay
Mov P0, R6
Acall delay
Mov P0, R5
Acall delay
RET

Frequency counter
8051 can be configured to count frequency of
an input signal.
One timer is configured as counter & the
other as timer.
Frequency is calculated as cycles/second

Steps
Counter 0 is configured as event counter (C/=1)
Timer 1 is programmed to give a known delay
interval say 125ms.
Counter 0 is turned ON (TR0=1)
Timer 1 is started (TR1=1)
Proglam monitors TF1 flag for timer overflow.
When TF1 is set Counter 0 is read (TH0:TL0)
This value is the number of pulses received per
125ms
The count value is then multiplied by 8 will get no.
of pulses/second (frequency)

DS12887 RTC INTERFACING


The real-time clock (RTC) is a widely used device
that provides accurate time and date for many
applications.
One of the most widely used RTC chips is the DS
12887 from Dallas Semiconductor/Maxim Corp.
The DS12887 has a total of 128 bytes of
nonvolatile RAM. It uses 14 bytes of RAM for
clock/calendar and control registers, and the
other 114 bytes of RAM are for general-purpose
data storage.

Vcc :- external power supply voltage to chip (+5v). When Vcc falles below 3v,
externalsource is switched off and internal Li battery power is used.
GND :- ground.
AD0 AD7 :- Multiplexed address/data pins. Addresses are latched into
DS12887 on falling edge of AS signal(ALE).
AS :- Used for demultiplexing the address and data and is connected to ALE
pin of 8051.
MOT :- an input pin that allows choice between Motorola and Intel
microcontroller bus timings.
DS :- data strobe(read). Connected to RD pin of 8051.
R/W :- Is an input pin which is connected to WR pin of 8051.
CS :- Is an active low input pin to enable the chip.
IRQ :- Is an active low output pin. To use IRQ interrupt enable bit in register
B must be set.
SQW :- Square wave is an output pin. Can be programmed to provide up to
15 different square waves.
RESET :- An active low input pin. It cause the reset of IRQ and clearing of
SQW pin

You might also like