You are on page 1of 5

Power Supply for 8051 Microcontroller

This section describes how to generate +5V and +12V DC power supply

The power supply section is the important one. It should deliver constant output regulated power
supply for successful working of the project. A 0-12V/500 mA transformer is used for this
purpose. The primary of this transformer is connected in to main supply through on/off switch&
fuse for protecting from overload and short circuit protection. The secondary is connected to the
diodes to convert 12V AC to 12V DC voltage. And filtered by the capacitors ,Which is further
regulated to +5v, by using IC 7805
Analog signals are very common inputs to embedded systems .Most transducers and sensors such as
temperature ,pressure ,velocity ,humidity are analog. Therefore we need to convert these analog
signals in to digital so that 8051 can read it.

 ANALOG DIGITAL TO CONVERTER - ADC

Commonly used ADC device – ADC804

ABOUT IC

  PinOut
 • CS – Chip Select , active low
 • RD – Read Digital data from ADC, H-L edge triggered
 • WR -- Start conversion, L-H pulse edge triggered
 • INTR -- end of conversion, Goes low to indicate conversion done
 • Data bits -- D0-D7
 • CLK IN & CLK R
–  CLK IN is an input pin connected to an external clock source when an external clock is used for
timing. However, ADC804 has an internal clock  
   generator.
   To use the internal clock generator of the ADC804, the CLK IN and CLK R pins are connected to a
capacitor and a resistor. In that case, the  
   clock frequency is determined by the equation.
 
   f = 1/1.1RC
   R=10K and C=150pF f=606Hz
   the conversion time is 110us. 

 
Vref/2 Vin
 Input Voltage range Step size (mV)
(Volts) (Volts)
• Default 0-5V. Can be changed by setting different Open (2.5) 0 to 5 5/256 = 19.53
value for Vref/2 pin. 2.56 0 to 5.12 5.12/256 =20
   Vin=Vin(+) – Vin (-) 1.28 0 to 2.56 2.56/256 = 10
0.5 0 to 1 1/256=3.90

• Range = 0 to 2x Vref/2.
    for Vin = 2x Vref/2. we get 256 as a digital output on D0-D7. (Refer Table)
•Step Size a Smallest change
– (2 x Vref/2)/ 256 for ADC804
for eg for  step size 10mv ,digital output on D0-D7 changes by one count for every 10mv change of 
the input analog voltage.

 Data Out
 Dout = Vin / Step Size

for input vtg. of 2.56 volts (Vref=1.28 volts)  and stepsize of 10mv Dout =2560/10 =256  or FF that is
full scale output.

Conversion Time
 Greater than 110us for ADC804 

Resolution
 8 bits for ADC804 

INTERFACING ADC804 TO 8051


Signals to be interfaced (on the ADC804)
– D0-D7, RD, WR, INTR, CS
 Can do both Memory mapping and IO mapping
 

Memory Mapping (timing is critical)


– Connect D0-D7 of ADC804 to the data bus of the 8051 system
– Connect RD, WR of the ADC804 to the 8051 system (ensure polarity)
– Connect CS of ADC804 to an appropriate address decoder output
– Connect INTR of ADC804 to an external interrupt Pin on the 8051 (INT0 or INT1) 

IO Mapping (easiest - I prefer )


– Connect D0-D7, RD, WR, CS, INTR to some port bits on the 8051 (12 in all).

Algorithm
• Make CS=0 and send a low-to-high to pin WR to start the conversion.
• Keep monitoring INTR
– If INTR =0, the conversion is finished and we can go to the next step.
– If INTR=1, keep polling until it goes low.
• After INTR=0, we make CS=0 and send a high-to-low pulse to RD to get the data out of the ADC804
chip.

 
ASSEMBLY LANGUEGE       (A51)  

   

ADC_IO:
  mov P1, #0xff ; To configure as input
   
 
 
AGAIN
  clr p3.7 ;Chip select
setb P3.6 ;RD=1
clr P3.5 ;WR=0
 
setb P3.5 ;WR=1- low to high transition
 

WAIT:
 jb P3.4, WAIT ;wait for INTR
clr p3.7 ;generate cs to ADC
clr P3.6 ;RD=0 -High to low transition
mov A, P1 ;read digital o/p
sjmp AGAIN

You might also like