clock

Saturday 25 May 2013

Basic circuit configurations to use microcontrollers as AT89c2051/AT89C4051 and 89C51/89C52/89S51/89S52


 WARNING: BEFORE STARTING MAKING THIS CIRCUITS POSSIBLE I WILL LIKE YOU TO KNOW THAT THIS CIRCUITS HAS BEEN TESTED AND ARE WORKING WELL. ANY DAMAGE TO YOUR CONTROLLER DUE TO WRONG CONNECTIONS IS UP TO YOU.


I have come across many difficulties during interfacing my other circuits for the AT89xxx series. I will give you basic circuits you require to use microcontroller to work properly.

First, we need a good power supply circuit!
What features do we need in a power supply circuit???
1. Voltage requirements (mostly +5Vdc)
2. Reverse Polarity protection
3. A proper step down ac to dc conversion circuit.
4. High voltage protection.



Secondly,
The basic circuit to make microcontroller AT89C51/AT89S51/AT89C52/AT89S52 work at start is given below (Here our main aim is only to start a controller assuming there is no external RAM).
(Very Important: After lots of research in this circuits I have finally concluded all the microcontrollers in 80x51 series needs external 10k ohms Pull Up resistor even when the below transistor drivers are into action. Do not forget to use them)

And to interface microcontrollers AT89C2051 and AT894051 we keep the circuit same accept the pins change this time.

The above circuits are related to basics to start a microcontroller. But we need more like interfacing with IO's and driving some drivers.

Lets start with Interfacing input to the microcontroller. 
There are lots of ways you can do that. I usually use two methods.
1. Pull up resistor type.
2. Transistor driver type.
Transistor driver type has high succesful rate of driving inputs and outputs of microcontrollers. The input can be another microcontroller ouput or driver output or any other logic circuit.


 The above circuit will work only if the input signal is digital to the transistor. Value of R1 and R2 are calculated according to maximum ratings. Assuming the source of the signal and transistor Q1 are same.
R2 = Vin/Ib
where Vin is digital input voltage (+5v) , Ib is ideal base current to drive Q1 (5mA).
R2 = 5 / 0.005 = 1k ohms
To calculate R1 we need to know what is the ideal drive current for At89c51 microcontroller. If you check our the datasheet you will find it is 20mA.
So R1 = Vcc/Imax = 5/.020 = 250Ohms

In this configuration, when the input at transistor is high (+5V), the input at the microcontroller will be low (0V). And when input at transistor is low (0V), the input at the microcontroller will be high (+5V).  If the voltage varies at the input of R2. You need to see the max value of voltage there and adjust the value of R2 according to the above formula.

 Now lets consider how to drive outputs on this microcontroller.

We need to consider everything here. Typically the output varies from 2.4V to 4.5V here. You need to find out which port gives what voltage after constructing basic circuit on bread board.

Assuming voltage 2.4V lets construct our output driver for 5V logic circuit.


This is also similar circuit as input accept the voltages are different here.
In this case, the input voltage to the transistor now varies from 2.4V to 4.5V depending on full load over the IC.
Lets assume the output of the microcontroller is 2.4V.
R2 = 2.4/0.005 = 480Ohms
Since we gonna drive TTL logic of +5V we will assume output at Vcc level at 25mA( Maximum current of the device you going to drive at +5V).
R1 = 5/0.025 = 200Ohms

In this configuration, when the input at transistor is high (+5V), the digital output will be low (0V). And when input at transistor is low (0V), the digital output will be high (+5V).  If the voltage varies at the input of R2. You need to see the max value of voltage there and adjust the value of R2 according to the above formula.

Your output driver is ready. Have fun interfacing circuits to 8051 series of microcontrollers.

No comments :

Post a Comment