Professional Documents
Culture Documents
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
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.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
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
{int i;
for(i=0;i<256;i++);
}
21
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