Robotics

3.7 Using the Microcontroller

Before one uses the microcontroller, he or she should be well aware of the connections of the microcontroller, like which pins are to be used as data pins and which pin is to be given the power supply. Every pin of the microcontroller has a specific function and a wrong connection can completely destroy the chip. The AT89C51 microcontrollers have, in total, 40 pins. Here we will be demonstrating the pin configuration of the 8051 microcontroller. It has an onchip RAM capacity of 128 bytes and ROM size is 4k. But the total ROM size with which it can work is 64k. So when we have programs of size more than 4k, external memory is added to it as per our requirement. If the requirement is of 8k, we can go for an external ROM of size 4k such that it makes a total ROM size of 8k (4k internal + 4k external). In this way we can go for 8k, 16k, 32k, and 64k ROM sizes.

We have different commands for using these memories. Accordingly some of the connections are to be changed. For example, if our program size is below 4k then the 31st pin, which is for external access, is to be given a power supply of 5 volts (an active low pin) but while using external memory we have to ground this pin. We can also use both internal as well as external memories simultaneously, in that case the pin is to be given a power supply of 5 volts because the microcontroller firstly reads internal ROM then goes for external ones. 8051 microcontrollers do have an internal oscillator but to run it, it needs external clock pulses so an external oscillator is added between pins 18 (XTAL1) and 19 (XTAL2). It also requires two capacitors of 30 pF value. One side of each capacitor is grounded.

It must be noted that there are various speeds of the 8051 family. Speed refers to the maximum oscillator frequency connected to the XTAL. For example, a 12 MHz chip must be connected to a crystal with a 12 MHz frequency or less. Likewise, a 20 MHz microcontroller requires a crystal frequency of no more than 20 MHz. When the 8051 is connected to a crystal oscillator and is powered up, we can observe the frequency on the XTAL2 pin using the oscilloscope. Pin 40 of the microcontroller is given a power supply of +5 volts using a single stranded wire; this provides supply voltage to the chip. Pin 20 of the microcontroller is grounded.


Pin diagram of 8051

FIGURE 3.47    Pin diagram of 8051.

Figure 3.47, given, above shows the pin diagram of 8051.

There are four ports in 8051 and every port has 8 pins, so in total there are 32 I/O pins. There are 16 address pins and 8 data pins in it. On port 0 data and address pins are multiplexed. ALE (pin 30) indicates if P0 has address or data. When ALE = 0, it provides data to D0 D7, but when ALE =1, it has addresses at A0 A7. Therefore, ALE is used for demultiplexing addresses and data with the help of a 74LS373 latch. The ninth pin is a reset pin and it is an input and active high (normally low). Upon applying a high pulse to this pin, the microcontroller will reset and terminate all activities. This is often referred to as a power-on reset. Activating a power-on reset will cause all values in the register to be lost.


Figure 3.48 shows a complete circuit diagram of 8051.

Now we can have a program to glow LEDs. When this program is burned in the microcontroller, the LEDs start glowing as per the program written. So


Complete connections of 8051

FIGURE 3.48   Complete connections of 8051.

as to burn the program it can first be written on a simulator like Keil C and its accuracy can be checked by debugging it there. Now the program can be burned on the microcontroller with the help of a programmer.

After the microcontroller is loaded with the program, it can be kept in the proper circuit with accurate connections and LEDs start glowing.

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DC Motors
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.