ABSTR ACT A bidirectional dc-dc converter is used for dc-dc power conversion applications. The power converter includes two full bridge converters (one serving as inverter and other as rectifier). This Bidirectional dc– dc converter is best for electrical vehicle applications. The topology proposed in the thesis has advantages of simple circuit topology with soft switching implementation without additional devices, high efficiency and simple control. This advantages make the converter promising for medium and high power applications especially for auxiliary power supply in fuel cell vehicles and power generation where the high power density, low cost, lightweight and high reliability power converters are required. PIC Micro Controller is used to generate pulses implementing PWM technique for making MOSFETS 0
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
ABSTRACT
A bidirectional dc-dc converter is used for dc-dc power conversion
applications. The power converter includes two full bridge converters (one serving as
inverter and other as rectifier). This Bidirectional dc–dc converter is best for electrical
vehicle applications. The topology proposed in the thesis has advantages of simple
circuit topology with soft switching implementation without additional devices, high
efficiency and simple control.
This advantages make the converter promising for medium and high power
applications especially for auxiliary power supply in fuel cell vehicles and power
generation where the high power density, low cost, lightweight and high reliability
power converters are required.
PIC Micro Controller is used to generate pulses implementing PWM technique
for making MOSFETS devices to operate and control. PWM technique is used for
reducing the harmonic in the circuit.
0
CHAPTER-1
INTRODUCTION
1
1.1 PROJECT OVERVIEW
In Recent years, growing concerns about environmental issues have
demanded more energy efficient nonpolluting vehicles. The rapid
advances in fuel cell technology and power electronics have enabled the
significant developments in fuel cell powered electric vehicles. The fuel
cells have numerous advantages such as high density current output
ability, clean electricity generation, and high efficiency operation.
However, the fuel cell characteristics are different from that of the
traditional chemical-powered battery. The fuel cell output voltage drops
quickly when first connected with a load and gradually decreases as the
output current rises.
The fuel cell also lacks energy storage capability. Therefore, in
electric vehicle applications, an auxiliary energy storage device (i.e.,
lead-acid battery) is always needed for a cold start and to absorb the
regenerated energy fed back by the electric machine. In addition, a dc–dc
converter is also needed to draw power from the auxiliary battery to boost
the high-voltage bus during vehicle starting.
Until the fuel cell voltage raises to a level high enough to hold the
high-voltage bus, the excess load from the battery will be released. The
regenerated braking energy can also be fed back and stored in the battery
using the dc–dc converter.
A full-bridge isolated bidirectional dc–dc converter is considered
one of the best choices for these applications.
2
1.2 INTRODUCTION TO DC-DC CONVERTER:
DC-DC converters are devices which change one level of direct current voltage to
another (either higher or lower) level. They are primarily of use in battery-powered
appliances and machines which possess numerous sub circuits, each requiring
different levels of voltage. A DC-DC converter enables such equipment to be
powered by batteries of a single level of voltage, preventing the need to use numerous
batteries with varying voltages to power each individual component.
1.2.2. BUCK CONVERTER STEP-DOWN CONVERTER
In this circuit the transistor turning ON will put voltage Vin on one end of the
inductor. This voltage will tend to cause the inductor current to rise. When the
transistor is OFF, the current will continue flowing through the inductor but now
flowing through the diode. We initially assume that the current through the inductor
does not reach zero, thus the voltage at Vx will now be only the voltage across the
conducting diode during the full OFF time. The average voltage at Vx will depend on
the average ON time of the transistor provided the inductor current is continuous.
Fig. 1: Buck Converter
Fig. 2: Voltage and current changes
3
To analyse the voltages of this circuit let us consider the changes in the inductor
current over one cycle. From the relation
Vx – Vo = L (di/dt)
the change of current satisfies
For steady state operation the current at the start and end of a period T will not
change. To get a simple relation between voltages we assume no voltage drop across
transistor or diode while ON and a perfect switch change. Thus during the ON time
Vx= Vin and in the OFF Vx=0. Thus
Which simplifies to
Or
and defining "duty ratio" as
the voltage relationship becomes Vo=D Vin Since the circuit is lossless and the input
and output powers must match on the average Vo* Io = Vin* Iin. Thus the average input
and output current must satisfy Iin =D Io These relations are based on the assumption
that the inductor current does not reach zero.
4
1.2.1.1Transition between continuous and discontinuous
When the current in the inductor L remains always positive then either the transistor
T1 or the diode D1 must be conducting. For continuous conduction the voltage Vx is
either Vin or 0. If the inductor current ever goes to zero then the output voltage will
not be forced to either of these conditions. At this transition point the current just
reaches zero as seen in Figure 3. During the ON time V in-Vout is across the inductor
thus
(1)
The average current which must match the output current satisfies
(2)
Fig. 3: Buck Converter at Boundary
If the input voltage is constant the output current at the transition point satisfies
(3)
5
1.2.1.2 Voltage Ratio of Buck Converter (Discontinuous Mode)
As for the continuous conduction analysis we use the fact that the integral of voltage
across the inductor is zero over a cycle of switching T. The transistor OFF time is
now divided into segments of diode conduction ddT and zero conduction doT. The
inductor average voltage thus gives
(Vin - Vo ) DT + (-Vo) dT = 0 (4)
Fig. 4: Buck Converter - Discontinuous Conduction d
(5)
for the case . To resolve the value of consider the output current which is
half the peak when averaged over the conduction times
(6)
Considering the change of current during the diode conduction time
6
(7)
Thus from (6) and (7) we can get
(8)
using the relationship in (5)
(9)
and solving for the diode conduction
(10)
The output voltage is thus given as
(11)
defining k* = 2L/ (Vin T), we can see the effect of discontinuous current on the
voltage ratio of the converter.
7
Fig. 5: Output Voltage vs Current
As seen in the figure, once the output current is high enough, the voltage ratio
depends only on the duty ratio "d". At low currents the discontinuous operation tends
to increase the output voltage of the converter towards Vin.
1.2.2 BOOST CONVERTER STEP-UP CONVERTER
The schematic in Fig. 6 shows the basic boost converter. This circuit is used when a
higher output voltage than input is required.
Fig. 6: Boost Converter Circuit
While the transistor is ON Vx =Vin, and the OFF state the inductor current flows
through the diode giving Vx =Vo. For this analysis it is assumed that the inductor
current always remains flowing (continuous conduction). The voltage across the
inductor is shown in Fig. 7 and the average must be zero for the average current to
remain in steady state
8
Vin ton + (Vin - Vo) toff =0
This can be rearranged as
and for a lossless circuit the power balance ensures
Fig. 7: Voltage and current waveforms (Boost Converter)
Since the duty ratio "D" is between 0 and 1 the output voltage must always be higher
than the input voltage in magnitude. The negative sign indicates a reversal of sense of
the output voltage.
1.2.3. BUCK-BOOST CONVERTER
Fig. 8: schematic for buck-boost converter
9
With continuous conduction for the Buck-Boost converter Vx =Vin when the transistor
is ON and Vx =Vo when the transistor is OFF. For zero net current change over a
period the average voltage across the inductor is zero
Fig. 9: Waveforms for buck-boost converter
Vin ton + Vo toff = 0
which gives the voltage ratio
and the corresponding current
Since the duty ratio "D" is between 0 and 1 the output voltage can vary between lower
or higher than the input voltage in magnitude. The negative sign indicates a reversal
of sense of the output voltage.
CONVERTER COMPARISON
The voltage ratios achievable by the DC-DC converters is summarised in Fig.
10. Notice that only the buck converter shows a linear relationship between the
control (duty ratio) and output voltage. The buck-boost can reduce or increase the
voltage ratio with unit gain for a duty ratio of 50%.
10
Fig. 10: Comparison of Voltage ratio
1.2.4. CUK CONVERTER
The buck, boost and buck-boost converters all transferred energy between input and
output using the inductor, analysis is based of voltage balance across the inductor.
The CUK converter uses capacitive energy transfer and analysis is based on current
balance of the capacitor. The circuit in Fig. 11 is derived from DUALITY principle on
the buck-boost converter.
Fig. 11: CUK Converter
If we assume that the current through the inductors is essentially ripple free we can
examine the charge balance for the capacitor C1. For the transistor ON the circuit
becomes
11
Fig. 12: CUK "ON-STATE"
and the current in C1 is IL1. When the transistor is OFF, the diode conducts and the
current in C1 becomes IL2.
Fig. 13: CUK "OFF-STATE"
Since the steady state assumes no net capacitor voltage rise, the net current is zero
IL1tON + (-IL2) tOFF = 0
which implies
The inductor currents match the input and output currents, thus using the power
conservation rule
Thus the voltage ratio is the same as the buck-boost converter. The advantage of the
CUK converter is that the input and output inductors create a smooth current at both
12
sides of the converter while the buck, boost and buck-boost have at least one side with
pulsed current.
1.4.5 Isolated DC-DC Converters
In many DC-DC applications, multiple outputs are required and output
isolation may need to be implemented depending on the application. In addition, input
to output isolation may be required to meet safety standards and / or provide
impedance matching. The above discussed DC-DC topologies can be adapted to
provide isolation between input and output.
1.4.5.1 Fly back Converter
The fly back converter can be developed as an extension of the Buck-Boost
converter. Fig 14a shows the basic converter; Fig 14b replaces the inductor by a
transformer. The buck-boost converter works by storing energy in the inductor during
the ON phase and releasing it to the output during the OFF phase. With the
transformer the energy storage is in the magnetization of the transformer core. To
increase the stored energy a gapped core is often used. In Fig 14c the isolated output
is clarified by removal of the common reference of the input and output circuits.
Fig. 14(a): Buck-Boost Converter
Fig. 14(b): Replacing inductor by transformer
13
Fig. 14(c): Fly back converter re-configured
1.4.5.2 Forward Converter
The concept behind the forward converter is that of the ideal transformer converting
the input AC voltage to an isolated secondary output voltage. For the circuit in Fig.
15, when the transistor is ON, Vin appears across the primary and then generates
The diode D1 on the secondary ensures that only positive voltages are applied to the
output circuit while D2 provides a circulating path for inductor current if the
transformer voltage is zero or negative.
Fig. 15: Forward Converter
The problem with the operation of the circuit in Fig 15 is that only positive
voltage is applied across the core, thus flux can only increase with the application of
the supply. The flux will increase until the core saturates when the magnetizing
14
current increases significantly and circuit failure occurs. The transformer can only
sustain operation when there is no significant DC component to the input voltage.
While the switch is ON there is positive voltage across the core and the flux increases.
When the switch turns OFF we need to supply negative voltage to reset the core flux.
The circuit in Fig. 16 shows a tertiary winding with a diode connection to permit
reverse current. Note that the "dot" convention for the tertiary winding is opposite
those of the other windings. When the switch turns OFF current was flowing in a
"dot" terminal. The core inductance act to continue current in a dotted terminal, thus
Fig. 16: Forward converter with tertiary winding
1.3 BI-DIRECTIONAL DC-TO-DC CONVERTER
A DC/DC converter which can be operated alternately as a step-up
converter in a first direction of energy flow and as a step-down converter in a second
direction of energy flow is disclosed. Potential isolation between the low-voltage side
and the high-voltage side of the converter is achieved by a magnetic compound
unit, which has not only a transformer function but also an energy store function. The
converter operates as a push-pull converter in both directions of energy flow. The
DC/DC converter can be used for example in motor vehicles with an electric drive fed
by fuel cells.
A bi-directional converter for converting voltage bi-directionally between a
high voltage bus and a low voltage bus, comprising a switching converter connected
across the high voltage bus, the switching converter comprising first and second
switching modules connected in series across the high voltage bus, a switched node
disposed between the switching modules being coupled to an inductor, the inductor
connected to a first capacitor, the connection between the inductor and the first
15
capacitor comprising a mid-voltage bus, the first and second switching modules being
controllable so that the switching converter can be operated as a buck converter or a
boost converter depending upon the direction of conversion from the high voltage bus
to the low voltage bus or vice versa; the mid-voltage bus being coupled to a first full
bridge switching circuit comprising two pairs of series connected switches with
switched nodes between each of the pairs of switches being connected across a first
winding of a transformer having a preset turns ratio; and a second full bridge
switching circuit comprising two pairs of series connected switches with switched
nodes between each of the pairs of switches being connected across a second winding
of the transformer, the second full bridge switching circuit being coupled to a second
capacitor comprising a low voltage node.
1.3.1 USES OF DC-DC CONVERTER:
DC-DC converters are used to fill the gaps left by the limitations of direct and
alternating currents. Direct current (DC) is a steady flow of electric energy in the
same direction, while alternating current (AC) is a flow of energy which frequently
changes in direction and intensity. Alternating current is used for the vast majority of
electric transmission, because it is far easier to harness and dispense, and because it
can be easily stepped up or down in intensity by use of transformers, devices which
produce higher or lower levels of voltage by transferring currents into windings of
varying lengths. Because transformers work by means of time delays, they are unable
to work with direct current, due to direct current's constant rate of flow.
Alternating current has thus become far more commonly used simply because it is
far more flexible, and it is the preferred form of current for all forms of transmission
save one: batteries, which are unable to alternate their electrical flow and thus work
on direct current alone. For this reason, the DC-DC converter has become an
important electrical component, acting as the direct current equivalent of a
transformer for battery-operated devices, enhancing or reducing intensity as needed.
1.3.3 WORKING OF DC-DC Converters
In its simplest form, a DC-DC converter simply uses resistors as needed to
break up the flow of incoming energy – this is called linear conversion. However,
16
linear conversion is a wasteful process which unnecessarily dissipates energy and can
lead to overheating. A more complex, but more efficient, manner of DC-DC
conversion is switched-mode conversion, which operates by storing power, switching
off the flow of current, and restoring it as needed to provide a steadily modulated flow
of electricity corresponding to the circuit's requirements. This is far less wasteful than
linear conversion, saving up to 95% of otherwise wasted energy.
1.3.2 BIDIRECTIONAL DC-DC CONVERTERS TOPOLOGIES
There are many circuit topologies for bidirectional dc-dc converter. Some of
them are
I. Non isolated (Without transformer):
a. Full bridge bidirectional dc-dc converter (shown in fig)
b. Half bridge bidirectional dc-dc converter
II. Isolated (with transformer):
a. Full bridge bidirectional dc-dc converter ( shown in fig)
• Output Transistor Safe Operating Area Protection
The KA78XX/KA78XXA series of three-terminal positive regulator are
available in the TO-220/D-PAK package and with several fixed output voltages,
making them useful in a wide range of applications. Each type employs internal
current limiting, thermal shut down and safe operating area protection, making it
essentially indestructible. If adequate heat sinking is provided, they can deliver over
1A output current. Although designed primarily as fixed voltage regulators, these
devices can be used with external components to obtain adjustable voltages and
currents.
2.3 GATE DRIVER CIRCUIT
Driver performs three operations.
1: Amplification
2: Isolation
3: Impedance matching
R 1
1 k
R 2
R 3 R 4
R 5
R 61 k
R 81 k
U 1
O P -0 7 C / 3 0 1 / TI Q 1
B D X3 7
Q 2
Q 3
D 1
D 1 N 1 1 9 0
C 11 n
0
FROM MICRO CONTROLLER
1K
100100
100
S
G500mA
230/12VMCT2E
Fig 30
The buffer IC used here IC 4050 is used for pulse generation to generate triggering
pulse. There are pull up resistors to provide a resistance in series with the
33
microcontroller which acts as a current source here. This IC acts as an impedance
improvement buffer IC. Voltage follower concept is used and the signal is getting
inverted. Now it is given to the isolator.
Since the microcontroller is a sensitive device and MOSFET carries high
current, in order to provide isolation between the two, isolation is being provided by
the optocoupler.
2.4 OPTOCOUPLER
Fig 31: An opto-isolator integrated circuit & Schematic diagram
In electronics, an opto-isolator (or optical isolator, optocoupler or photo
coupler) is a device that uses a short optical transmission path to transfer a signal
between elements of a circuit, typically a transmitter and a receiver, while keeping
them electrically isolated — since the signal goes from an electrical signal to an
optical signal back to an electrical signal, electrical contact along the path is broken.
A common implementation involves an LED and a light sensor, separated so
that light may travel across a barrier but electrical current may not. When an electrical
signal is applied to the input of the opto-isolator, its LED lights, its light sensor then
activates, and a corresponding electrical signal is generated at the output. Unlike a
transformer, the opto-isolator allows for DC coupling and generally provides
significant protection from serious overvoltage conditions in one circuit affecting the
other.
34
With a photodiode as the detector, the output current is proportional to the
amount of incident light supplied by the emitter. The diode can be used in a
photovoltaic mode or a photoconductive mode.
In photovoltaic mode, the diode acts like a current source in parallel with a
forward-biased diode. The output current and voltage are dependent on the load
impedance and light intensity. In photoconductive mode, the diode is connected to a
supply voltage, and the magnitude of the current conducted is directly proportional to
the intensity of light.
An opto-isolator can also be constructed using a small incandescent lamp in
place of the LED; such a device, because the lamp has a much slower response time
than an LED, will filter out noise or half-wave power in the input signal. In so doing,
it will also filter out any audio- or higher-frequency signals in the input. It has the
further disadvantage, of course, (an overwhelming disadvantage in most applications)
that incandescent lamps have finite life spans. Thus, such an unconventional device is
of extremely limited usefulness, suitable only for applications such as science
projects.
The optical path may be air or a dielectric waveguide. The transmitting and
receiving elements of an optical isolator may be contained within a single compact
module, for mounting, for example, on a circuit board; in this case, the module is
often called an optoisolator or opto-isolator. The photo sensor may be a photocell,
phototransistor, or an optically triggered SCR or Triac. Occasionally, this device will
in turn operate a power relay or contactor.
2.4.1 Device rating:
OPTOCOUPLER MCT2E – 1 K, 100 Ω resistance
Here the LED glows and current flows through the base of the transistor, so
the signal will be got across a resistance and given to another transistor CK 100 which
is a PNP transistor to provide inversion again. In order to improve the voltage and the
current gain we go for the Darlington amplifier, which amplifies the voltage.
35
2.5 DARLINGTON AMPLIFIER
Fig 32 Circuit diagram of Darlington configuration
In electronics, the Darlington transistor is a semiconductor device which
combines two bipolar transistors in tandem (often called a "Darlington pair") in a
single device so that the current amplified by the first is amplified further by the
second transistor. This gives it high current gain (written β or hFE), and takes up less
space than using two discrete transistors in the same configuration. The use of two
separate transistors in an actual circuit is still very common, even though integrated
packaged devices are available. This configuration was invented by Bell Laboratories
engineer Sidney Darlington. The idea of putting two or three transistors on a single
chip was patented by him, but not the idea of putting an arbitrary number of
transistors, which would have covered all modern integrated circuits.
A similar transistor configuration using two transistors of opposite type (NPN
and PNP) is the Sziklai pair, sometimes called the "complementary Darlington".
Finally the amplified signal is sent to the multilevel inverter and the output is
obtained.
2.6 SEMICONDUCTOR DEVICES
The electronic semiconductor device act as a switching device in the
power electronic converters. In general, the characteristics of the device are utilized in
such a way that it acts as a short circuit when closed. In addition to, an ideal switch
also consumes less power to switch from one state to other.
36
Semiconductor is defined as the material whose conductivity depends
on the energy (light, heat, etc.,) falling on it. They don’t conduct at absolute zero
temperature. But, as the temperature increases, the current conducted by the semi
conductor increases as it gets energy in the form of heat. The increase in current is
proportional to the temperature rise. Semiconductor switches are diodes, SCR,
MOSFET, IGBT, BJT, TRIAC etc.,
2.6.1 CLASSIFICATION OF SEMICONDUCTOR DEVICE
Based on controllability:
Uncontrolled switching device (SCR)
Semi control switching device
Fully control switching device
Based on control modes:
Current control devices(SCR ,BJT)
Voltage control device(MOSFET ,IGBT)
Based on current direction:
Unidirectional device (SCR,MOSFET ,IGBT)
Bi- Unidirection device(TRIAC)
2.6.2 MOSFET
The component that is used as the switch in the inverter unit is the MOSFET which is a voltage controlled device. They are the power semi conductor devices that have a fast switching property with a simple drive requirement.
Fig 33: MOSFET symbol
Vdss= 500 V
Rds (on) = 0.27 ohm
Id= 20 A
37
This MOSFET provide the designer with the best combination of fast switching,
ruggedixed device design, low on-resistance and cost-effectiveness. This package is
preferred for commercial and industrial applications where higher power levels are to
be handled.
2.6.3. MOSFET OPERATING PRINCIPLE
CONSTRUCTION N Channel depletion type N Channel enhancement type
Fig 34: construction of MOSFET
N CHANNEL DEPLETION
The N channel depletion type of MOSFET is constructed with p -Substrate. it
has two n doped regions , which forms the drain and source. It has sio2 insulating layer
between the channel and the metal layer. Thus it has three terminals namely drain
source and gate.
When negative voltage applied between the gate and source (VGS) , The
positive charge induced in the channel and the channel is depleted of electrons. Thus
there is no flow of current through this terminal.
When appositive voltage is applied between the gate and source, more electros
are induced in the channel by capacitor action. So there is a flow of current from drain
to source. As the gate source voltage increases, the channel gets wider by
accumulation of more negative charges and resistance to the channel decreases. Thus
more current from drain to source. As there is a current flow through device for zero
Gate Source Voltage, it is called as normally ON MOSFET.
38
N CHANNEL ENHANCEMENT
The N channel enhancement MOSFET is similar to the depletion type in the
construction except that there is no physical existence of the channel when it is
unbiased.
When the positive voltage is applied between the gate and the source, the
electron get accumulated in the channel by capacitive induction in the channel formed
out of electrons allowing the flow of current. This channel gets widened as more
positive voltage is applied between gate and source. There will not be any condition
through the device if the gate source voltage is negative.
Setting VGS to a constant value, varying VDS and nothing the corresponding
changes into give the drain characteristic. VGS ≤0, the device does not conduct drain
current and the device is considered to be in the off state. In this state, the entire
voltage drop across the device i.e., between drain and source.
In the ON state of the device, gate source voltage is positive and the drain
current is increased with the increase in the gate source voltage. It is understood
clearly in the transfer characteristics. As the enhancement type mosfet conduct only
after applying positive gate voltage, it is also called as normally OFF MOSFET. For
this reason it becomes easily controllable and is used in power electronics as a switch.
2.7 MICRO CONTROLLER PIC 16f877A
MICROCONTROLLER
Microcontrollers versus Microprocessors
Microcontroller differs from a microprocessor in many ways. First and the
most important is its functionality. In order for a microprocessor to be used, other
components such as memory, or components for receiving and sending data must be
added to it. In short that means that microprocessor is the very heart of the computer.
On the other hand, microcontroller is designed to be all of that in one. No other
external components are needed for its application because all necessary peripherals
are already built into it. Thus, we save the time and space needed to construct devices.
39
2.7.1 MICROCONTROLLER
The main controlling unit of the proposed system is the microcontroller. The
main features of microcontroller and particularly PIC Microcontroller is discussed
here.
A microcontroller consists of a powerful CPU tightly coupled with memory
[RAM,ROM or EPROM],various I/O features such as serial ports, parallel
ports ,timer/counters, interrupt controller ,data requisition interface , Analog to digital
converter[ADC],digital to analog converter, everything integrated into a single
silicon chip.
It does not mean that any microcontroller should have all the above said
features on a single chip, depending on the need and area of application for which it is
designed, the on chip features present in it may or may not include all the individual
section said above.
Any microcomputer systems requires memory to store a sequence of
instructions making up a program ,parallel port or serial port for communicating with
an external system timer/counter for control purpose like generating time delay.
2.7.2 PIC MICROCONTROLLER
The PIC micro was originally designed around 1980 by General Instrument
as a small, fast, inexpensive embedded microcontroller with strong I/O capabilities.
PIC stands for "Peripheral Interface Controller". General Instrument recognized the
potential for the little PIC and eventually spun off Microchip, headquartered in
Chandler, AZ to fabricate and market the PICmicro.
The PICmicro has some advantages in many applications over the older chips
such as the Intel 8048/8051/8052 and its derivatives, the Motorola MC6805/6hHC11,
and many others. Its unusual architecture is ideally suited for embedded control.
Nearly all instructions execute in the same number of clock cycles, which makes
timing control much easier. The PICmicro is a RISC (Reduced Instruction Set
Computer) design, with only thirty-odd instructions to remember; its code is
40
extremely efficient, allowing the PIC to run with typically less program memory than
its larger competitors.
Very important, though, is the low cost, high available clock speeds, small
size, and incredible ease of use of the tiny PIC. For timing-insensitive designs, the
oscillator can consist of a cheap RC network. Clock speeds can range from low speed
to 20MHz. Versions of the various PICmicro families are available that are equipped
with various combinations ROM, EPROM, OTP (One-Time Programmable) EPROM,
EEPROM, and FLASH program and data memory. An 18-pin PICmicro typically
devotes 13 of those pins to I/O, giving the designer two full 8-bit I/O ports and an
interrupt. In many cases, designing with a PICmicro is much simpler and more
efficient than using an older, larger embedded microprocessor.
2.7.3 FEATURES OF PIC CONTROLLER:
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
• Pinout compatible to the PIC16C73B/74B/76/77
• Interrupt capability (up to 14 sources)
• 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 peration
• Programmable code protection
• Power saving SLEEP mode
• Selectable oscillator options
• Low power, high speed CMOS FLASH/EEPROM technology
• Fully static design
• In-Circuit Serial Programming (ICSP) via two pins
41
• Single 5V In-Circuit Serial Programming capability
• In-Circuit Debugging via two pins
• Processor read/write access to program memory
• Wide operating voltage range: 2.0V to 5.5V
• High Sink/Source Current: 25 mA
• Commercial, Industrial and Extended temperature ranges
• Low-power consumption:
2.7.4 ADVANTAGES OF MICROCONTROLLER
If a system is developed with a microprocessor the designer has to go for
external memory such as RAM ,ROM or EPROM and peripherals and hence
the size of the PCB will large enough to
hold all the required peripheral. But, the microcontroller has got all there
peripheral facilities on a single chip so developed of a similar system with a
microcontroller reduces PCB size and cost of the design.
One of the major difference between a microcontroller and a microprocessor is
that a controller. often deals with bits,not bytes as in the real world
application, for example switch contacts can only be open or close ,indicators
should be lit or dark and motors can be either turned on or off and so forth.
The microcontroller has two 16 bits timer/counters built within it, which
makes it more suitable to this application since, we need to produce some
accurate time delays.
This microcontroller has a 8 bit internal Analog to digital converter with a 10
bit resolution, which will after the usage of external ADC and the circuit and
hardware complexity.
These controllers also have an higher erase cycle of 10,000 and for the
EEPROM its 1 lakh number of time. This controllers other advantage is it’s a
RISC computing system.
42
2.7.2 PIN DIAGRAM OF 16F877A PIC CONTROLLER
Fig35: pin diagram of PIC
2.7.3 I/O PORTS
Some pins for these I/O ports are multiplexed with an alternate function for the
peripheral features on the device. In general, when a peripheral is enabled, that pin
may not be used as a general purpose I/O pin. Additional information on I/O ports
may be found in the PICmicro™ Mid-Range Reference Manual, (DS33023).
PORTA AND THE TRISA REGISTER
43
PORTA is a 6-bit wide, bi-directional port. The corresponding data direction
register is TRISA. Setting a TRISA bit (= 1) will make the corresponding PORTA pin
an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing
a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e., put the
contents of the output latch on the selected pin). Reading the PORTA register reads
the status of the pins, whereas writing to it will write to the port latch. All write
operations are read-modify-write operations. Therefore, a write to a port implies that
the port pins are read, the value is modified and then written to the port data latch. Pin
RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI
pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open drain output. All
other PORTA pins have TTL input levels and full CMOS output drivers. Other
PORTA pins are multiplexed with analog inputs and analog VREF input. The
operation of each pin is selected by clearing/setting the control bits in the ADCON1
register (A/D Control Register1).
PORTB AND THE TRISB REGISTER
PORTB is an 8-bit wide, bi-directional port. The corresponding data direction
register is TRISB. Setting a TRISB bit (= 1) will make the corresponding PORTB pin
an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing
a TRISB bit (= 0) will make the corresponding PORTB pin an output (i.e., put the
contents of the output latch on 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.
Four of the PORTB pins, RB7:RB4, have an interrupton- change feature. Only
pins configured as inputs can cause this interrupt to occur (i.e., any RB7:RB4 pin
configured as an output is excluded from the interrupton- change comparison). The
input pins (of RB7:RB4) are compared with the old value latched on the last read of
PORTB. The “mismatch” outputs of RB7:RB4 are OR’ed together to generate the RB
Port Change Interrupt with flag bit RBIF (INTCON<0>).
44
PORT C AND THE TRISC REGISTER
PORTC is an 8-bit wide, bi-directional port. The corresponding data direction
register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC pin
an input (i.e., put the corresponding output driver in a Hi-Impedance mode). Clearing
a TRISC bit (= 0) will make the corresponding PORTC pin an output (i.e., put the
contents of the output latch on the selected pin). PORTC is multiplexed with several