Sie sind auf Seite 1von 12

4.

3 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.

The Intel 8051 microcontroller is one of the most popular general purpose
microcontrollers in use today. The success of the Intel 8051 spawned a number of
clones which are collectively referred to as the MCS-51 family of microcontrollers,
which includes chips from vendors such as Atmel, Philips, Infineon, and Texas
Instruments.

About the 8051:

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 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, Op-Amps, etc.

Typical applications:

8051 chips are used in a wide variety of control systems, telecom applications,
robotics as well as in the automotive industry. By some estimation, 8051 family
chips make up over 50% of the embedded chip market.
Pin diagram of the 8051 DIP

Basic Pins:

PIN 9: PIN 9 is the reset pin which is used reset the microcontroller’s internal
registers and ports upon starting up. (Pin should be held high for 2 machine
cycles.)

PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only
connect a crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip
needs +5V 500mA to function properly, although there are lower powered versions
like the Atmel 2051 which is a scaled down version of the 8051 which runs on
+3V.
PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a
built-in flash memory. In order to program this we need to supply a voltage of
+12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP,
should be connected to ground to indicate the presence of external memory. PIN
30 is called ALE (address latch enable), which is used when multiple memory
chips are connected to the controller and only one of them needs to be selected. We
will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is
"program store enable". In order to use the external memory it is required to
provide the low voltage (0) on both PSEN and EA pins.

Ports:

There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which
can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have
dual roles or additional functions associated with them based upon the context of
their usage.

PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has
additional functions such as, serial transmit and receive pins, 2 external interrupt
pins, 2 external counter inputs, read and write pins for memory access.

PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit
port when no external memory is present, but if external memory access is required
then PORT P2 will act as an address bus in conjunction with PORT P0 to access
external memory. PORT P2 acts as A8-A15, as can be seen from fig 1.1

PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port
when no external memory is present, but if external memory access is required
then PORT P0 acts as a multiplexed address and data bus that can be used to
access external memory in conjunction with PORT P2. P0 acts as AD0-AD7.

Oscillator Circuits:

The 8051 requires the existence of an external oscillator circuit. The oscillator
circuit usually runs around 12MHz, although the 8051 (depending on which
specific model) is capable of running at a maximum of 40MHz. Each machine
cycle in the 8051 is 12 clock cycles, giving an effective cycle rate at 1MHz (for a
12MHz clock) to 3.33MHz (for the maximum 40MHz clock).

Data and Program Memory: The 8051 Microprocessor can be programmed in


PL/M, 8051 Assembly, C and a number of other high-level languages. Many
compilers even have support for compiling C++ for an 8051.

Program memory in the 8051 is read-only, while the data memory is considered to
be read/write accessible. When stored on EEPROM or Flash, the program memory
can be rewritten when the microcontroller is in the special programmer circuit.

Program Start Address: The 8051 starts executing program instructions from
address 0000 in the program memory.

Direct Memory: The 8051 has 256 bytes of internal addressable RAM, although
only the first 128 bytes are available for general use by the programmer. The first
128 bytes of RAM (from 0x00 to 0x7F) are called the Direct Memory, and can be
used to store data. The controller is the main part of any circuit. Their are many
different criteria for choosing a micro controller such as its speed, packaging
either DIP or QFP, power consumption, amount of ROM and RAM on chip,
number of input output pins, cost etc.

In our project we have choose 8052 series controller of ATMEL Company i.e.
AT89S52. Its specifications are as follows:

Feature AT89S52
ROM 8K
RAM 256
Timers 3
I/O pins 32
Serial port 1
Interrupt 8
Feature of AT89S52

The Port 1(P1) is made as input port and Port 2 (P2) is made as output port. The
sensors will send the signals to the pins of Port 1 and the controller will perform
action according to the embedded program and gives output to the Port 2.
4.4 Crystal Oscillators:

A crystal oscillator is an electronic oscillator circuit that uses the mechanical


resonance of a vibrating crystal of piezoelectric material to create an electrical
signal with a very precise frequency. This frequency is commonly used to keep
track of time (as in quartz wristwatches), to provide a stable clock signal for digital
integrated, and to stabilize frequencies for radio transmitters and receivers. The
most common type of piezoelectric resonator used is the quartz crystal, so
oscillator circuits designed around them became known as "crystal oscillators."

Crystal oscillator

Quartz crystal oscillators were developed for high-stability frequency references


during the 1920s and 1930s. By 1926 quartz crystals were used to control the
frequency of radio broadcasting stations and were popular with amateur radio
operators. In 1928, Warren Marrison (of Bell Telephone Laboratories) developed
the first quartz crystal clock. This invention replaced the escapement and
pendulum (as the timing reference), relying instead on the natural vibrations
occurring in the quartz crystal as the oscillator. This improved timing accuracies to
1 sec in 30 years (or 30 ms/year).

Operation: A crystal is a solid in which the constituent atoms, molecules, or ions


are packed in a regularly ordered, repeating pattern extending in all three spatial
dimensions
When a crystal of quartz is properly cut and mounted, it can be made to distort in
an electric field by applying a voltage to an electrode near or on the crystal. This
property is known as piezoelectricity. When the field is removed, the quartz will
generate an electric field as it returns to its previous shape, and this can generate a
voltage. The result is that a quartz crystal behaves like a circuit composed of an
inductor, capacitor and resistor, with a precise resonant frequency.

4.5 Pull-up resistor:

Pull-up resistors are used in electronic logic circuits to ensure that inputs to logic
systems settle at expected logic levels if external devices are disconnected or high-
impedance. They may also be used at the interface between two different types of
logic devices, possibly operating at different power supply voltages.

Pull up resistor

When the switch is open the voltage of the gate input is pulled up to the level of
Vin. When the switch is closed, the input voltage at the gate goes to ground.

A pull-up resistor weakly "pulls" the voltage of the wire it is connected to towards
its voltage source level when the other components on the line are inactive. When
all other connections on the line are inactive, they are high-impedance and act like
they are disconnected. Since the other components act as though they are
disconnected, the circuit acts as though it is disconnected, and the pull-up resistor
brings the wire up to the high logic level.

A pull-down resistor works in the same way but is connected to ground. It holds
the logic signal near zero volts when no other active device is connected.

Applications:

Application of pull up

A circuit showing a pull-up resistor (R2) and a pull-down resistor (R1), as well as
an open collector (7407) to drive the line to the FET only when given a low 0 V
input

A pull-up resistor may be used when interfacing logic gates to inputs. For example,
an input signal may be pulled by a resistor, then a switch or jumper strap can be
used to connect that input to ground. This can be used for configuration
information, to select options or for troubleshooting of a device.

When the switch is open the voltage of the gate input is pulled down to the level of
ground. When the switch is closed, the input voltage at the gate goes to Vin.

Some disadvantages of pull-up resistors are the extra power consumed when
current is drawn through the resistor, and the reduced speed of a pull-up compared
to an active current source. Certain logic families are susceptible to power supply
transients introduced into logic inputs through pull-up resistors, which may force
the use of a separate filtered power source for the pull-ups.

4.6 RC Reset Circuit:

RC Reset Circuit

RESET is an active High input When RESET is set to High, 8051 goes back to the
power on state.

The 8051 is reset by holding the RST high for at least two machine cycles and then
returning it low.

Power-On Reset

 Initially charging of capacitor makes RST High


 When capacitor charges fully it blocks DC.

Manual reset

 Closing the switch momentarily will make RST High.

After a reset, the program counter is loaded with 0000H but the content of on-chip
RAM is not affected.
Manual Reset & Power Reset Circuit

1. Serial Port Bluetooth Module (Master/Slave) : HC-05

HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for
transparent wireless serial connection setup.

Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate)
3Mbps Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Blue core
04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive
Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm. Hope it will
simplify your overall design/development cycle.

Specifications

Hardware Features

 Typical -80dBm sensitivity


 Up to +4dBm RF transmit power
 Low Power 1.8V Operation ,1.8 to 3.6V I/O
 PIO control
 UART interface with programmable baud rate
 With integrated antenna
 With edge connector

Fig 4: Hc-05 Blutooth Module

Software Features

 Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.

Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.

 Given a rising pulse in PIO0, device will be disconnected.


 Status instruction port PIO1: low-disconnected, high-connected;
 PIO10 and PIO11 can be connected to red and blue led separately. When master and
slave

are paired, red and blue led blinks 1time/2s in interval, while disconnected only blue
led blinks 2times/s.

 Auto-connect to the last device on power as default.


 Permit pairing device to connect as default.
 Auto-pairing PINCODE:”0000” as default
 Auto-reconnect in 30 min when disconnected as a result of beyond the range of
connection.

Das könnte Ihnen auch gefallen