Pic Report
Pic Report
Pic Report
First of all I would like to thank almighty GOD who has given this wonderful gift
of life to us. He is the one who is guiding us in right direction to follow noble path
of humanity. In my six weeks industrial training it is a wonderful experience to be
a part of NETMAX TECHNOLOGIES where I have opportunity to work under
brilliant minds. I owe my deep regards for the supporting and kind staff authorities
who are helping me in my lean patches during these six weeks. The knowledge I
am gaining throughout my studies have the practical implementation during this
period. I am grateful to all the staff of NETMAX and for their timely support and
sharing of their experience with me. I would like to express my heartiest concern
for Mr. ROHIT KHOSLA for his able guidance and for his inspiring attitude,
praiseworthy attitude and honest support. Not to forget the pain staking efforts of
our college training and placement cell and specially my training and placement
officer Miss. SWETA AGGRAWAL. Last but not the least I would express my
utmost regards for the electronics and communication department of our Institute.
1
CONTENTS
1) Company profile
2) Embedded Systems
What is Embedded System
Applications
Difference between microprocessor & micro controller
Types of microcontroller Architectures
Difference between CISC & RISC
3) PIC microcontrollers
PIC 16F73 features
Pin diagram of PIC16F73
Pin description of PIC16F73
Core Architecture
Electrical Characterstics
4) Programming of PIC
Compiler Used-mikroC
Features
Projects
Functionality
5) Programming and Interfacing
Advantages of C over Assembly language programming
Project no. 1- LED interfacing and its blinking(port
programming)
Project no. 2- seven segment interfacing and display
2
Project no. 3- Interfacing and control of stepper motor
with PIC 16F73
Project no. 4-LCD interfacing and display with PIC
16F73
Project no. 5-Built in ADC of PIC16F73(Temperature
Monitoring)
Project no. 6-To study switching action of PIC pins.
Project no. 7-Interfacing of keyboard matrix
Project no. 8-Serial communication [b/w PC &
Microcontroller]
Project no. 9- Sunlight level measurement of PIC16F73.
3
COMPANY PROFILE
Netmax Technologies is an organization which is established in the field of
Network Support, Network training and Embedded systems. It provides support
and training in the field of networking solutions (CISCO, LINUX) and embedded
systems (Micro controller based design, Electronics system design).
1) CEDTI, Mohali
5) NIPER, Mohali
4
7) Software Technology Parks India, Mohali
9) Rana Group
10) IDS
14) BBMB
16) Quark
b) SUN networks
e) Radio Links
f) Security Solutions
a) AVR family
5
b) MCS 51
Network Training
c) SUN SOLARIS
6
EMBEDDED SYSTEM
Any electronic system that uses a CPU chip, but that is not a general-purpose
workstation, desktop or laptop computer is known as embedded system. Such
systems generally use microprocessors; microcontroller or they may use
custom-designed chips or both. They are used in automobiles, planes, trains,
space vehicles, machine tools, cameras, consumer and office appliances, cell
phones, PDAs and other handhelds as well as robots and toys. The uses are
endless, and billions of microprocessors are shipper every year for a myriad of
applications.
7
DIFFERENCE BETWEEN MICROPROCESSORS AND
MICROCONTROLLERS:
DISADVANTAGES OF MICROPROCESSORS
OVER MICROCONTROLLERS
8
• We need to add some external devices such as PPI chip, Memory,
Timer/counter chip, Interrupt controller chip,etc. to make it
functional.
There are two types of Microcontroller architecture designed for embedded system
development. These are:
CISC stands for Complex Instruction Set Computer. Most PC's use CPU based on
this architecture. For instance Intel and AMD CPU's are based on CISC
architectures. Typically CISC chips have a large amount of different and complex
instructions. In common CISC chips are relatively slow (compared to RISC chips)
per instruction, but use little (less than RISC) instructions. MCS-51 family
microcontrollers based on CISC architecture.
RICS stands for Reduced Instruction Set Computer. The philosophy behind it is
that almost no one uses complex assembly language instructions as used by CISC,
and people mostly use compilers which never use complex instructions. Therefore
fewer, simpler and faster instructions would be better, than the large, complex and
slower CISC instructions. However, more instructions are needed to accomplish a
task. Atmell’s AVR microcontroller based on RISC architecture.
9
PIC MICROCONTROLLER
10
PIC 16 SERIES-PIC16F73
It is available in different configurations viz 8bit,16 bit,32 bit with instructions set
as given below :
Under 8 bit comes-PIC10 xxxx, PIC12 xxxx, PIC16 xxxx, PIC18 xxxx.(12 bit
instruction set)
Peripheral Features:
12
• 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.
• 8-bit, up to 8-channel Analog-to-Digital converter.
• Synchronous Serial Port (SSP) with SPI (Master mode) and I2C(Slave).
• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI).
• Parallel Slave Port (PSP), 8-bits wide with external RD, WR and CS controls
(40/44-pin only).
• Brown-out detection circuitry for Brown-out Reset (BOR).
CMOS Technology:
• Low power, high speed CMOS FLASH technology.
• Fully static design.
• Wide operating voltage range: 2.0V to 5.5V.
• High Sink/Source Current: 25 Ma.
• Industrial temperature range.
• Low power consumption:
- < 2 mA typical @ 5V, 4 MHz
13
PIN DIAGRAM
14
PIN DESCRIPTION
15
MCLR-(pin 1)
PIC16F7X devices have a noise filter in the MCLR Reset path. The filter will
detect and ignore small pulses. It should be noted that a WDT Reset does not drive
MCLR pin low. The behavior of the ESD protection on the MCLR pin has been
altered from previous devices of this family. Voltages applied to the pin that
exceed its specification can result in both MCLR Resets and excessive current
beyond the device specification during the ESD event. For this reason, Microchip
recommends that the MCLR pin no longer be tied directly to VDD.
RESET
GND –(pin 8)
OSC1/CLKIN-(pin 9)
OSC2/CLKOUT-(pin 10)
OSCILLATOR TYPES
17
PORTC and the TRISC Register(pin 11 to 18)
make the corresponding PORTC pin an output (i.e., put the contents of the output
latch on the selected pin).
Vss(pin 19)
Vdd(pin 20)
18
Each of the PORTB pins has a weak internal pull-up. A single control bit can turn
on all the pull-ups. 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.
CORE ARCHITECTURE
Figure 2.1: Showing a typical microcontroller device and its different subunits
19
• Most instructions are single cycle execution (4 clock cycles), with single
delay cycles upon branches and skips
• A single accumulator (W), the use of which (as source operand) is implied
(i.e. is not encoded in the opcode)
• All RAM locations function as registers as both source and/or destination of
math and other functions.
• A hardware stack for storing return addresses
• A fairly small amount of addressable data space (typically 256 bytes),
extended through banking
• Data space mapped CPU, port, and peripheral registers
• The program counter is also mapped into the data space and writable (this is
used to implement indirect jumps).
Unlike most other CPUs, there is no distinction between memory space and
register space because the RAM serves the job of both memory and registers, and
the RAM is usually just referred to as the register file or simply as the registers
ELECTRICAL CHARACTERISTICS
Voltage on any pin with respect to VSS (except VDD, MCLR. and
RA4) ......................................... -0.3V to (VDD + 0.3V)
20
Voltage on RA4 with respect to Vss ..................................0 to +12V
21
PROGRAMMING OF PIC
COMPILER USED-
mikroC
Introduction to mikroC
22
mikroC IDE
PIC and C fit together well: PIC is the most popular 8-bit chip in the world, used in
a wide variety of applications, and C, prized for its efficiency, is the natural choice
for developing embedded systems. mikroC provides a successful match featuring
highly advanced IDE, ANSI compliant compiler, broad set of hardware libraries,
comprehensive documentation, and plenty of ready-to-run examples.
Features
• Write your C source code using the built-in Code Editor (Code and
Parameter Assistants, Syntax Highlighting, Auto Correct, Code Templates,
and more…)
• Use the included mikroC libraries to dramatically speed up the development:
data acquisition, memory, displays, conversions, communications…
Practically all P12, P16, and P18 chips are supported.
• Monitor your program structure, variables, and functions in the Code
Explorer.
• Generate commented, human-readable assembly, and standard HEX
compatible with all programmers.
• Inspect program flow and debug executable logic with the integrated
Debugger.
• Get detailed reports and graphs: RAM and ROM map, code statistics,
assembly listing, calling tree, and more…
• We have provided plenty of examples for you to expand, develop, and use
as building bricks in your projects. Copy them entirely if you deem fit –
that’s why we included them with the compiler.
Projects
New Project
The easiest way to create project is by means of New Project Wizard, drop-down
menu Project › New Project. Just fill the dialog with desired values (project name
and description, location, device, clock, config word) and mikroC will create the
appropriate project file . Also, an empty source file named after the project will be
created by default. mikroC does not require you to have source file named same as
the project, it’s just a matter of convenience.
Edit Project
Later, you can change project settings from the drop-down menu Project › Edit
Project. You can rename the project, modify its description, change chip, clock,
config word, etc.
24
To delete a project, simply delete the folder in which the project file (extension
.ppc) is stored.
A project can contain any number of source files (extension .c). The list of relevant
source files is stored in the project file (extension .ppc).
To add source file to your project, select Project › Add to Project from the drop-
down menu, or click the Add to Project Icon . Each added source file must be
self-contained, i.e. it must have all the necessary definitions after preprocessing.
To remove file(s) from your project, select Project › Remove from Project from the
drop-down menu, or click the Remove from Project Icon .
Note: For inclusion of the header files (extension .h), use the preprocessor
directive #include. See File Inclusion for more information.
By using the Project Files' new features, you can reach all the output files (.lst,
.asm) by a single click. You can also include in project the library files (.mcl), for
libraries, either your own or compiler default, that are project-specific.
Libraries (.mcl) now have different, more compact format, compared to mikroC
version 2. This, however, means that library formats are now incompatible. The
users that are making transition from version 2 to 5, must re- build all their
previously written libraries in order to use them in the new version. All the source
code written and tested in previous versions should compile correctly on version
5.0, except for the asm{} blocks, which are commented in the asm section of help.
Project Level Defines(.pld) files can also be added to project. Project level define
files enable you to have defines that are visible in all source files in the project. A
file must contain one definition per line in the following form:
<symbol>[=[<value>]]
25
<symbol (a,b)>[=[<value>]]
There are two predefined project level defines see predefined project level
defines..
Commonly used is
Void delay_ms()
{int I;
While (i !=0)
i--;
Also PIC has a internal TRIS register which controls the flow of insructions from
the corresponding port.
26
PROGRAMMING AND INTERFACING
Advantages of C over Assembly language programming:
• Details like register allocation and addressing of memory and data is managed
by the compiler.
• Programs get a formal structure and can be divided into separate functions.
PROJECT NO-1
27
the interfacing of LED is shown in the figure above.it is given Vcc through
resistors of 330E.
also a darlington pair IC is also used i.e.ULN 2803 which shift the dc level of
volage coming from port of pic microcontroller.
Now to glow the desired LED ,proper hexadecimal code for its binary is
programmed in pic.eg.to glow alternative LED’s the binary code will be10101010
and its corresponding hexadecimal code will be 0xAA.
Also PIC has a internal TRIS register which controls the flow of insructions from
the corresponding port i.ee PORT will behave as input(if =1) and as output(if=0).
28
CODING FOR BLINKING
void main()
while(1)
}}
29
PROJECT NO-2
A Seven segment display consists of seven LED’s arranged in pattern of digit like
8
We use a bcd to seven segment decoder which saves pin of microcontroller from
seven(one for each Led) to four.So we have to give bcd code for desired digit to be
displayed on it.
Now also we can display more then one seven segment display simultaneously.but
it will take a number of pins of controller.So we use two pins from controller to
control the display of seven segment one by one from same port such that it
appears to be displaying simultaneously.
30
Tdis is done by providing a very small delay such that our eyes cant even detect
the change over from one display to another.
void main()
TRISB=0xf0;
TRISC=0xf0;
PORTC=0x00;
while(1)
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
31
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(1000);
delay_ms(10000);
delay_ms(10000);
the above program will display 0 to 9 on one seven segment display with a delay
of one second between it.\
CODE IS
void main()
32
TRISB=0xf0;
TRISC=0xf0;
PORTC=0x00;
while(1)
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
33
Thus program for both single seven segment and multiple seven segment displays
has been studied.
PROJECT NO-3
Stepper motor are those which rotates in steps.like all motors it is also based on
electromagnetic induction i.e. electric field produces a magnetic field whose
variation causes a torque which rotates the motor.
A stepper motor is a brushless, synchronous electric motor that can divide a full
rotation into a large number of steps. The motor's position can be controlled
precisely, without any feedback mechanism (see open loop control). Stepper
motors are similar to switched reluctance motors, which are very large stepping
motors with a reduced pole count, and generally are closed-loop commutated.
Fundamentals of Operation
Stepper motors operate much differently from normal DC motors, which rotate
when voltage is applied to their terminals. Stepper motors, on the other hand,
effectively have multiple "toothed" electromagnets (a.k.a. phases) arranged around
a central gear-shaped piece of iron. The electromagnets are energized by an
34
external control circuit, such as a microcontroller. To make the motor shaft turn,
first one electromagnet is
given power, which makes the gear's teeth magnetically attracted to the
electromagnet's teeth. When the gear's teeth are thus aligned to the first
electromagnet, they are slightly offset from the next electromagnet. So when the
next electromagnet is turned on and the first is turned off, the gear rotates slightly
to align with the next one, and from there the process is repeated. Each of those
slight rotations is called a "step." In that way, the motor can be turned a precise
angle.
Now to run the motor we have to feed the binary code to turn on the current of that
winding…
CODE IS
void forward();
void reverse();
int i;
void main()
35
{
TRISB=0xf0;
PORTB=0x00;
while(1)
forward();
delay_ms(400);
reverse();
delay_ms(400);
void forward()
for(i=0;i<=50;i++)
PORTB=0x03;
delay_ms(70);
PORTB=0x06;
delay_ms(70);
36
PORTB=0x0c;
delay_ms(40);
PORTB=0x09;
delay_ms(40);
void reverse()
for(i=0;i<=50;i++)
PORTB=0x09;
delay_ms(40);
PORTB=0x0c;
delay_ms(40);
PORTB=0x06;
delay_ms(40);
PORTB=0x03;
delay_ms(40);
}}
37
The above code will rotate the motor first in forward direction and then in reverse
direction.
PROJECT NO-4
LCD stands for Liquid Crystal Display.to run it via PIC 16F73,we need command
signals and vcc to drive it.now the signal that is required to display character is
produced by an IC which is already embedded on it.its name is HD44780.
38
Although the LCD module data sheets specify 5V D.C. supply (at only a few
milliamps), supplies of 6V & 4.5V both work well, and even 3V is sufficient for some
modules. Consequently, these modules can be effectively and economically powered
by batteries.
Pin 3 is a control pin, Vee, which is used to alter the contrast of the display. Ideally,
these pin should be connected to a variable voltage supply. A preset potentiometer
connected between the power supply lines, with its wiper connected to the contrast
pin is suitable in many cases, but be aware that some modules may require a
negative potential; as low as 7V in some cases. For absolute simplicity, connecting
this pin to 0V will often suffice.
39
status. By setting the RS line high, character data can be transferred to and from
the module.
Pin 5 is (R/W) line. This line is pulled low in order to write commands or
character data to the module, or pulled high to read character data or status
information from its registers.
Pin 6 is Enable (E) line. This input is used to initiate the actual transfer of
commands or character data between the module and the data lines. When writing
to the display, data is transferred only on the high to low transition of this signal.
However, when reading from the display, data will become available shortly after
the low to high transition and remain available until the signal falls low again.
Pins 7 to 14 are the eight data bus lines (D0 to D7). Data can be transferred to
and from the display, either as a single 8-bit byte or as two 4-bit “nibbles”. In the
latter case, only the upper four data lines (D4 to D7) are used. This $-bit mode is
beneficial when using a microcontroller, as fewer I/O lines are required.
CODING
void main()
40
TRISB = 0; // PORTB is output
void main()
41
Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off
Lcd_Out(2, 5,text1);
while(1)
Lcd_Cmd(LCD_SHIFT_LEFT);
delay_ms(1000);
} }
It will shift the character to the left with a delay of 1 sec between it.
PROJECT NO-5
These are externally connected to microcontroller like AT89s51 which don’t have
inbuilt ADC.
42
Now as PIC 16xxx has got the feature of inbuilt ADC.so,there is no need to
connect externally.PIC16XXX is featured with 8 bit ADC.
So can convert an analog value to 8 bit binary or from 0 to 255 in decimal range.
The 8-bit analog-to-digital (A/D) converter module has five inputs for the
PIC16F73/76 and eight for the PIC16F74/77.
The A/D allows conversion of an analog input signal to a corresponding 8-bit
digital number. The output of the sample and hold is the input into the converter,
which generates the result via successive approximation. The
analog reference voltage is software selectable to either the device’s positive
supply voltage (VDD), or the voltage level on the RA3/AN3/VREF pin.
The A/D converter has a unique feature of being able to operate while the device is
in SLEEP mode. To operate in SLEEP, the A/D conversion clock must be derived
from the A/D’s internal RC oscillator.
The A/D module has three registers. These registers
are:
• A/D Result Register (ADRES)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
The ADCON0 register, shown in Register 11-1, controls the operation of the A/D
module. The ADCON1 register, shown in Register 11-2, configures the functions
of the port pins. The port pins can be configured as analog inputs (RA3 can also be
a voltage reference), or as digital I/O.
43
From 4th pin we are gaetting Analog input.
44
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0
ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE -------- ADON
bit 7 bit 0
PCFG2:PCFG0 RA0 RA1 RA2 RA5 RA3 RE0(1) RE1(1) RE2(1) VREF
000 A A A A A A A A VDD
001 A A A A VREF A A A RA3
010 A A A A A D D D VDD
45
011 A A A A VREF D D D RA3
100 A A D D A D D D VDD
101 A A D D VREF D D D RA3
11x D D D D D D D D VDD
A = Analog input
D = Digital I/O
char *text;
long tlong;
void main()
47
TRISA = 0xFF; // designate PORTA as input delay_ms(7000);
while (1)
delay_ms(300) ;
LCD_Chr_CP('.');
LCD_Chr_CP('V');
48
delay_ms(3000) ;
delay_ms(1);
PROJECT NO-6
Syntax:
PORT( NAME).F(0 to 7)
Internally,when pin is high its flip flop is sat.when external switch is closed ,it
forces no current or voltage to enter to pin and also lowers the pin from 1 to 0.
Thus when switch is pressed ,the pin becomes zero.so ,implementing this in
practical.
The swiches whose one end are connected to pins of nontroller are shown on next
page
49
The coding will be as follos:
#define s0 PORTC.F0
#define s1 PORTC.F1
#define s2 PORTC.F2
#define s3 PORTC.F3
#define s4 PORTC.F4
50
void main()
do
delay_ms(600);
delay_ms(600);
51
PORTB=0x20; \\3rd LED glows
delay_ms(600);
delay_ms(600);
else
PORTB=0xff;
}}
while(1);
PROJECT NO-7
As in last practical,we use one switch per pinof controller.So,to use 8 pins for 8
switches.
52
While if it is desired to have more options for a pin,a matrix is formed in which
row and column are made such that each pin can contol more than one switch or
vice versa.
53
#define row3 PORTC.F3
void main()
TRISB=0x00;
TRISC=0xff;
PORTC=0xff;
LCD_INIT(&PORTB);
LCD_OUT(1,1,"SWITCH=");
do
LCD_OUT(1,8," ");
lcd_out(1,8,"k0");
delay_ms(600);
54
}
lcd_out(1,8,"k1");
delay_ms(600);
lcd_out(1,8,"k2");
delay_ms(600);
lcd_out(1,8,"k3");
delay_ms(600);
lcd_out(1,8,"k4");
55
delay_ms(600);
lcd_out(1,8,"k5");
delay_ms(600);
lcd_out(1,8,"k6");
delay_ms(600);
lcd_out(1,8,"k7");
delay_ms(600);
56
lcd_out(1,8,"k8");
delay_ms(600);
lcd_out(1,8,"k9");
delay_ms(600);
lcd_out(1,8,"k10");
delay_ms(600);
lcd_out(1,8,"k11");
delay_ms(600);
else
57
{Lcd_out(1,8," ");}
while(1);
PROJECT NO-8
To send data via single line through a bit stream is known as serial
communication.
58
PIC has two buffers and it allows full duplex communication.to change settings we
have to re configure TXSTA register
59
Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be set in order to configure
pins RC6/TX/CK and RC7/RX/DT as the Universal Synchronous Asynchronous
Receiver Transmitter.
60
bit 0 TX9D: 9th bit of transmit data. Can be parity bit
Now coding
void main()
61
usart_init(2400);
while(1)
usart_write('s');
usart_write('a');
usart_write('g');
usart_write('a');
usart_write('r');
delay_ms(600);
unsigned int i;
void main()
usart_init(2400);
while(1)
if(usart_data_ready() )
62
{
i= usart_read();
usart_write('i');
usart_write('s');
usart_write('a');
usart_write('g');
usart_write('a');
usart_write('r');
delay_ms(600);
void main()
Usart_Init(2400);
while(1)
63
display(arr);
delay_ms(600);
while(*s!='$')
usart_Write(*s);
delay_ms(10);
s++;
64
Project no. 9-
Programming of Sunlight level measurement of PIC16F73.
const char sun1[]={4,3,10,6,20,12,8,8};
65
const char sadwh4[] = {16,16,16,17,8,4,2,1};
void custom(const char *ptr, unsigned char n, unsigned char r, unsigned char c)
unsigned char i;
Lcd_Cmd(64+n*8);
for(i=0;i<=7;i++)
Lcd_Chr_Cp(ptr[i]);
Lcd_Cmd(LCD_RETURN_HOME);
Lcd_Chr(r,c,n);
}
66
void ascii(unsigned int temp)
k = temp;
k = k/10;
k= k+48;
Lcd_Chr_Cp(k);
k = temp%10;
k = k+48;
Lcd_Chr_Cp(k);
void main()
while(1)
Lcd_Init(&PORTB);
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
67
light_res = adc_read(1); //Read value from channel 1 i.e light sensor
Lcd_Chr(1, 5, 'L');
Lcd_Chr(1, 6, 'I');
Lcd_Chr(1, 7, 'G');
Lcd_Chr(1, 8, 'H');
Lcd_Chr(1, 9, 'T');
ascii(light_res);
Delay_ms(2000);
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Chr(1, 5, 'L');
Lcd_Chr(1, 6, 'I');
Lcd_Chr(1, 7, 'G');
Lcd_Chr(1, 8, 'H');
Lcd_Chr(1, 9, 'T');
ascii(light_res);
if(light_res>21)
custom(sun1,0,1,14);
custom(sun2,1,1,15);
custom(sun3,2,1,16);
68
custom(sun4,3,2,14);
custom(sun5,4,2,15);
custom(sun6,5,2,16);
custom(sun1, 0,1,14);
custom(sun2, 1,1,15);
custom(sun3, 2,1,16);
custom(cloud4,4,2,14);
custom(cloud5,5,2,15);
custom(cloud6,6,2,16);
if(light_res<10)
custom(moon1,0,1,14);
custom(moon2,1,1,15);
custom(moon3,2,1,16);
custom(moon4,3,2,14);
custom(moon5,4,2,15);
custom(moon6,5,2,16);
Delay_ms(2000);
69
}
First part of electronics ckts. is power. The main power supply is in AC but mostly
electronic ckts. work with DC. So a system is required to convert ac to dc and
these sources should able to produce stable supplies.
Power supplies may be used in. may be of different types such as regulated,
unregulated, smps etc.
These are the power supplies in which the out put is not constant. That it is
varies with input voltage, load, and also effected by the environment conditions
such as temperature, etc. so these are the variable supplies. Commonly these
supplies are not employed as there efficiency is very less. The unregulated
power can be obtained using rectifying circuit after AC supply.
These are the power supplies in which the output voltage is constant, i.e. the
out put voltage is independent of the input voltage, load and other external
conditions. So to obtain the regulated voltage using different regulators. The
regulator voltage is mainly the DC voltage, it may AC to or DC to DC voltage.
A better approach to power supply design is to use enough capacitance to
reduce ripple to low level, then use an active feedback circuit to eliminate the
remaining ripple and dependence of output voltage on input, load and
environment conditions. These active devices are known as Regulators. These
70
regulators can be used to produce negative and positive voltage of required
value.
Constant positive voltage regulators:- These are the regulators which are able to
produce positive and constant voltage. Some of them are given below:-
Constant negative voltage regulators:- These are also the constant output
voltage regulator but there output is negative in polarity. These regulators are also
employed according to voltage requirements. Some of them are given below with
there outputs:-
71
2 LM7910 -10v
3 LM7912 -12v
4 LM7915 -15v
Variable voltage regulators:- These are the regulator whose output voltage can
be varied according to the desired need. These regulators again of two types i.e.:-
• Positive
• Negative
The output of these regulators can be varied by varying the resistance of the
variable resistance which is connected to the adjustable pin the regulators. So these
are the most commonly used regulators in the electronic industry as wide range of
stable voltage can be obtained from single chip by varying the resistance
connected to the adjustable pin of the regulators. The most commonly variable
regulators are:-
General Description:
72
The LM317 series of adjustable 3-terminal positive voltage regulators is capable of
supplying in excess of 1.5A over a 1.2V to 37V output range. They are
exceptionally easy to use and require only two external resistors to set the output
voltage. Further, both line and load regulation is better than standard fixed
regulators. Also, the LM117 is packaged in standard transistor packages which are
easily mounted and handled. In addition to higher performance than fixed
regulators, theLM317 series offers full overload protection available only in IC’s.
Included on the chip are current limit, thermal overload protection and safe area
protection. All overload protection circuitry remains fully functional even if the
adjustment terminal is disconnected. Normally, no capacitors are needed unless the
device is situated more than 6 inches from the input filter capacitors in which case
an input bypass is needed. An optional output capacitor can be added to improve
transient response.
The adjustment terminal can be bypassed to achieve very high ripple rejection
ratios which are difficult to achieve with standard voltage, supplies of several
hundred volts can be regulated as long as the maximum input to output differential
is not exceeded, i.e., avoid short-circuiting the output.
Typical application:
73
L M 3 1 7 / C Y L
U 1
3 2
V I N V O U T
V I N V O U T
AD J
1
R 1
2 2 0 E
C 2
. 1 u F
C 1
. 1 u F
R 2
5 k
Features
8. 80 dB ripple rejection
74
9. Output is short-circuit protected
Packages of LM317
Application Hints:
75
through the output set resistor R2, giving an output voltage of Since the 100μA
current from the adjustment terminal represents an error term, the LM317 was
designed to minimize IADJ and make it very constant with line and load changes.
To do this, all quiescent operating current is returned to the output establishing a
minimum load current requirement. If there is insufficient load on the output, the
output will rise.
PROTECTION DIODES:-
When external capacitors are used with any IC regulator it is sometimes necessary
to add protection diodes to prevent the capacitors from discharging through low
current points into the regulator. Most 10μF capacitors have low enough internal
series resistance to deliver 20A spikes when shorted. Although the surge is short,
there is enough energy to damage parts of the IC. When an output capacitor is
connected to a regulator and the input is shorted, the output capacitor will
discharge into the output of the regulator. The discharge current depends on the
value of the capacitor, the output voltage of the regulator, and the rate of decrease
of VIN. In the LM317, this discharge path is through a large junction that is able to
76
sustain 15A surge with no problem. This is not true of other types of
The bypass capacitor on the adjustment terminal can discharge through a low
current junction. Discharge occurs when either the input or output is shorted.
Internal to the LM317 is a 50 r esistor which limits the peak discharge current.
77
No protection is needed for output voltages of 25V or less and 10μF capacitance.
Figure 3 shows an LM317 with protection diodes included for use with outputs
greater than 25V and high values of output capacitance.
D 2
1 N 4 0 0 7
2 1
L 1
U 5 I N D U C T O R A U D I O _ 0
L M 3 1 7 / T O 2 2 0 V S
3 4
2 5 J 7
3 2 1 6
V IV N O U T 1
2
2
S 3
ADJ
2 2 0 0 u F 5 0 V D 3 - V
R 8 C O N 3
C 8
1
R C 9
1N 4007
1
C 1 1 R 1 0 C 1 0
R 9 P O T R 1 1
B R 1
2
1K 1W
B R I D G E 1 0 4 R 12 C A P
470uF 50V
R R
10uF 25V T AN T
J 8
3 - + 1
1
C 12
2
3
C O N 3
R 1 4
R 1 P3 O T R 1 5
4
C 13
C 1 5
R R
C 1 6
R 16
C C 1 41 7
470uF 50V
C A P
2 2 0 0 u F 15 00 4V
10uF 25V T AN T
1K 1W
U 6
2
1
R 1 7
L 2
2 - V S
ADJ
V I N 3 R 6 1
V O U T 5 2
1
1 N 4 0 0 7 4 3
D 4
L M 3 3 7 / T O 2 2 0
1 2
I N D U C T O R A U D I O _ 0
D 5
1 N 4 0 0 7
78
BIBLIOGRAPHY
Wikipedia
MicroC Manuals
www.talkingelectronics.com
www.howstuffworks.com
The Art of Electronics (Book)
79