Professional Documents
Culture Documents
8051 Interfacing
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
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
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)
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