Вы находитесь на странице: 1из 25

CHAPTER 1

INTRODUCTION

1.1 MICROCONTROLLER
A microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a single
integrated circuit containing a processor core, memory, and programmable input/output
peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on
chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded
applications, in contrast to the microprocessors used in personal computers or other general
purpose applications.Microcontrollers are used in automatically controlled products and devices,
such as automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, and toys. By reducing the size and cost compared to a design
that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it
economical to digitally control even more devices and processes. Mixed signal microcontrollers
are common, integrating analog components needed to control non-digital electronic
systems.Some microcontrollers may use four-bit words and operate at clock rate frequencies as
low as 4 kHz, for low power consumption (milliwatts or microwatts). They will generally have
the ability to retain functionality while waiting for an event such as a button press or other
interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just
nanowatts, making many of them well suited for long lasting battery applications. Other
microcontrollers may serve performance-critical roles, where they may need to act more like a
digital signal processor (DSP), with higher clock speeds and power consumption.A
microcontroller is a programmable device that can read inputs from external devices, analyze the
input, and then output control signals to external devices. There is a whole range of both analog
and digital devices that serve a wide variety of purposes. Simple devices like pushbuttons,
switches, keypads, temperature and humidity sensors, lights, buzzers, speakers, LCD displays,
servo motors and stepper motors. More complex devices include motion sensors, accelerometers,
1

infrared and sonar rangefinders, electronic compasses, and GPS units. Microcontrollers can even
send data to and receive data from other systems like your personal computer, home automation
systems, lighting and environment controllers, industrial control systems, laboratory control
systems, etc.
A microcontroller can communicate with other devices and systems (including other
microcontrollers) using a wide variety of interfaces: standard serial line, wireless (infrared, radio,
satellite, etc.), even the Internet. The possibilities are limited only by your imagination.
Microcontrollers are used by scientists, engineers, experimenters and hobbyists alike to build
things for work and play. More and more, everyday items all around us have microcontrollers
inside them - from your coffee pot and microwave oven to your TV, DVD/VCR, stereo, cell
phone and other wireless devices. Even your car has microcontrollers in it if it is relatively new.
The newest passenger jets have literally hundreds of microcontrollers in them. These are all
examples of microcontrollers employed in embedded systems.
1.2 TYPES OF MICROCONTROLLERS
Parallax Propeller
Freescale 68HC11 (8-bit)
Intel 8051
Silicon Laboratories Pipelined 8051 Microcontrollers
ARM processors (from many vendors) using ARM7 or Cortex-M3 cores are generally
microcontrollers
STMicroelectronicsSTM8 (8-bit), ST10 (16-bit) and STM32 (32-bit)
AtmelAVR (8-bit), AVR32 (32-bit), and AT91SAM (32-bit)
FreescaleColdFire (32-bit) and S08 (8-bit)
Hitachi H8, Hitachi SuperH (32-bit)
Hyperstone E1/E2 (32-bit, First full integration of RISC and DSP on one processor core
[1996] [1])
Infineon Microcontroller: 8, 16, 32 Bit microcontrollers for automotive and industrial
applications
[6]

MIPS (32-bit PIC32)
2

NEC V850 (32-bit)


PIC (8-bit PIC16, PIC18, 16-bit dsPIC33 / PIC24)
PowerPC ISE
PSoC (Programmable System-on-Chip)
Rabbit 2000 (8-bit)
Texas Instruments MicrocontrollersMSP430 (16-bit), C2000 (32-bit), and Stellaris (32-
bit)
Toshiba TLCS-870 (8-bit/16-bit)
XMOSXCore XS1 (32-bit)
Zilog eZ8 (16-bit), eZ80 (8-bit)

1.3 FEATURES
The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited
to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and
Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051
models often have a different form factor, and are not "drop-in compatible". All these things are
called 8051 because they can all be programmed using 8051 assembly language, and they all
share certain features (although the different models all have their own special features).
Some of the features that have made the 8051 popular are:
64 KB on chip program memory.
128 bytes on chip data memory(RAM).
4 reg banks.
128 user defined software flags.
8-bit data bus
16-bit address bus
32 general purpose registers each of 8 bits
16 bit timers (usually 2, but may have more, or less).
3

3 internal and 2 external interrupts.


Bit as well as byte addressable RAM area of 16 bytes.
Four 8-bit ports, (short models have two 8-bit ports).
16-bit program counter and data pointer.
1 Microsecond instruction cycle with 12 MHz Crystal.
8051 models may also have a number of special, model-specific features, such as UARTs, ADC,
OpAmps, etc












4

CHAPTER 2
MICROCONTROLLER AT89C51

2.1 MICROCONTROLLER AT89C51


Fig 2.1 Diagram showing microcontroller AT89c51

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of
Flash programmable and erasable read only memory (PEROM). The device is manufactured
using Atmels high-denity nonvolatile memory technology and is compatible with the industry-
standard MCS-51 instruction set and pinout. The on-chip Flash allows the program memory to
be reprogrammed in-system or by a conven- tional nonvolatile memory programmer. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a
powerful microcomputer which provides a highly-flexible and cost-effective solution to many
embedded control applications.

5


2.2 COMPARISION BETWEEN MICROCONTROLLER 8051
AND AT89C51
The main difference between them lies in the following points:
Pin function: Pins almost identical changes were, in the AT89S51 in P1.5, P1.6, P1.7 have a
second function, that is, the second 3-pin serial ISP function formed programming interface.
Programmability: AT89C51 only supports parallel programming, But AT89S51 supports both
parallel programming and ISP programming.
Voltage in the programming area, AT89C51 in addition to normal programming voltage of 5V,
another 12v is needed for Vpp. But AT89S51 just need to be 4-5V.
Endurance: AT89C51 flash memory can be programmed upto 1000 times while the AT89S51
can be programmed from 1000-10000 times, so that the learner repeated the beginning of a more
favorable programmer, reducing learning costs.
Frequency: AT89C51 limits the operating frequency is 24MHZ, and AT89S51 maximum
operating frequency is 33MHZ, (AT89S51 chip in two models, to support the maximum
operating frequency of 24MHZ and 33MHZ) in order to have a faster computing speed.
Power Supply: AT89S51 operating voltage range is up to 4-5.5V, while the AT89C51 at the end
of the 4.8V and 5.3V.
Anti-jamming more: AT89S51 has integrated watchdog timer (Watchdog Timer), and
AT89C51 needs an external watchdog timer circuit, or single-chip software constitute the
internal watchdog timer to achieve anti-jamming software.



6



CHAPTER 3
FEATURES OF MICROCONTROLLER

3.1 BASIC FEATURES OF AT89C51
4K Bytes of Re-programmable Flash Memory.
RAM is 128 bytes.
2.7V to 6V Operating Range.
Fully Static Operation: 0 Hz to 24 MHz.
Two-level Program Memory Lock.
128 x 8-bit Internal RAM.
32 Programmable I/O Lines.
Two 16-bit Timer/Counters.
Six Interrupt Sources.
Programmable Serial UART Channel.

7


CHAPTER 4
PIN CONFIGURATION
4.1 PIN DESCRIPTION OF AT89C51
The AT89C51 is a low-voltage, high-performance CMOS 8-bit microcomputer with 4K bytes of
Flash programmable memory. The device is manufactured using Atmels high-density
nonvolatile memory technology and is compatible with the industry-standard MCS-51
instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel
AT89C51 is a powerful microcomputer, which provides a highly flexible and cost-effective
solution to many embedded control applications.In addition, the AT89C51 is designed with static
logic for operation down to zero frequency and supports two software selectable power saving
modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and
interrupt system to continue functioning. The power-down mode saves the RAM contents but
freezes the oscillator disabling all other chip functions until the next hardware reset.





8


4.1.1Pin Diagram



Fig 4.1 pin digram of AT89c51

4.2.1. Pin Description


Vcc
Pin 40 provides supply voltage to the chip. The voltage source is +5V.
GND
Pin 20 is the ground.
XTAL1 and XTAL2
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that
can be configured for use as an on-chip oscillator, as shown in Figure 11. Either a quartz crystal
or ceramic resonator may be used. To drive the device from an external clock source, XTAL2
should be left unconnected while XTAL1 is driven, as shown in the below figure. There are no
requirements on the duty cycle of the external clock signal, since the input to the internal
clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low timespecifications must be observed
10


Fig 4.2 Oscillator Connections

C1, C2 =30 pF 10 pF for Crystals
=40 pF 10 pF for Ceramic Resonators
11


Fig 4.3External Clock Drive Configuration


RESET
Pin9 is the reset pin. It is an input and is active high. Upon applying a high pulse to this pin, the
microcontroller will reset and terminate all the activities. This is often referred to as a power-on
reset.
EA (External access)
Pin 31 is EA. It is an active low signal. It is an input pin and must be connected to either Vcc or
GND but it cannot be left unconnected. The 8051 family members all come with on-chip ROM
to store programs. In such cases, the EA pin is connected to Vcc. If the code is stored on an
12

external ROM, the EA pin must be connected to GND to indicate that the code is stored
externally.
PSEN (Program store enable)
This is an output pin.
ALE (Address latch enable)
This is an output pin and is active high.
Ports 0, 1, 2 and 3
The four ports P0, P1, P2 and P3 each use 8 pins, making them 8-bit ports. All the ports upon
RESET are configured as input, since P0-P3 have value FFH on them.
Port 0(P0)
Port 0 is also designated as AD0-AD7, allowing it to be used for both address and data. ALE
indicates if P0 has address or data. When ALE=0, it provides data D0-D7, but when ALE=1, it
has address A0-A7. Therefore, ALE is used for demultiplexing address and data with the help of
an internal latch.
When there is no external memory connection, the pins of P0 must be connected to a 10K-ohm
pull-up resistor. This is due to the fact that P0 is an open drain. With external pull-up resistors
connected to P0, it can be used as a simple I/O, just like P1 and P2. But the ports P1, P2 and P3
do not need any pull-up resistors since they already have pull-up resistors internally. Upon reset,
ports P1, P2 and P3 are configured as input ports.
13

Port 1 and Port 2


With no external memory connection, both P1 and P2 are used as simple I/O. With
external memory connections, port 2 must be used along with P0 to provide the 16-bit address
for the external memory. Port 2 is designated as A8-A15 indicating its dual function. While P0
provides the lower 8 bits via A0-A7, it is the job of P2 to provide bits A8-A15 of the address.
Port 3
Port 3 occupies a total of 8 pins, pins 10 through 17. It can be used as input or output. P3
does not need any pull-up resistors, the same as port 1 and port 2. Port 3 has an additional
function of providing some extremely important signals such as interrupts.

Table 4.1 Port 3 Alternate Functions



14

Machine cycle for the 8051


The CPU takes a certain number of clock cycles to execute an instruction. In the 8051
family, these clock cycles are referred to as machine cycles. The length of the machine cycle
depends on the frequency of the crystal oscillator. The crystal oscillator, along with on-chip
circuitry, provides the clock source for the 8051 CPU. The frequency can vary from 4 MHz to 30
MHz, depending upon the chip rating and manufacturer. But the exact frequency of 11.0592
MHz crystal oscillator is used to make the 8051 based system compatible with the serial port of
the IBM PC.In the original version of 8051, one machine cycle lasts 12 oscillator periods.
Therefore, to calculate the machine cycle for the 8051, the calculation is made as 1/12 of the
crystal frequency and its inverse is taken.The assembly language program is written and this
program has to be dumped into the microcontroller for the hardware kit to function according to
the software. The program dumped in the microcontroller is stored in the Flash memory in the
microcontroller. Before that, this Flash memory has to be programmed .

CHAPTER 5
15

APPLICATIONS
5.1 APPLICATIONS
Microcontrollers may be classified into those for control applications and those for
embedded applications. A microcontroller is used inside a system, such as an
automobile, PC, air conditioner, video recorder, mobile telephone, TV, or electronic rice
cooker (in other words, it is used embedded into a system). Practically the only people
who carefully look at microcontrollers are those who actually make them and hobbyists.
Microcontrollers for control or embedded applications have functions reinforced for
embedded applications or are especially designed to be easy to use with such
applications.Microcomputers can be classified into microprocessors called MPU or CPU
and microcontrollers called MCU.
Data is input into a computer that processes (calculates) the data and outputs the result.
A microprocessor isintended to process the data and therefore consists mainly of CPU
functions. Examples of functions that constitute a computer are shown below. Recent
microprocessors integrate not only CPU functions but also functions gathered at the
center and surrounded by a dark cream color. Some have even functions surrounded by a
light cream color, such as ports, and A/D and D/A converters. Many microprocessors,
however, require the connection of an external ROM that stores instructions.
A microcontroller (MCU) has an internal ROM, so it can operate even with a single LSI
by writing instructions to this internal ROM, thus allowing a more compact system to be
organized.

16


fig 5.1 diagram showing functions included in a mcu

In a "control application", necessary processing is performed on an input signal and the
result is output. Unlike in "data processing application", the input signal comes from the
status of a switch or a sensor that converts physical information such as temperature and
magnetism (analog variable). In accordance with the input signal, a microcontroller for a
control application performs processing such as to illuminate a light when a switch is
pressed and sound an alarm if a temperature exceeds a specific value.



fig 5.2 figure depicting the operation of microcontrollers
17

Information of a switch is usually 1 bit. This means that a microcontroller for a control
application must be able to process 1-bit information efficiently. Because physical
quantities in the natural world are analog variables, the output signals of a sensor are
analog signals. An A/D converter is necessary to use these signals. Some of the output
signals of a microcontroller for control applications are 1-bit to perform an ON/OFF
control action such as to illuminate or extinguish a light, some are analog signals that
control brightness, issue sounds, or control DC motor, while the others are signals that
drive an actuator such as a motor or, in some cases, a display unit such as an LCD or
fluorescent indicator panel. Microcontrollers are therefore required to have output
functions for supporting these signals.
To use a microcontroller in a mobile system, it is necessary that the system be organized
to be compact. In addition, low-voltage operations and low power consumption are
important factors.
Microcontrollers for control or embedded applications therefore have functions suitable
for various purposes, by providing particular features.













18

CHAPTER 6
SIMULATION
6.1 SOFTWARE USED
We have used two softwares,namelyproteus and keiluvision .In order to get the
simulation
Proteus* is a software technology that allows creating clinical executable decision support
guidelines with little effort. Proteus is software for microprocessor simulation, schematic
capture, and printed circuit board (PCB) design. It is developed by
LabcenterElectronics.TheXGameStation Micro Edition was designed using Labcenter's Proteus
schematic entry and PCB layout tools.
[
KEIL COMPILER:Keil compiler is a software used where the machine language code is
written and compiled. After compilation, the machine source code is converted into hex code
which is to be dumped into the microcontroller for further processing. Keil compiler also
supports C language code.
PROLOAD:Proload is a software which accepts only hex files. Once the machine code is
converted into hex code, that hex code has to be dumped into the microcontroller and this is done
by the Proload. Proload is a programmer which itself contains a microcontroller in it other than
the one which is to be programmed. This microcontroller has a program in it written in such a
way that it accepts the hex file from the keil compiler and dumps this hex file into the
microcontroller which is to be programmed. As the proload programmer kit requires power
supply to be operated, this power supply is given from the power supply circuit designed above.
It should be noted that this programmer kit contains a power supply section in the board itself but
in order to switch on that power supply, a source is required. Thus this is accomplished from the
power supply board with an output of 12volts.Keil C51 is the industry-standard toolchain for all
8051-compatible devices, it supports classic 8051, Dallas 390, NXP MX, extended 8051variants.

19

6.2 PROGRAM DEVELOPED IN KEIL UVISION


#include<reg51.h>
#include<stdio.h>
void delay();
void main()
{
unsigned char mybyte;
P1=0x00;
TMOD=0x20;
TH1=0xFd;
TR1=1;
SCON=0x52;
printf("\n\tchoose any number \n 1:>-light \n 2:>-Fan \n 3:>light & Fan \n 4:>music sytem \n
5:>Music system & light \n 6:>musicsystem&fan \n 7:>All three");
printf("\n 0:>Off all applns");
while(1)
{
SCON=0x51;
while(RI==0);
mybyte=SBUF-0x30;
P1=mybyte;
RI=0;
}
}
void delay()
20

{int i;
for(i=0;i<256;i++);
}


















21

6.3 WORKING PROCEDURE



The project mainly focuses on taking the respective commands and thus displaying the required
output .here, we use microcontroller at89c51 to do all the commands.the program is built in
software kiel using the preload operation profram is dumped into the microcontroller thus
using that microcontroller ,we can input the options and get the desired outputs respectively
.here,we use basic electrical appliances like light (using leds) ,fan (opto coupler) etc.The inbuilt
program helps us in getting the respective results

6.4 SIMULATION CIRCUIT

Fig 6.1 simulation circuit

22

CHAPTER 7
CONCLUSION AND SCOPE FOR FUTURE
ENHANCEMENTS
7.1 CONCLUSION
AUTOMATION OF ELECTRICAL APPLIANCES is made apt by getting the output
,wherein the inputs are being controlled by the microcontroller AT89C51.The software and
hardware circuits have been designed and desired outputs have been obtained.


7.2 SCOPE FOR FUTURE ENHANCEMENTS
The microcontroller can be further developed by using developed version of atmel AT89c51 and
the interfacing of the devices can be done by using more number of devices .In addition to the
microcontroller ,another component can be further be used to develop the project. The present
invention relates to a method for improving the precision and reliability of the heating control for
an anesthetic machine circuit, which is applicable for the heating control of devices involved in
medical diagnosis, and more particularly for the temperature monitoring and control on the
circuit heating part in an anesthetic machine or ventilator.





23

REFERENCES
WEBSITES:
www.robots.com
www.zbasic.net
www.zntu.edu.ua/base/lection/rpf/lib/zhzh03/8051_tutorial.p
en.wikipedia.org/wiki/Microcontroller
www.atmel.com/atmel/acrobat/doc0265.pdf
www.parallax.com/dl/docs/article/siuapplicationmicros.pdf
www.icpartno.com/ic_2011-2-21/AT89C51-20J C/
www.alldatasheet.com/view.jsp?Searchword=AT89C51
BOOKS:
NEWEasy Step'n, David Benson
Parallel Port Complete, J an Axelson
PIC'n up the PACE, PIC Microcontroller Applications Guide, David Benson.
PIC'n Techniques, PIC Microcontroller Applications Guide, David Benson.
Serial PIC'n, PIC Microcontroller Serial Communications, Roger L. Stevens





24

APPENDIX
INTEGRATED
INTEGRATED







25

Вам также может понравиться