Professional Documents
Culture Documents
CONTENTS
CHAPTER PAGE
TITLE
NO. NO.
1 ABSTRACT 3
2 INTRODUCTION 4
3 BLOCK DIAGRAM 5
4 BLOCK DIAGRAM DESCRIPTION 6
4.1 ABOUT MICROCONTROLLER 6
4.2 LIQUID CRYSTAL DISPLAY 30
4.3 VOLTAGE MEASUREMENT 32
4.4 RELAY 33
4.4 ALARM 34
5 OVERALL CIRCUIT DIAGRAM 35
6 OVERALL CIRCUIT DIAGRAM DESCRIPTION 36
6.1 POWER SUPPLY CIRCUIT 36
6.2 MICROCONTROLLER CIRCUIT 41
6.3 VOLATGE MEASURMENT CIRCUIT 42
6.4 ALARM 44
6.5 RS232 46
1
7 PCB DESIGN 49
7.1 INTRODUCTION 49
7.2 SOFTWARE 49
7.3 MANUFACTURING 49
7.4 PANELISATION 50
7.5 PLATING 50
7.6 ETCHING 50
7.7 SOLDER MASK 50
7.8 HOT AIR LEVELING 51
8 SOFTWARE TOOLS 52
8.1 KEILC COMPILER 53
8.2 SIMULATOR 53
9 ADVANTAGES 54
10 APPLICATIONS 54
11 CONCLUSION 55
12 REFERENCES 56
2
1. ABSTRACT
3
2. INTRODUCTION
Microcontroller is the heart of the device which handles all the sub
devices connected across it. We have used as microcontroller. It has flash
type reprogrammable memory. It has some peripheral devices to play this
project perform. It also provides sufficient power to inbuilt peripheral
devices. We need not give individually to all devices. The peripheral devices
also activates as low power operation mode. These are the advantages are
appear here.
4
3. BLOCK DIAGRAM
5
4. BLOCK DIAGRAM DESCRIPTION
4. 1 MICROCONTROLLER
Microcontrollers are :
Smaller in size
Consumes less power
Inexpensive
6
The heart of the microcontroller is the CPU core. In the past, this has traditionally
been based on a 8-bit microprocessor unit. For example Motorola uses a basic
6800 microprocessor core in their 6805/6808 microcontroller devices.
In the recent years, microcontrollers have
been developed around specifically designed CPU cores, for example the
microchip PIC range of microcontrollers.
PIC (16F877) :
Various microcontrollers offer different kinds
of memories. EEPROM, EPROM, FLASH etc. are some of the memories of
which FLASH is the most recently developed. Technology that is used in
pic16F877 is flash technology, so that data is retained even when the power is
switched off. Easy Programming and Erasing are other features of PIC 16F877.
7
The PIC start plus programmer gives the product developer
ability to program user software in to any of the supported microcontrollers. The
PIC start plus software running under mplab provides for full interactive control
over the programmer.
CORE FEATURES :
• High-performance RISC CPU
• Only 35 single word instructions to learn
• All single cycle instructions except for program branches which are two cycle
• Operating speed: DC - 20 MHz clock input
DC - 200 ns instruction cycle
• Up to 8K x 14 words of Flash Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM)
Up to 256 x 8 bytes of EEPROM data memory
• Pin out compatible to the PIC16C73/74/76/77
• Interrupt capability (up to 14 internal/external
• Eight level deep hardware stack
• Direct, indirect, and relative addressing modes
• Power-on Reset (POR)
• Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
• Watchdog Timer (WDT) with its own on-chip RC Oscillator for reliable
operation
• Programmable code-protection
• Power saving SLEEP mode
• Selectable oscillator options
• Low-power, high-speed CMOS EPROM/EEPROM technology
• Fully static design
• In-Circuit Serial Programming (ICSP) via two pins
• Only single 5V source needed for programming capability
• In-Circuit Debugging via two pins
8
• Processor read/write access to program memory
• Wide operating voltage range: 2.5V to 5.5V
• High Sink/Source Current: 25 mA
• Commercial and Industrial temperature ranges
• Low-power consumption:
< 2mA typical @ 5V, 4 MHz
20mA typical @ 3V, 32 kHz
< 1mA typical standby current
PERIPHERAL FEATURES :
• Timer0: 8-bit timer/counter with 8-bit prescaler
• Timer1: 16-bit timer/counter with prescaler, can be incremented during sleep
via external crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
• Two Capture, Compare, PWM modules
Capture is 16-bit, max resolution is 12.5 ns,
Compare is 16-bit, max resolution is 200 ns,
PWM max. resolution is 10-bit
• 10-bit multi-channel Analog-to-Digital converter
• Synchronous Serial Port (SSP) with SPI. (Master Mode) and I2C.
(Master/Slave)
• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI)
with
9- bit address detection.
• Brown-out detection circuitry for Brown-out Reset (BOR)
9
2.4 ARCHITECTURE OF PIC 16F877 :
The complete architecture of
PIC 16F877 is shown in the fig 2.1. Table 2.1 gives details about the
specifications of PIC 16F877. Fig 2.2 shows the complete pin diagram of the IC
PIC 16F877.
FIG 2.1 ARCHITECTURE OF PIC 16F877
10
TABLE 2.1 SPECIFICATIONS
11
Legend: I = input O = output I/O = input/output P = power
— = Not used TTL = TTL input ST = Schmitt Trigger input
Note
1. This buffer is a Schmitt Trigger input when configured as an external interrupt
2. This buffer is a Schmitt Trigger input when used in serial programming mode.
3. This buffer is a Schmitt Trigger input when configured as general purpose I/O
and a TTL
input when used in the Parallel Slave Port mode (for interfacing to a
microprocessor bus).
12
4. This buffer is a Schmitt Trigger input when configured in RC oscillator mode
and a
CMOS input otherwise.
13
3. This buffer is a Schmitt Trigger input when configured as general purpose I/O
and a TTL
input when used in the Parallel Slave Port mode (for interfacing to a
microprocessor bus).
4. This buffer is a Schmitt Trigger input when configured in RC oscillator mode
and a
CMOS input otherwise.
14
The TRISA register controls the direction of the RA pins, even when they
are being used as analog inputs. The user must ensure the bits in the TRISA
register are maintained set when using them as analog inputs.
15
the selected pin. Three pins of PORTB are multiplexed with the Low Voltage
Programming function; RB3/PGM, RB6/PGC and RB7/PGD. The alternate
functions of these pins are described in the Special Features Section. Each of
the PORTB pins has a weak internal pull-up. A single control bit can turn on all
the pull-ups.
This is performed by clearing bit RBPU
(OPTION_REG<7>). The weak pull-up is automatically turned off when the port
pin is configured as an output. The pull-ups are disabled on a Power-on Reset.
16
TABLE 2.5 PORT B FUNCTIONS
17
the selected pin. PORTC is multiplexed with several peripheral functions.
PORTC pins have Schmitt Trigger input buffers.
18
TABLE 2.8 SUMMARY OF REGISTERS ASSOCIATED WITH PORTC
19
PORTE AND TRISE REGISTER :
PORTE has three pins RE0/RD/AN5,
RE1/WR/AN6 and RE2/CS/AN7, which are individually configurable as inputs or
outputs. These pins have Schmitt Trigger input buffers.
The PORTE pins become control inputs for the
microprocessor port when bit PSPMODE (TRISE<4>) is set. In this mode, the
user must make sure that the TRISE<2:0> bits are set (pins are configured as
digital inputs). Ensure ADCON1 is configured for digital I/O. In this mode the
input buffers are TTL.
PORTE pins are multiplexed with analog
inputs. When selected as an analog input, these pins will read as '0's. TRISE
controls the direction of the RE pins, even when they are being used as analog
inputs. The user must make sure to keep the pins configured as inputs when
using them as analog inputs.
20
TABLE 2.11 PORTE FUNCTIONS
21
The RESET vector is at 0000h and the interrupt vector is at 0004h.
22
PIC16F877 REGISTER FILE MAP
23
GENERAL PURPOSE REGISTER FILE :
The register file can be accessed either
directly or indirectly through the File Selected Register (FSR). There are some
Special Function Registers used by the CPU and peripheral modules for
controlling the desired operation of the device. These registers are implemented
as static RAM. The Special Function Registers can be classified into two sets;
core (CPU) and peripheral. Those registers associated with the core functions.
24
For byte-oriented instructions, ‘f’
represents a file register designator and ’d’ represents a destination designator.
The file register designator specifies which file register is to be used by the
instruction. The destination designator specified where the result of the
operation is to be placed. If ‘d’ is zero, the result is placed in the w register. If ‘d’
is one, the result is placed in the file register specified in the instruction.
The instruction set is highly orthogonal and is grouped into three basic
categories:
• Byte-oriented operations
• Bit-oriented operations
• Literal and control operations
All instructions are executed within one
single instruction cycle, unless a conditional test is true or the program counter is
changed as a result of an instruction. In this case, the execution takes two
instruction cycles with the second cycle executed as a NOP. One instruction
cycle consists of four oscillator periods. Thus, for an oscillator frequency of 4
MHz, the normal instruction execution time is 1 ms. If a conditional test is true or
the program counter is changed as a result of an instruction, then the instruction
execution time is 2 ms.
25
TABLE 2.14 16F877 INSTRUCTION SET
26
27
APPLICATIONS OF MICROCONTROLLERS
applications such as
1. Industrial Control
2. Instrumentation and
• Motor
• Robotics
• In medical instrumentation
• Oscilloscopes
• Telecommunication
• Automobiles
• Driving an LCD
• Period Measurements
28
4.2 LIQUID CRYSTAL DISPLAY (LCD)
29
numeric data. The recent advances in technology have resulted in better
legibility, more information displaying capability and a wider temperature range.
These have resulted in the LCDs being extensively used in telecommunications
and entertainment electronics. The LCDs have even started replacing the
cathode ray tubes (CRTs) used for the display of text and graphics, and also in
small TV applications.
Crystalonics dot–matrix (alphanumeric) liquid crystal displays are
available in TN, STN types, with or without backlight. The use of C-MOS LCD
controller and driver ICs result in low power consumption. These modules can be
interfaced with a 4-bit or 8-bit microprocessor /Micro controller.
• The built-in controller IC has the following features:
• Correspond to high speed MPU interface (2MHz)
• 80 x 8 bit display RAM (80 Characters max)
• 9,920-bit character generator ROM for a total of 240 character fonts. 208
character fonts (5 x 8 dots) 32 character fonts (5 x 10 dots)
• 64 x 8 bit character generator RAM 8 character generator RAM 8 character
fonts (5 x 8 dots) 4 characters fonts (5 x 10 dots)
• Programmable duty cycles
• 1/8 – for one line of 5 x 8 dots with cursor
• 1/11 – for one line of 5 x 10 dots with cursor
• 1/16 – for one line of 5 x 8 dots with cursor
• Wide range of instruction functions display clear, cursor home, display on/off,
cursor on/off, display character blink, cursor shift, display shift.
• Automatic reset circuit, which initializes the controller / driver ICs after power
on.
30
4.3 VOLTAGE MEASURMENT
This circuit is designed to monitor the supply voltage. The supply voltage
that has to monitor is step down by the potential transformer. Usually we are
using the 0-6v potential transformer. The step down voltage is rectified by the
precision rectifier. The precision rectifier is a configuration obtained with an
operational amplifier in order to have a circuit behaving like an ideal diode or
rectifier.
The full wave rectifier is the combination of half wave precision rectifer and
summing amplifier. When the input voltage is negative, there is a negative
voltage on the diode, too, so it works like an open circuit, there is no current in
the load and the output voltage is zero. When the input is positive, it is amplified
by the operational amplifier and it turns the diode on. There is current in the load
and, because of the feedback, the output voltage is equal to the input.
31
4.4 RELAY
A relay is an electrical switch that opens and closes under the control of
another electrical circuit. In the original form, the switch is operated by an
electromagnet to open or close one or many sets of contacts. It was invented by
Joseph Henry in 1835. Because a relay is able to control an output circuit of
higher power than the input circuit, it can be considered to be, in a broad sense,
a form of an electrical amplifier.
Operation
When a current flows through the coil, the resulting magnetic field attracts
an armature that is mechanically linked to a moving contact. The movement
either makes or breaks a connection with a fixed contact. When the current to the
coil is switched off, the armature is returned by a force approximately half as
strong as the magnetic force to its relaxed position. Usually this is a spring, but
gravity is also used commonly in industrial motor starters. Most relays are
manufactured to operate quickly. In a low voltage application, this is to reduce
noise. In a high voltage or high current application, this is to reduce arcing.
If the coil is energized with DC, a diode is frequently installed across the
coil, to dissipate the energy from the collapsing magnetic field at deactivation,
which would otherwise generate a spike of voltage and might cause damage to
circuit components. Some automotive relays already include that diode inside the
relay case. Alternatively a contact protection network, consisting of a capacitor
and resistor in series, may absorb the surge. If the coil is designed to be
energized with AC, a small copper ring can be crimped to the end of the
solenoid. This "shading ring" creates a small out-of-phase current, which
increases the minimum pull on the armature during the AC cycle.
32
4.5 ALARM
Alarms include:
With any kind of alarm, the need exists to balance between on the one hand the
danger of false alarms (called "false positives") — the signal going off in the
absence of a problem — and on the other hand failing to signal an actual
problem (called a "false negative"). False alarms can waste resources
expensively and can even be dangerous.
33
5. OVERALL CIRCUIT DIAGRAM
34
6. OVERALL CIRCUIT DIAGRAM DESCRIPTION
Block diagram
35
Working principle
Transformer
The transformer will step down the power supply voltage (0-230V) to (0-6V) level.
Then the secondary of the potential transformer will be connected to the
precision rectifier, which is constructed with the help of op–amp. The advantages
of using precision rectifier are it will give peak voltage output as DC; rest of the
circuits will give only RMS output.
Bridge rectifier
When four diodes are connected as shown in figure, the circuit is called as
bridge rectifier. The input to the circuit is applied to the diagonally opposite
corners of the network, and the output is taken from the remaining two corners.
The negative potential at point B will forward bias D1 and reverse D2. At
this time D3 and D1 are forward biased and will allow current flow to pass
through them; D4 and D2 are reverse biased and will block current flow.
The path for current flow is from point B through D1, up through RL,
through D3, through the secondary of the transformer back to point B. this path is
indicated by the solid arrows. Waveforms (1) and (2) can be observed across D1
and D3.
36
One-half cycle later the polarity across the secondary of the transformer
reverse, forward biasing D2 and D4 and reverse biasing D1 and D3. Current flow
will now be from point A through D4, up through RL, through D2, through the
secondary of T1, and back to point A. This path is indicated by the broken
arrows. Waveforms (3) and (4) can be observed across D2 and D4. The current
flow through RL is always in the same direction. In flowing through RL this
current develops a voltage corresponding to that shown waveform (5). Since
current flows through the load (RL) during both half cycles of the applied voltage,
this bridge rectifier is a full-wave rectifier.
The maximum voltage that appears across the load resistor is nearly-but
never exceeds-500 v0lts, as result of the small voltage drop across the diode. In
the bridge rectifier shown in view B, the maximum voltage that can be rectified is
the full secondary voltage, which is 1000 volts. Therefore, the peak output
voltage across the load resistor is nearly 1000 volts. With both circuits using the
same transformer, the bridge rectifier circuit produces a higher output voltage
than the conventional full-wave rectifier circuit.
37
IC voltage regulators
38
A fixed three-terminal voltage regulator has an unregulated dc input
voltage, Vi, applied to one input terminal, a regulated dc output voltage, Vo, from
a second terminal, with the third terminal connected to ground.
The series 78 regulators provide fixed positive regulated voltages from 5
to 24 volts. Similarly, the series 79 regulators provide fixed negative regulated
voltages from 5 to 24 volts.
• For ICs, microcontroller, LCD --------- 5 volts
• For alarm circuit, op-amp, relay circuits ---------- 12 volts
39
6.2 MICROCONTROLLER CIRCUIT
The lcd that is liquid crystal display which is used to display the what we need the
lcd has fourteen pins in which three pins for the command and eight pins for the
data. If the data is given to lcd it is write command which is configured by the
programmer otherwise it is read command in which data read to microcontroller
the data pins are given to the to port0 and command pins are given to the port2.
Other than these pin a one pin configured for the contrast of the lcd. Thus the
microcontroller circuit works
40
6.3 VOLTAGE MEASUREMENT CIRCUIT
This circuit is designed to monitor the supply voltage. The supply voltage
that has to monitor is step down by the potential transformer. Usually we are
using the 0-6v potential transformer. The step down voltage is rectified by the
precision rectifier. The precision rectifier is a configuration obtained with an
operational amplifier in order to have a circuit behaving like an ideal diode or
rectifier.
The full wave rectifier is the combination of half wave precision rectifer and
summing amplifier. When the input voltage is negative, there is a negative
voltage on the diode, too, so it works like an open circuit, there is no current in
the load and the output voltage is zero. When the input is positive, it is amplified
by the operational amplifier and it turns the diode on. There is current in the load
and, because of the feedback, the output voltage is equal to the input.
In this case, when the input is greater than zero, D2 is ON and D1 is OFF,
so the output is zero. When the input is less than zero, D2 is OFF and D1 is ON,
and the output is like the input with an amplification of − R2 / R1. The full-wave
41
rectifier depends on the fact that both the half-wave rectifier and the summing
amplifier are precision circuits. It operates by producing an inverted half-wave-
rectified signal and then adding that signal at double amplitude to the original
signal in the summing amplifier. The result is a reversal of the selected polarity of
the input signal.
Then the output of the rectified voltage is adjusted to 0-5v with the help of
variable resistor VR1. Then given to ripples are filtered by the C1 capacitor. After
the filtration the corresponding DC voltage is given to ADC or other related
circuit.
42
6.4 ALARM
43
Often these units were anchored to a wall or ceiling and used the ceiling
or wall as a sounding board. Another implementation with some AC-connected
devices was to implement a circuit to make the AC current into a noise loud
enough to drive a loudspeaker and hook this circuit up to a cheap 8-ohm
speaker. Nowadays, it is more popular to use a ceramic-based piezoelectric
sounder like a Sonalert which makes a high-pitched tone. Usually these were
hooked up to "driver" circuits which varied the pitch of the sound or pulsed the
sound on and off.
44
6.5 RS232 CIRCUIT
RS232 COMMUNICATION
RS232:
In telecommunications, RS-232 is a standard for serial binary data
interconnection between a DTE (Data terminal equipment) and a DCE (Data Circuit-
terminating Equipment). It is commonly used in computer serial ports.
Scope of the Standard:
The Electronic Industries Alliance (EIA) standard RS-232-C [3] as of 1969 defines:
Electrical signal characteristics such as voltage levels, signaling rate, timing and
slew-rate of signals, voltage withstand level, short-circuit behavior, maximum
stray capacitance and cable length
Interface mechanical characteristics, pluggable connectors and pin identification
Functions of each circuit in the interface connector
Standard subsets of interface circuits for selected telecom applications
The standard does not define such elements as character encoding (for example,
ASCII, Baudot or EBCDIC), or the framing of characters in the data stream (bits per
character, start/stop bits, parity). The standard does not define protocols for error
detection or algorithms for data compression.
45
The standard does not define bit rates for transmission, although the standard says it
is intended for bit rates lower than 20,000 bits per second. Many modern devices can
exceed this speed (38,400 and 57,600 bit/s being common, and 115,200 and 230,400 bit/s
making occasional appearances) while still using RS-232 compatible signal levels.
Details of character format and transmission bit rate are controlled by the serial port
hardware, often a single integrated circuit called a UART that converts data from parallel
to serial form. A typical serial port includes specialized driver and receiver integrated
circuits to convert between internal logic levels and RS-232 compatible signal levels.
46
In this circuit the microcontroller transmitter pin is connected in the MAX232
T2IN pin which converts input 5v TTL/CMOS level to RS232 level. Then T2OUT pin is
connected to reviver pin of 9 pin D type serial connector which is directly connected to
PC.
In PC the transmitting data is given to R2IN of MAX232 through transmitting pin
of 9 pin D type connector which converts the RS232 level to 5v TTL/CMOS level. The
R2OUT pin is connected to receiver pin of the microcontroller. Likewise the data is
transmitted and received between the microcontroller and PC or other device vice versa.
47
7. PCB DESIGN
7.1 INTRODUCTION:
7.2 MANUFATCURING:
The manufacturing process consists of two methods; print and etch, and
print, plate and etch. The single sided PCBs are usually made using the print and
etch method. The double sided plate through – hole (PTH) boards are made by
the print plate and etch method.
The production of multi layer boards uses both the methods. The inner
layers are printed and etch while the outer layers are produced by print, plate and
etch after pressing the inner layers.
7.3 SOFTWARE:
48
7.4 PANELISATION:
7.5 DRILLING:
PCB drilling is a state of the art operation. Very small holes are drilled with
high speed CNC drilling machines, giving a wall finish with less or no smear or
epoxy, required for void free through hole plating.
7.6 PLATING:
The heart of the PCB manufacturing process. The holes drilled in the
board are treated both mechanically and chemically before depositing the copper
by the electro less copper platting process.
7.7 ETCHING:
Once a multiplayer board is drilled and electro less copper deposited, the
image available in the form of a film is transferred on to the out side by photo
printing using a dry film printing process. The boards are then electrolytic plated
on to the circuit pattern with copper and tin. The tin-plated deposit serves an etch
resist when copper in the unwanted area is removed by the conveyor’s spray
etching machines with chemical etch ants. The etching machines are attached to
an automatic dosing equipment, which analyses and controls etch ants
concentrations
49
7.8 SOLDERMASK:
Since a PCB design may call for very close spacing between conductors,
a solder mask has to be applied on the both sides of the circuitry to avoid the
bridging of conductors. The solder mask ink is applied by screening. The ink is
dried, exposed to UV, developed in a mild alkaline solution and finally cured by
both UV and thermal energy.
After applying the solder mask, the circuit pads are soldered using the hot
air leveling process. The bare bodies fluxed and dipped in to a molten solder
bath. While removing the board from the solder bath, hot air is blown on both
sides of the board through air knives in the machines, leaving the board soldered
and leveled. This is one of the common finishes given to the boards. Thus the
double sided plated through whole printed circuit board is manufactured and is
now ready for the components to be soldered.
50
8 SOFTWARE TOOLS
8 SOFTWARE TOOLS
8.1 MPLAB
51
8.2 MPLAB SIMULATOR
8.3 IC PROG
PRO MATE II may be used with MPLAB IDE running under supported Windows
OS's (see Read me for PRO MATE II.txt for support list), with the command-line
controller PROCMD or as a stand-alone programmer
A program written in the high level language called C; which will be converted
into PICmicro MCU machine code by a compiler. Machine code is suitable for
use by a PICmicro MCU or Microchip development system product like MPLAB
IDE.
52
8.5 PIC START PLUS PROGRAMMER:
The PIC start plus programmer gives the product developer ability to
program user software in to any of the supported microcontrollers. The PIC start
plus software running under MPLAB provides for full interactive control over the
programmer.
53
9. ADVANTAGES
unit digitally
10. APPLICATIONS
54
11. CONCLUSION
The progress in science & technology is a non-stop process. New things and
new technology are being invented. As the technology grows day by day, we can
imagine about the future in which thing we may occupy every place.
55
12. REFERENCES
WEBSITES:
http://www.atmel.com/
http://www.microchip.com/
www.8052.com
http://www.beyondlogic.org
http://www.ctv.es/pckits/home.html
http://www.aimglobal.org/
56