CHAPTER 1 MICROCONTROLLER INTRODUCTION : The microcontroller 89C51 is manufactured by Atmel, MC, USA. This is the advanced version of 8031. This Micro controller have inbuilt 4K bytes of flash ROM, 256 bytes of RAM, 32 I/O lines (4 bit ports) and 6 vectored interrupts. CMOS technology is used in this micro controller. FEATURES : Extensive Boolean processing (Single - bit Logic) Capabilities. 8 Bit CPU optimized for control applications. On - Chip Flash Program Memory. On - Chip Data RAM. Bi-directional and Individually Addressable I/O Lines. Multiple 16-Bit Timer/Counters. Full Duplex UART. On - Chip Oscillator and Clock circuitry. On - Chip EEPROM.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CHAPTER 1
MICROCONTROLLER
INTRODUCTION :
The microcontroller 89C51 is manufactured by Atmel, MC, USA. This is
the advanced version of 8031. This Micro controller have inbuilt 4K bytes of flash
ROM, 256 bytes of RAM, 32 I/O lines (4 bit ports) and 6 vectored interrupts.
CMOS technology is used in this micro controller.
FEATURES :
Extensive Boolean processing (Single - bit Logic) Capabilities.
8 Bit CPU optimized for control applications.
On - Chip Flash Program Memory.
On - Chip Data RAM.
Bi-directional and Individually Addressable I/O Lines.
Multiple 16-Bit Timer/Counters.
Full Duplex UART.
On - Chip Oscillator and Clock circuitry.
On - Chip EEPROM.
PIN DIAGRAM:
INPUT/ OUTPUT PORTS:
There are four I/O ports available in AT89C51. They are port 0, port 1, port
2, and port 3. All these ports are eight bit ports. All these ports can be controlled
as eight-bit port or it can be controlled individually. One of the main feature of this
micro controller is it can control the port pins individually. In 89C51 port 1 is
available for user, Port 3 is combined with interrupts. This can be used as
interrupts (or) I/O ports, ports 2 & port 0 is combined with address bus & data
bus.
All these port lines are available with internal pull-ups except port 0. If we
want to use port 0 as I/O port we have to use pull up resistors.
This Micro controller is working at a maximum speed of 24MHz. This
micro controller is available with inbuilt oscillator; just crystal has to be connected
to its terminal.
MEMORY ORGANIZATION:
All Atmel Flash micro controllers have separate address spaces for
program and data memory. The logical separation of program and data memory
allows the data memory to be accessed by 8 bit addresses.
Program memory can only be read. There can be up to 64K bytes of
directly addressable program memory. The read strobe for external program
memory is the Program Store Enable Signal (PSEN). Data memory occupies a
separate address space from program memory. Up to 64K bytes of external
memory can be directly addressed in the external data memory space.
The CPU generates read and write signals, RD and WR, during external
data memory accesses. External program memory and external data memory
can be combined by applying the RD and PSEN signal to the inputs of AND gate
and using the output of the fate as the read strobe to the external program/data
memory.
PROGRAM MEMORY:
After reset, the CPU begins execution from location 0000h. Each interrupt
is assigned a fixed location in program memory. The interrupt causes the CPU to
jump to that location, where it executes the service routine. If external Interrupt 0
is used, its service routine must begin at location 0003h. If the interrupt is not
used its service location is available as general-purpose program memory.
The interrupt service locations are spaced at 8 byte intervals 0003h for
External interrupt 0, 000Bh for Timer 0, 0013h for External interrupt 1,001Bh for
Timer1, and so on. If an Interrupt service routine is short enough it can reside
entirely within that 8-byte interval. Longer service routines can use a jump
instruction to skip over subsequent interrupt locations. The lowest addresses of
program memory can be either in the on-chip Flash or in an external memory. To
make this selection, strap the External Access (EA) pin to either Vcc or GND.
DATA MEMORY:
The Internal Data memory is divided into three blocks namely,
The lower 128 Bytes of Internal RAM.
The Upper 128 Bytes of Internal RAM.
Special Function Register.
Internal Data memory Addresses are always 1 byte wide, which implies an
address space of only 256 bytes. However, the addressing modes for internal
RAM can accommodate 384 bytes. Direct addresses higher than 7Fh access one
memory space and indirect addresses higher than 7Fh access a different
Memory Space.
The lowest 32 bytes are grouped into 4 banks of 8 registers. Program
instructions call out these registers as R0 through R7. Two bits in the Program
Status Word (PSW) select which register bank is in use. This architecture allows
more efficient use of code space, since register instructions are shorter than
instructions that use direct addressing.
The next 16-bytes above the register banks form a block of bit
addressable memory space. The micro controller instruction set includes a wide
selection of single - bit instructions and this instruction can directly address the
128 bytes in this area. These bit addresses are 00h through 7Fh
The Special Function Register includes Port latches, timers, peripheral
controls etc., direct addressing can only access these register. In general, all
Atmel micro controllers have the same SFRs at the same addresses. However,
upgrades to the AT89C51 have additional SFRs. Sixteen addresses in SFR
space are both byte and bit Addressable. The bit Addressable SFRs are those
whose address ends in 000B. The bit addresses in this area are 80h through
FFh.
OSCILLATOR AND CLOCK CIRCUIT:
XTAL1 and XTAL2 are the input and output respectively of an inverting
amplifier which is used as a crystal oscillator in the frequency range of 1.2 Mhz to
12 Mhz. XTAL2 is also used as the input to the internal clock generator.
To drive the chip with an internal oscillator XTAL1 and XTAL2 are
grounded. Since the input to the clock generator is divided by two flip flop there
are no requirements on the duty cycle of the external oscillator signal. However,
minimum high and low times must be observed.
The clock generator divides the oscillator frequency by 2 and provides a
two phase clock signal to the chip. The phase 1 signal is active during the first
half of each clock period and the phase 2 signals are active during the second
half of each clock period.
CPU TIMING:
A machine cycle consists of 6 states. Each state is divided into a phase /
half, during which the phase 1 clock is active and phase 2 half. Arithmetic and
Logical operations take place during phase1 and internal register to register
transfer take place during phase 2.
FLASH ROM:
4-kilo byte ROM is available in the Micro controller. It can be erased and
reprogrammed. If the available memory is not enough for program, it can be
interfaced with external ROM .It has 16 address lines, so maximum of (2^16) i.e.
64 bytes of ROM can be interfaced with this Micro controller. Both internal and
external ROM cannot be used simultaneously.
For external accessing of ROM, a pin is provided in Micro controller itself
i.e. pin no.31 EA. It should be high to use internal ROM, low to use external ROM
RAM:
Internal 256 bytes of RAM are available for user. These 256 bytes of RAM
can be used along with the external RAM. Externally 64-kilo bytes of RAM can be
connected with micro controller. In internal RAM first 128 bytes of RAM is
available for user and the remaining 128 bytes are used as special function
registers (SFR). These SFR’s are used as control registers for timer, serial port
etc.
PROGRAMS:
To program microcontrollers, the trend is to use the C language, due to its
efficiency and ease of use relative to the Assembly language makes most things
possible using the least amount of memory (code and date) and time, and offers
increased productivity.
Typically, a software developer can write more codes to do more things
using C than when using Assembly. This is important because at least half the
cost of developing an MCU application is in paying people to develop the
software.
Since C source code is standardized and portable, many people know
hoe to program in C. it can be written anywhere and then complied for the target
processor of choice. Writing microcontroller software often requires knowledge of
bits, registers, etc. C is considered to be a good language for real-time control
applications, as it has more or less compactness and speed features of the high-
level language features of portability. Also flow control is more flexible and easy
to use.
A micro controller unit (MCU) uses the microprocessor as its central
processing unit (CPU) and incorporates memory, timing reference, I/O
peripherals, etc on the same chip. Limited computational capabilities and
enhanced I/O are special features.
The micro controller is the most essential IC for continuous process-
based applications in industries like chemical, refinery, pharmaceutical
automobile, steel, and electrical, employing programmable logic systems (DCS).
PLC and DCS thrive on the programmability of an MCU.
There are many MCU manufacturers. To understand and apply general
concepts, it is necessary to study one type in detail. This specific knowledge can
be used to understand similar features of other MCU.
INTERFACING OF 89C51 TO 74HC541
CHAPTER 2
TRANSMITTER UNIT
INTRODUCTION:
Radio frequency (RF) transmitters are widely used in radio frequency
communications systems. With the increasing availability of efficient, low cost
electronic modules, mobile communication systems are becoming more and
more widespread.
A terminal apparatus used in the radio communications system receives a
radio frequency signal transmitted from a base station, by an antenna, inputs the
signal to a receiving radio-frequency unit via an antenna duplexer, high
frequency amplifies the signal, removes unnecessary waves outside the
receiving band from the signal, converts the signal to an intermediate frequency
signal, demodulates the intermediate frequency signal by a demodulator, and
converts the signal into a baseband signal.
Generally, a radio transmitter is used for performing a radio transmission
operation, whereby a high frequency signal outputted from a modulator is
transmitted to an antenna of the radio transmitter and is transmitted there from to
a remote radio transmitter thereby a signal is transmitted.
The transmitting baseband signal is subjected to a predetermined signal
process, input to a modulator, which modulates a carrier wave signal. The
modulated carrier wave signal is converted into a radio frequency by a
transmitting radio-frequency circuit and amplified to a predetermined transmitting
power, and transmitted to the base station from the antenna via the duplexer.
Communication systems are known to support wireless and wire lined
communications between wireless and/or wire lined communication devices.
The function of a radio frequency (RF) transmitter is to modulate,
upconvert, and amplify signals for transmission into free space. An RF
transmitter generally includes a modulator that modulates an input signal and a
radio frequency power amplifier that is coupled to the modulator to amplify the
modulated input signal. The radio frequency power amplifier is coupled to an
antenna that transmits the amplified modulated input signal. Power amplifiers are
required in radio telecommunication systems to amplify signals before
transmitting, because a radio signal attenuates on the radio path.
CIRCUIT OF TRANSMITTER UNIT
For efficiency, the amplifier is often a non-linear amplifier operated near its
peak capacity. To avoid distortion of the transmitted signals due to the non-
linearity, the signals are pre-distorted by a predistorter before they are
transmitted. The predistortion is required to prevent transmitter from transmitting
signals on channel bands other than the band assigned to the transmitter. The
predistortion values are chosen such that the product values entering the power
amplifier will be distorted by the power amplifier to return to a substantially linear
amplification of the modulated signals.
A direct conversion transmitter system to produce a transmission signal is
generally comprised of a low oscillator (LO), a phase locked loop (PLL), a
quadrature generator, a modulator, a power amplifier (PA), and one or more
filters. The low oscillator, coupled to the PLL, produces a signal with a frequency
that is substantially equal to the frequency of a desired RF transmission signal.
The quadrature generator is coupled to the low oscillator and the modulator.
The PA is coupled to the quadrature generator, and receives the
transmission signal and amplifies it. The amplified signal may go through a filter
to reduce noise or spurious outputs outside of the transmission band. High
quality RF transmitters typically include bandpass filters, such as surface
acoustic wave (SAW) filters provide excellent performance.
A typical system may employ a bandpass filter following the power
amplifier to reduce undesired noise present at the antenna in different portion of
RF spectrum to meet various standards' regulations and specifications.
TRANSMITTER MODULE TXC1:
The TXC1 is an ASK transmitter module .The result is excellent
performance in a simple-to-use .The TXC1 is designed specifically for remote-
control , wireless mouse and car alarm system operating at 315/433.92 MHz in
the USA under FCC Part 15 regulation. These are pre-built 433MHz wireless
transmitter / receiver modules. They feature ASK encoding, and perform very
well. They are ideal for devices using short data bursts such as remote controls,
trigger pulses etc.
SPECIFICATIONS:
Output power: 3dBm.
Supply voltage: 3V.
Supply current: 10mA max.
Data rate: 300bps to 10kbps.
PCB measures: 18.5(H) x 14.5(W) mm (excluding pins).
Transmitter Module: ZW-3100
Receiver Module: ZW-3102
Ideal for 315/433.92MHz remote keyless-entry transmitter
By SAW resonator
ASK modulation
315/433.92MHz
PIN ASSIGNMENT:
pin Connections1 GND2 DATA3 VCC4 ANT
ABSOLUTE MAXIMUM RATINGS
PARAMETER VALUE UNITS
Power supply 3 V
Operating temperature -20 to +60 °c
RECEIVER CHARACTERISTICS:
PARAMETER SYMBOL CONDITION VALUE UNIT
min typ max
Output power - Vcc=30V,
TA-27°c ,
50Ωload
315
MHz
2 3 6 dBm
434
MHz
1 3 6 dBm
Supply current Icc - 9 10 19 mA
Supply voltage
range
Vcc - - 3 - V
Data rate - - 300 1K 10K bps
TYPICAL TEST CIRCUIT
TYPICAL TRANSMITTER APPLICATION
REMARK:
Antenna Length:
22.6cm for 315 MHz
17.2 cm for 434 MHz
APPLICATIONS:
Specifically for remote-control, wireless mouse and car alarm system
operating at 315/433.92MHz in the USA under FCC Part 15 regulation
CHAPTER 3
RECEIVER UNIT
INTRODUCTION:
Receivers for communication systems generally are designed such that
they are tuned to receive one of a multiplicity of signals having widely varying
bandwidths and which may fall within a particular frequency range.
The RF receiver receives an RF signal, converts the RF signal to an IF
signal, and then converts the IF signal to a base band signal, which it then
provides to the base band processor. As is also known, RF transceivers typically
include sensitive components susceptible to noise and interference with one
another and with external sources.
The RF receiver is coupled to the antenna and includes a low noise
amplifier, one or more intermediate frequency stages, a filtering stage, and a data
recovery stage. The low noise amplifier receives an inbound RF signal via the
antenna and amplifies it.
The one or more intermediate frequency stages mix the amplified RF signal
with one or more local oscillations to convert the amplified RF signal into a base
band signal or an intermediate frequency (IF) signal.
CIRCUIT DIAGRAM OF RECEIVER UNIT:
RECEIVER MODULE RXB1:
The receiver module used in our project is ASK Super Heterodyne
Receiver Module, belongs to the category ST-RXB1. The ST- RX04-ASK is an
Ask Super Heterodyne Receiver Module with PLL Synthesizer and Crystal
Oscillator. The circuit shape is PLL.
ST- RX04
PIN DIAGRAM
SPECIFICATIONS:
Frequency Range : 315/434 MHz
Operation Voltage: 5V
IF Frequency: 500k
Typical sensitivity: -105dBm
Supply Current: 2.3Ma
FEATURES:
Low power consumption.
Easy for application.
On-chip VCO with integrated PLL using crystal oscillator reference.
Integrated IF and data filters.
Operation temperature range : -40 °c to +80 °c
MECHANICAL DIMENSIONS:
ELECTRICAL CHARACTERISTICS:
CHARACTERISTIC MIN TYP MAX UNIT
VCC Supply voltage - 5 - VDC
Is Supply Current - 2.3 3 mA
Fr Receiver
Frequency
- 315/434 - MHz
RF Sensitivity - -105 - dBm
Max Data Rate 0.3 1 3 Kbit/s
Voh High Level
Output
0.7Vcc - - VDC
Vol Low Level
Output
- - 0.3Vcc VDC
Turn On Time 25 30 - ms
Top
Operating
Temperature Range
-40 - 80 °c
Output Duty 40 - 60 %
TYPICAL APPLICATION:
REMARK:
Antenna length about:
23cm for 315 MHz
17 cm for 434 MHz
APPLICATIONS:
Car security system
Wireless security systems
Sensor reporting
Automation system
Remote Keyless entry
CHAPTER 4
ENCODER
INTRODUCTION:
An encoder can be a device used to change a signal (such as a bitstream)
or data into a code. The code serves any of a number of purposes such as
compressing information for transmission or storage, encrypting or adding
redundancies to the input code, or translating from one code to another.
This is usually done by means of a programmed algorithm, especially if
any part is digital, while most analog encoding is done with analog circuitry.
ENCODER HT12E:
The HT12E encoder is a CMOS IC built especially for remote control
system applications. It is capable of encoding 8 bits of address (A0-A7) and 4
bits of data (AD8-AD11) information. Each address/data input can be set to one
of the two logic states, 0 or 1.
Grounding the pins is taken as a 0 while a high can be given by giving +5V
or leaving the pins open (no connection). Upon reception of transmit enable
(TE-active low), the programmed address/data are transmitted together with the
There are many types of power supply. Most are designed to convert
high voltage AC mains electricity to a suitable low voltage supply for
electronics circuits and other devices. A power supply can be broken down into
a series of blocks, each of which performs a particular function.
For example a 5V regulated supply:
Block diagram of regulated power supply
Each of the blocks are described below:
Transformer - steps down high voltage AC mains to low voltage AC.
Rectifier - converts AC to DC, but the DC output is varying.
Smoothing - smoothes the DC from varying greatly to a small ripple.
Regulator - eliminates ripple by setting DC output to a fixed voltage.
Power supplies made from these blocks are described below with a circuit
diagram and a graph of their output:
Transformer only
Transformer + Rectifier
Transformer + Rectifier + Smoothing
Transformer + Rectifier + Smoothing + Regulator
Transformer only
The low voltage AC output is suitable for lamps, heaters and special AC
motors. It is not suitable for electronic circuits unless they include a rectifier
and a smoothing capacitor.
Transformer
Transformer + Rectifier
The varying DC output is suitable for lamps, heaters and standard
motors. It is not suitable for electronic circuits unless they include a
smoothing capacitor.
Transformer + rectifier
Transformer + Rectifier + Smoothing
Transformer + rectifier + smoothing
The smooth DC output has a small ripple. It is suitable for most electronic
circuits.
Transformer + Rectifier + Smoothing + Regulator
The regulated DC output is very smooth with no ripple. It is suitable for all
electronic circuits.
Dual Supplies
Some electronic circuits require a power supply with positive and
negative outputs as well as zero volts (0V). This is called a 'dual supply'
because it is like two ordinary supplies connected together as shown in the
diagram.
Dual supplies have three outputs, for example a ±9V supply has +9V,
0V and - 9V outputs.
Dual supplies
Simple 5V power supply for digital circuits
Summary of circuit features
Brief description of operation: Gives out well regulated +5V output,
output current capability of 100 mA
Circuit protection: Built-in overheating protection shuts down output
when regulator IC gets too hot
Circuit complexity: Very simple and easy to build
Circuit performance: Very stable +5V output voltage, reliable operation
Design testing: Based on datasheet example circuit, I have used this
circuit successfully as part of many electronics projects
Applications: Part of electronics devices, small laboratory power supply Power supply voltage: Unregulated DC 8-18V power supply Power supply current: Needed output current + 5 mA
Circuit description
This circuit is a small +5V power supply, which is useful when
experimenting with digital electronics. This circuit can give +5V output at
about 150 mA current, but it can be increased to 1 A when good cooling is
added to 7805 regulator chip. The circuit has overload and terminal
protection.
Circuit diagram of 5V power supply
The capacitors must have enough high voltage rating to safely handle
the input voltage feed to circuit.
Component list
7805 regulator IC
100 uF electrolytic capacitor, at least 25V voltage rating
10 uF electrolytic capacitor, at least 6V voltage rating