ACKNOWLEDGEMENT

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 Difference between CISC & RISC PIC 16F73 features Pin diagram of PIC16F73 Pin description of PIC16F73 Core Architecture Electrical Characterstics Compiler Used-mikroC Features Projects Functionality

 Types of microcontroller Architectures
 3)

PIC microcontrollers
    

4)

Programming of PIC
   

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.

  

6)Power system design  Unregulated power supplies  Regulated power supplies  Bench supply diagram

3

Electronics system design). TELEBOX India ltd. Mohali Navik Technologies. LINUX) and embedded systems (Micro controller based design.COMPANY PROFILE Netmax Technologies is an organization which is established in the field of Network Support. Chandigarh. Chandigarh Emmtel ISP. Mohali Premier ISP. Netmax technologies also conduct courses in CADENCE based design tools. Lotus Machines Pvt. KANTA Electrical Ltd. Chandigarh Innovative Solutions. Netmax Technologies also provide Technical Research & Development support and consultancy to some Electronics companies. It provides support and training in the field of networking solutions (CISCO. it has strategic alliance with REDHAT Inc. In Education. The partial list of our clients for network field is as below: 1) 2) 3) 4) 5) 6) CEDTI. Chandigarh 4 . It is also NOVELL EDUCATION PARTNER with which it provides NOVELL and SUSE LINUX courses. Ltd. Impearl Electronics Pvt. Their clients for R&D support in field of embedded systems are: 1) 2) 3) 4) 5) Recorders and Medicare ltd Chandigarh. Network training and Embedded systems. Mohali. Chandigarh. Chandigarh NIPER. Ltd.

Cache Engine. RAS etc) d) Bandwidth Manager software and hardware e) Radio Links f) Security Solutions Design Services (Embedded Systems) a) AVR family 5 . Mohali Glide Internet Services Rana Group IDS HFCL Infotel Ltd. Firewalls. Mohali BBMB The Tribune Quark Ind Swift Support Area (Networking Solutions) a) LINUX / UNIX networks b) SUN networks c) CISCO devices (Routers. Targus technologies pvt ltd STPI.7) 8) 9) 10) 11) 12) 13) 14) 15) 16) 17) Software Technology Parks India. Switches.

CCNP b) RED HAT LINUX c) SUN SOLARIS d) WINDOWS 2000. 6 .b) MCS 51 c) ELECTRONIC SYSTEM DESIGN Network Training a) CISCO CCNA. To meet the demands of Post PC era Netmax provides complete solutions as well as design-to-order services to satisfy its customers. 2003 Netmax Technologies is a leader in education services and developer of innovative embedded solutions.

) Industrial process controller & defense applications. e. desktop or laptop computer is known as embedded system. Such systems generally use microprocessors. engine control etc. microcontroller or they may use custom-designed chips or both. and billions of microprocessors are shipper every year for a myriad of applications. They are used in automobiles.g. single board and rack mounted general-purpose computers are called "embedded computers" if used to cont Embedded System Applications :• • • • • • • • Consumer electronics. FAX machines etc. Any electronic system that uses a CPU chip. machine tools. planes.. PDAs and other handhelds as well as robots and toys. Sometimes. microwave ovens etc. ATMs Aircrafts 7 . consumer and office appliances.g. printers. Computer/Communication products. The uses are endless. trains. Medical Equipments. washers. space vehicles. It is a part of a larger system which may not be a “computer”Works in a reactive & time constrained environment. Consumer products. e.g.EMBEDDED SYSTEM What is Embedded System? Embedded system employs a combination of software & hardware to perform a specific function. Automobiles (anti-lock braking. but that is not a general-purpose workstation. In embedded systems. cell phones etc. cameras. cameras. the software is permanently set into a read-only memory such as a ROM or flash memory chip. in contrast to a general-purpose computer that loads its programs into RAM each time. e. cell phones.

• In order to make a Microprocessor functional we must add RAM.P. • On the other hand a Microcontroller has a C.P.i. I/O Ports and timers externally to them. and no I/P O/P ports on the chip itself. • But in controllers there is a fixed amount of memory which makes them ideal for many applications. ROM.U • Whereas Microcontrollers may have one or two operational codes. ROM. • The Microprocessors have many operational codes(opcodes) for moving data from external memory to the C.P. no ROM.e any amount of external memory can be added to it.U) popularly known as CPU on the chip.DIFFERENCE BETWEEN MICROPROCESSORS AND MICROCONTROLLERS: • A Microprocessor is a general purpose digital computer central processing unit(C. DISADVANTAGES OF MICROPROCESSORS OVER MICROCONTROLLERS • System designed using Microprocessors are bulky • They are expensive than Microcontrollers 8 . I/O ports and a timer all on a single chip.U(microprocessor) in addition to a fixed amount of RAM. The Microprocessors contain no RAM.

Atmell’s AVR microcontroller based on RISC architecture. Timer/counter chip. In common CISC chips are relatively slow (compared to RISC chips) per instruction. TYPES OF MICROCONTROLLER ARCHITECTURE: There are two types of Microcontroller architecture designed for embedded system development. These are: 1)RISC. Therefore fewer.etc. For instance Intel and AMD CPU's are based on CISC architectures. Most PC's use CPU based on this architecture.• We need to add some external devices such as PPI chip. RICS stands for Reduced Instruction Set Computer. than the large. The philosophy behind it is that almost no one uses complex assembly language instructions as used by CISC. Memory. MCS-51 family microcontrollers based on CISC architecture. and people mostly use compilers which never use complex instructions. Typically CISC chips have a large amount of different and complex instructions. complex and slower CISC instructions. However. simpler and faster instructions would be better. more instructions are needed to accomplish a task.Complex instruction set computer DIFFERENCE BETWEEN CISC AND RISC: CISC stands for Complex Instruction Set Computer. but use little (less than RISC) instructions.Reduced instruction set computer 2)CISC. 9 . Interrupt controller chip. to make it functional.

PIC MICROCONTROLLER 10 .

PIC 16 SERIES-PIC16F73 PIC is a family of Harvard architecture microcontrollers made by Microchip Technology. PIC18 xxxx. PIC12 xxxx. It is available in different configurations viz 8bit.32 bit with instructions set as given below : Under 8 bit comes-PIC10 xxxx. PIC16 xxxx.(12 bit instruction set) Under 16 bit comes-PIC24H. The name PIC initially referred to "Peripheral Interface Controller".DSPIC33. (14 bit instruction set) Under 32 bit comes-PIC32xxxx.16 bit. (16 bit instruction set) 11 .DSPIC30. derived from the PIC1640 originally developed by General Instrument's Microelectronics Division.

• All single cycle instructions except for program branches which are two-cycle. • Only 35 single word instructions to learn. • Direct. • Power-on Reset (POR). • Programmable code protection • Power saving SLEEP mode • Selectable oscillator options • In-Circuit Serial Programming (ICSP) via two pins. Indirect and Relative Addressing modes. • Processor read access to program memory. Up to 368 x 8 bytes of Data Memory (RAM). and serial programming (and reprogramming with flash memory) capability. extensive collection of application notes. • Up to 8K x 14 words of FLASH Program Memory. • Interrupt capability (up to 12 sources).20 MHz clock input DC . large user base. Special Microcontroller Features: • High performance RISC CPU. Peripheral Features: • Timer0: 8-bit timer/counter with 8-bit prescaler.200 ns instruction cycle. • Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation. availability of low cost or free development tools. wide availability. • Eight level deep hardware stack. • Power-up Timer (PWRT) and Oscillator Start-up Timer (OST). 12 . • Operating speed: DC .PICs are popular with developers and hobbyists alike due to their low cost.

high speed CMOS FLASH technology.• Timer1: 16-bit timer/counter with prescaler. resolution is 12.5 ns . • 8-bit.< 2 mA typical @ 5V. max.Compare is 16-bit. • High Sink/Source Current: 25 Ma. • Parallel Slave Port (PSP).5V. PWM modules . • Low power consumption: . resolution is 200 ns . max. • Industrial temperature range. • Timer2: 8-bit timer/counter with 8-bit period register.PWM max. • Synchronous Serial Port (SSP) with SPI (Master mode) and I2C(Slave). • Wide operating voltage range: 2. WR and CS controls (40/44-pin only).0V to 5. • Fully static design. CMOS Technology: • Low power. can be incremented during SLEEP via external crystal/clock.Capture is 16-bit. • Two Capture. • Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI). Compare. resolution is 10-bit. 8-bits wide with external RD. prescaler and postscaler. up to 8-channel Analog-to-Digital converter. 4 MHz 13 . • Brown-out detection circuitry for Brown-out Reset (BOR).

PIN DIAGRAM 14 .

PIN DESCRIPTION 15 .

It should be noted that a WDT Reset does not drive MCLR pin low. which is viewed as the resumption of normal operation. Microchip recommends that the MCLR pin no longer be tied directly to VDD. For this reason.. Clearing a TRISA bit (= ‘0’) will make the corresponding PORTA pin an output (i. Most other registers are reset to a RESET state” on Power-on Reset (POR). on the MCLR and WDT Reset.  RESET The PIC16F7X differentiates between various kinds of RESET:  Power-on Reset (POR)  MCLR Reset during normal operation  MCLR Reset during SLEEP  WDT Reset (during normal operation)  WDT Wake-up (during SLEEP)  Brown-out Reset (BOR) Some registers are not affected in any RESET condion. 16 . Their status is unknown on POR and unchanged n any other RESET. Setting a TRISA bit (= ‘1’) will make the corresponding PORTA pin an input (i. put the contents of the output latch on the selected pin).e. put the corresponding output driver in a Hi-Impedance mode). The filter will detect and ignore small pulses. MCLR-(pin 1) PIC16F7X devices have a noise filter in the MCLR Reset path. The TO and PD bits are set or cleared differently in different RESET situations. and Brown-out Reset (BOR). as indicated  PORTA –(pin 2 to 7)and the TRISA RegisterPORTA is a 6-bit wide. 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. on MCLR Reset during LEEP. The corresponding data direction register is TRISA. The behavior of the ESD protection on the MCLR pin has been altered from previous devices of this family..e. They are not affected by a WDT Wake-up. bi-directional port.

In RC mode. When in HS mode. LP or HS modes. Therefore. the device can accept an external clock source to drive the OSC1/CLKIN pin. The PIC16F7X oscillator design requires the use of a parallel cut crystal. and denotes the instruction cycle rate. Use of a series cut crystal may give a frequency out of the crystal manufacturers specifications. All write operations are read-modify-write operations. a crystal or ceramic resonator is connected to the OSC1/CLKIN and OSC2/CLKOUT pins to establish oscillation.  OSC1/CLKIN-(pin 9) Oscillator crystal input/external clock source input  OSC2/CLKOUT-(pin 10) Oscillator crystal output.Reading the PORTA register reads the status of the pins. whereas writing to it will write to the port latch. the value is modified and then written to the port data latch. Oscillator:.CRYSTAL OSCILLATOR/CERAMIC RESONATORS In XT. a write to a port implies that the port pins are read. Connects to crystal or resonator in Crystal Oscillator mode.  GND –(pin 8) Provide Ground to it. the OSC2 pin outputs CLKOUT which has 1/4 the frequency of OSC1. OSCILLATOR TYPES The PIC16F7X can be operated in four different oscillator modes:     LP Low Power Crystal XT Crystal/Resonator HS High Speed Crystal/Resonator RC Resistor/Capacitor 17 .

Clearing a TRISC bit (= ‘0’) will make the corresponding PORTC pin an output (i. put the contents of the output latch on the selected pin). put the corresponding output driver in a Hi-Impedance mode).. PORTC and the TRISC Register(pin 11 to 18) PORTC is an 8-bit wide. 18 .e.e.e.. put the corresponding output driver in a Hi-Impedance mode). put the contents of the output latch on the selected pin). Setting a TRISB bit (= ‘1’) will make the corresponding PORTB pin an input (i. Clearing a TRISB bit (= ‘0’) will make the corresponding PORTB pin an output (i. PORTC is multiplexed with several peripheral functions PORTC pins have Schmitt Trigger input buffers.e.  Vss(pin 19) Ground reference for logic and I/O pins  Vdd(pin 20) Positive supply for logic and I/O pins  PORTB and the TRISB Register(pin 21 to 28) PORTB is an 8-bit wide. Setting a TRISC bit (= ‘1’) will make the corresponding PORTC pin an input (i. The corresponding data direction register is TRISB. The corresponding data direction register is TRISC. care should be taken in defining TRIS bits for each PORTC pin. When enabling peripheral functions.. bi-directional port. bi-directional port..

CORE ARCHITECTURE Figure 2.Each of the PORTB pins has a weak internal pull-up. It is characterized by the following features: • • Separate code and data spaces (Harvard architecture) A small number of fixed length instructions 19 . A single control bit can turn on all the pull-ups. The pull-ups are disabled on a Power-on Reset.1: Showing a typical microcontroller device and its different subunits The PIC architecture is distinctively minimalist. The weak pull-up is automatically turned off when the port pin is configured as an output.

....5V Voltage on MCLR with respect to VSS (Note2).. is not encoded in the opcode) All RAM locations function as registers as both source and/or destination of math and other functions........ MCLR......... with single delay cycles upon branches and skips A single accumulator (W)... -0..... -65°C to +150°C Voltage on any pin with respect to VSS (except VDD... port..• Most instructions are single cycle execution (4 clock cycles).......-55 to +125°C Storage temperature.. the use of which (as source operand) is implied (i.. and RA4) ....................3 to +6... A hardware stack for storing return addresses A fairly small amount of addressable data space (typically 256 bytes)................5V 20 ......3V) Voltage on VDD with respect to VSS..............e.................... • • • • • • Unlike most other CPUs......................... and the RAM is usually just referred to as the register file or simply as the registers ELECTRICAL CHARACTERISTICS Absolute Maximum Ratings † Ambient temperature under bias........3V to (VDD + 0..... ...... there is no distinction between memory space and register space because the RAM serves the job of both memory and registers....... and peripheral registers The program counter is also mapped into the data space and writable (this is used to implement indirect jumps)....... -0. extended through banking Data space mapped CPU.....0 to +13................

....... 21 .......................................... Thus...........0 to +12V Total power dissipation (Note 1).0W Maximum current out of VSS pin.................................200 mA Maximum current sourced by PORTA........................................................................... may cause latch-up.............. 3: PORTD and PORTE are not implemented on the PIC16F73/76 devices....................................25 mA Maximum output current sourced by any I/O pin ...200 mA Maximum current sourced by PORTC and PORTD (combined) (Note 3)......................................................... IIK (VI < 0 or VI > VDD)...... rather than pulling this pin directly to VSS............ a series resistor of 50-100Ω should be used when applying a “low” level to the MCLR pin. inducing currents greater than 80 mA.......200 mA Note 1: Power dissipation is calculated as follows: Pdis = VDD x {IDD . IOK (VO < 0 or VO > VDD) ................. PORTB...........25 mA Maximum current sunk by PORTA.............................................300 mA Maximum current into VDD pin ...1......VOH) x IOH} + Σ(VOl x IOL) 2: Voltage spikes below VSS at the MCLR pin..................... PORTB. ± 20 mA Output clamp current.......................200 mA Maximum current sunk by PORTC and PORTD (combined) (Note 3) ................Voltage on RA4 with respect to Vss .....250 mA Input clamp current........Σ IOH} + Σ {(VDD ...... and PORTE (combined) (Note 3) ................................... and PORTE (combined) (Note 3).............. ± 20 mA Maximum output current sunk by any I/O pin.....

without compromising performance or control. It is designed to provide the programmer with the easiest possible solution for developing applications for embedded systems.PROGRAMMING OF PIC COMPILER USED- mikroC Introduction to mikroC mikroC is a powerful. 22 . feature rich development tool for PICmicros.

used in a wide variety of applications. Monitor your program structure. and C. Auto Correct. develop. P16. and more…) Use the included mikroC libraries to dramatically speed up the development: data acquisition. assembly listing. and more… We have provided plenty of examples for you to expand. and functions in the Code Explorer. The project file carries the following information: • • • project name and optional description. Generate commented.mikroC IDE PIC and C fit together well: PIC is the most popular 8-bit chip in the world. memory. ANSI compliant compiler. comprehensive documentation.ppc) and one or more source files (extension . Features mikroC allows you to quickly develop and deploy complex applications: • • • • • • • Write your C source code using the built-in Code Editor (Code and Parameter Assistants. target device. Projects mikroC organizes applications into projects. variables. communications… Practically all P12. Copy them entirely if you deem fit – that’s why we included them with the compiler. device flags (config word). and use as building bricks in your projects.c). Syntax Highlighting. 23 . Get detailed reports and graphs: RAM and ROM map. prized for its efficiency. mikroC provides a successful match featuring highly advanced IDE. and P18 chips are supported. is the natural choice for developing embedded systems. conversions. broad set of hardware libraries. and plenty of ready-to-run examples. human-readable assembly. calling tree. You can compile source files only if they are part of a project. code statistics. displays. and standard HEX compatible with all programmers. Code Templates. Inspect program flow and debug executable logic with the integrated Debugger. consisting of a single project file (extension .

24 . etc. you can change project settings from the drop-down menu Project › Edit Project. clock.• device clock. an empty source file named after the project will be created by default. it’s just a matter of convenience. clock. mikroC does not require you to have source file named same as the project. New Project The easiest way to create project is by means of New Project Wizard. config word. drop-down menu Project › New Project. location. change chip. Edit Project Later. device. Also. You can rename the project. modify its description. config word) and mikroC will create the appropriate project file . Just fill the dialog with desired values (project name and description.

To delete a project.ppc) is stored. either your own or compiler default. To add source file to your project. use the preprocessor directive #include. Each added source file must be self-contained.e.h).build all their previously written libraries in order to use them in the new version. . select Project › Remove from Project from the drop-down menu. A file must contain one definition per line in the following form: <symbol>[=[<value>]] 25 . Note: For inclusion of the header files (extension . more compact format. except for the asm{} blocks. The users that are making transition from version 2 to 5. The list of relevant source files is stored in the project file (extension . it must have all the necessary definitions after preprocessing. Add/Remove Files from Project A project can contain any number of source files (extension . compared to mikroC version 2.lst. Project Level Defines: Project Level Defines(. This. Libraries (. simply delete the folder in which the project file (extension . select Project › Add to Project from the dropdown menu. means that library formats are now incompatible.mcl). All the source code written and tested in previous versions should compile correctly on version 5. you can reach all the output files (. Project level define files enable you to have defines that are visible in all source files in the project. that are project-specific.c). or click the Remove from Project Icon . Extended functionality of the Project Files tab By using the Project Files' new features. for libraries. See File Inclusion for more information.0. however. i.asm) by a single click.pld) files can also be added to project.ppc). must re. or click the Add to Project Icon . which are commented in the asm section of help. To remove file(s) from your project. You can also include in project the library files (.mcl) now have different.

If a white. While (i !=0) { i--. Delay_ms(time)-it provides a delay of spcified time in ms. 1 is assumed. the macro is defined as zero token.b)>[=[<value>]] Define a macro named symbol.. Also mikroC has some pre defined functions: Commonly used is 1). 26 . There are two predefined project level defines see predefined project level defines.<symbol (a. use =<value>. Its internal code is similar to code given below: Void delay_ms() {int I. Each appearance of symbol will be replaced by the value before compilation. } Also PIC has a internal TRIS register which controls the flow of insructions from the corresponding port. To specify a value. If =<value> is omitted. Do not enter white-space characters immediately before "=".space character is entered immediately after "=". This option can be specified repeatedly.

• The C language based on the ANSI standard is very portable. Programs get a formal structure and can be divided into separate functions. because of the comfortable modular program construction techniques. • • Details like register allocation and addressing of memory and data is managed by the compiler. • • • • Programming and program test time is drastically reduced. Existing programs can be quickly adapted to other processors as needed. this increases efficiency. Keywords and operational functions can be used that come closer to how humans think. PROJECT NO-1 LED INTERFACING AND ITS BLINKING (PORT PROGRAMMING) 27 . The supplied and supported C libraries contain many standard routines such as numeric conversions. Reusable code: Existing program parts can be more easily included into new programs.PROGRAMMING AND INTERFACING Advantages of C over Assembly language programming: • Knowledge of the processor instruction set is not required.

0xAA is fed to controller with coding.the interfacing of LED is shown in the figure above. also a darlington pair IC is also used i.it is given Vcc through resistors of 330E.to glow alternative LED’s the binary code will be10101010 and its corresponding hexadecimal code will be 0xAA. Now to glow the desired LED .eg.ULN 2803 which shift the dc level of volage coming from port of pic microcontroller. 28 . So.e.proper hexadecimal code for its binary is programmed in pic.ee PORT will behave as input(if =1) and as output(if=0). Also PIC has a internal TRIS register which controls the flow of insructions from the corresponding port i.

Delay_ms(1000). TRISC = 0. // gives code 10101010 to PORTC // one second delay 29 . }} Thus LED Blinking practical is done sucessfully.CODING FOR BLINKING void main() { PORTC = 0. // Initialize PORTC // Configure PORTC as output while(1) { PORTC = OxAA.

30 .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.PROJECT NO-2 SEVEN SEGMENT INTERFACING AND DISPLAY 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.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.

delay_ms(1000). delay_ms(1000). PORTB=0x04 . while(1) { PORTB=0x00 . TRISC=0xf0. delay_ms(1000). CODING FOR DISPLAY void main() { TRISB=0xf0. PORTB=0x02 . PORTC=0x00. //code for 4 //code for 3 //code for 2 //code for 1 //code for 0 31 . PORTB=0x08 . delay_ms(1000). PORTB=0x0c .Tdis is done by providing a very small delay such that our eyes cant even detect the change over from one display to another.

PORTB=0x0e . } } the above program will display 0 to 9 on one seven segment display with a delay of one second between it. PORTB=0x09 . delay_ms(1000).. delay_ms(1000).\ NOW TO DISPLAY ON FOUR DISPLAYS CONNECTED. delay_ms(1000). delay_ms(10000). delay_ms(10000).delay_ms(1000). CODE IS void main() { //code for 9 //code for 8 //code for 7 //code for 6 //code for 5 32 . PORTB=0x09 . PORTB=0x01 . PORTB=0x06 .

delay_ms(100). PORTC=0xfd .TRISB=0xf0. PORTB=0x0C . while(1) { PORTB=0x00 . delay_ms(100). PORTC=0xf7 . delay_ms(100). PORTB=0x04 . PORTC=0x00. PORTC=0xfb . PORTB=0x08 . } } 33 //code for 0 //DISPLAYS ON FIRST 11111110 //code for 1 //DISPLAYS ON SECOND 11111101 //code for 2 //DISPLAYS ON THIRD 11111011 //code for 3 //DISPLAYS ON FIRST 11110111 . PORTC=0xfe . TRISC=0xf0. delay_ms(100).

and generally are closed-loop commutated.like all motors it is also based on electromagnetic induction i. on the other hand. The electromagnets are energized by an 34 . Stepper motors are similar to switched reluctance motors.k. effectively have multiple "toothed" electromagnets (a. synchronous electric motor that can divide a full rotation into a large number of steps. The motor's position can be controlled precisely.Thus program for both single seven segment and multiple seven segment displays has been studied.a. which rotate when voltage is applied to their terminals. Fundamentals of Operation Stepper motors operate much differently from normal DC motors. PROJECT NO-3 INTERFACING AND CONTROL OF STEPPER MOTOR WITH PIC 16F73 Stepper motor are those which rotates in steps. which are very large stepping motors with a reduced pole count.e. A stepper motor is a brushless. electric field produces a magnetic field whose variation causes a torque which rotates the motor. without any feedback mechanism (see open loop control). phases) arranged around a central gear-shaped piece of iron. Stepper motors.

void reverse(). which makes the gear's teeth magnetically attracted to the electromagnet's teeth. Each of those slight rotations is called a "step. the motor can be turned a precise angle. first one electromagnet is given power. void main() 35 . such as a microcontroller. So when the next electromagnet is turned on and the first is turned off." In that way. To make the motor shaft turn. When the gear's teeth are thus aligned to the first electromagnet.external control circuit. and from there the process is repeated. int i. they are slightly offset from the next electromagnet. the gear rotates slightly to align with the next one. Now to run the motor we have to feed the binary code to turn on the current of that winding… For pair 1st-00000011(binary)-0x03 For pair 2nd-00000110(binary)-0x06 For pair 3rd -000001100(binary)-0x0c For pair 4th -00011000(binary)-0x09 CODE IS void forward().

} } void forward() { for(i=0. PORTB=0x06. delay_ms(70). delay_ms(400). while(1) { forward(). 36 .i<=50.i++) { PORTB=0x03. reverse().{ TRISB=0xf0. PORTB=0x00. delay_ms(400). delay_ms(70).

PORTB=0x06. PORTB=0x0c. delay_ms(40). PORTB=0x09. }} 37 . delay_ms(40).i++) { PORTB=0x09.i<=50. delay_ms(40). delay_ms(40). } } void reverse() { for(i=0. delay_ms(40).PORTB=0x0c. PORTB=0x03. delay_ms(40).

to run it via PIC 16F73.The above code will rotate the motor first in forward direction and then in reverse direction.we need command signals and vcc to drive it.its name is HD44780. The function of each of the connections is shown in the table below:Pins 1 & 2 are the power supply lines. Thus. 38 . The Vdd pin should be connected to the positive supply & Vss to the 0V supply or ground.now the signal that is required to display character is produced by an IC which is already embedded on it.stepper motor has been studied successfully. PROJECT NO-4 LCD INTERFACING AND DISPLAY LCD stands for Liquid Crystal Display. HD44780+LCD=an intelligent controller. Vss & Vdd.

A preset potentiometer connected between the power supply lines. these modules can be effectively and economically powered by batteries. NAME FUNCTION 1 Vss Ground 2 Vdd +ve supply 3 Vee contrast 4 RS Register select 5 R/W Read/Write 6 E Enable 7 D0 Data Bit 0 8 D1 Data Bit 1 9 D2 Data Bit 2 10 D3 Data Bit 3 11 D4 Data Bit 4 12 D5 Data Bit 5 13 D6 Data Bit 6 14 D7 Data Bit 7 Three command control inputs. Pin 3 is a control pin. and data bytes read from the display indicate its 39 . Vee. which is used to alter the contrast of the display. with its wiper connected to the contrast pin is suitable in many cases. and even 3V is sufficient for some modules. supply (at only a few milliamps). connecting this pin to 0V will often suffice.5V both work well. as low as 7V in some cases. When this line is low. data bytes transferred to the display are treated as commands.Although the LCD module data sheets specify 5V D. Consequently. these pin should be connected to a variable voltage supply. but be aware that some modules may require a negative potential. Ideally.C. For absolute simplicity. supplies of 6V & 4. PIN NO.

In the latter case. either as a single 8-bit byte or as two 4-bit “nibbles”. Pin 6 is Enable (E) line. when reading from the display. character data can be transferred to and from the module.status. Data can be transferred to and from the display. When writing to the display. This line is pulled low in order to write commands or character data to the module. By setting the RS line high. data is transferred only on the high to low transition of this signal. as fewer I/O lines are required. Pins 7 to 14 are the eight data bus lines (D0 to D7). However. This input is used to initiate the actual transfer of commands or character data between the module and the data lines. This $-bit mode is beneficial when using a microcontroller. only the upper four data lines (D4 to D7) are used. data will become available shortly after the low to high transition and remain available until the signal falls low again. or pulled high to read character data or status information from its registers. Pin 5 is (R/W) line. Connections are shown as below CODING void main() { 40 .

Lcd_cmd. I ts code is as follows: Coding for scrolling char *text = "WELCOME" . // Turn cursor off Lcd_Out(1. } The above code will display HELLO on LCD. char *text1 = "BACK" . 5. Lcd_Cmd(Lcd_CLEAR). // Print text to LCD. // PORTB is output // Initialize LCD connected to PORTB // Clear display 41 . Lcd_Cmd(Lcd_CURSOR_OFF). 5tH column Now also it is possible to scroll the characters on LCD.gives command and displays respectively. // PORTB is output // Initialize LCD connected to PORTB // Clear display Lcd_Cmd(Lcd_CLEAR).Lcd_out are predefined functions in mikroC which initialize. 1nd row. Lcd_Init(&PORTB). The functions like Lcd_Init().TRISB = 0."HELLO"). void main() { TRISB = 0. Lcd_Init(&PORTB).

14 bit(costs Rs.2000-4000).16bit(costs Rs. while(1) { Lcd_Cmd(LCD_SHIFT_LEFT). // Turn cursor off Lcd_Out(1.Lcd_Cmd(Lcd_CURSOR_OFF). PROJECT NO-5 BUILT IN ADC OF PIC16F73(TEMPERATURE MONITORING) PIC16F73 consists of 5 internal ADC .24bit(costs >25000). 5. 42 .1200-2000) . delay_ms(1000). Lcd_Out(2. 2nd row.120).viz 8 bit(costs Rs. 1st column It will shift the character to the left with a delay of 1 sec between it.text).10bit(costs Rs. } } // Print text to LCD.600). These are externally connected to microcontroller like AT89s51 which don’t have inbuilt ADC.text1). Thus LCD display and scroll is studied successfully.4000-25000). AD are available in different configurations according to their bit channels.12 bit(costs Rs. 5.

Now as PIC 16xxx has got the feature of inbuilt ADC.PIC16XXX is featured with 8 bit ADC. The ADCON1 register. controls the operation of the A/D module. which generates the result via successive approximation.so. configures the functions of the port pins. The output of the sample and hold is the input into the converter. ADC HARDWARE CONNECTION 43 . or as digital I/O. The 8-bit analog-to-digital (A/D) converter module has five inputs for the PIC16F73/76 and eight for the PIC16F74/77. So can convert an analog value to 8 bit binary or from 0 to 255 in decimal range. The A/D converter has a unique feature of being able to operate while the device is in SLEEP mode. The A/D allows conversion of an analog input signal to a corresponding 8-bit digital number. the A/D conversion clock must be derived from the A/D’s internal RC oscillator. The port pins can be configured as analog inputs (RA3 can also be a voltage reference). The A/D module has three registers. The analog reference voltage is software selectable to either the device’s positive supply voltage (VDD). shown in Register 11-2. These registers are: • A/D Result Register (ADRES) • A/D Control Register 0 (ADCON0) • A/D Control Register 1 (ADCON1) The ADCON0 register.there is no need to connect externally. shown in Register 11-1. or the voltage level on the RA3/AN3/VREF pin. To operate in SLEEP.

From 4th pin we are gaetting Analog input. ADCON0 REGISTER (ADDRESS 1Fh) 44 .

(RA2/AN2) 011 = channel 3. (RA3/AN3) 100 = channel 4.R/W-0 bit 7 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 -------bit 0 ADON bit 7-6 ADCS1:ADCS0: A/D Conversion Clock Select bits 00 = FOSC/2 01 = FOSC/8 10 = FOSC/32 11 = FRC (clock derived from the internal A/D module RC oscillator) bit 5-3 CHS2:CHS0: Analog Channel Select bits 000 = channel 0. (RE2/AN7)(1) bit 2 GO/DONE: A/D Conversion Status bit If ADON = 1: 1 = A/D conversion in progress (setting this bit starts the A/D conversion) 0 = A/D conversion not in progress (This bit is automatically cleared by hardware when the A/D conversion is complete) bit 1 Unimplemented: Read as '0' bit 0 ADON: A/D On bit 1 = A/D converter module is operating 0 = A/D converter module is shutoff and consumes no operating current ADCON1 REGISTER (ADDRESS 9Fh) U-0 — U-0 — U-0 — U-0 — U-0 — R/W-0 R/W-0 R/W-0 PCFG2 PCFG1 PCFG0 bit 7-3 Unimplemented: Read as '0' bit 2-0 PCFG2:PCFG0: A/D Port Configuration Control bits. (RE1/AN6)(1) 111 = channel 7. PCFG2:PCFG0 RA0 RA1 RA2 RA5 RA3 000 A A A A A A 001 A A A A VREF A 010 A A A A A D RE0(1) A A D RE1(1) RE2(1) VREF A VDD A RA3 D VDD 45 . (RA1/AN1) 010 = channel 2. (RE0/AN5)(1) 110 = channel 6. (RA5/AN4) 101 = channel 5. (RA0/AN0) 001 = channel 1.

clear bit ADIF if required. as required. Configure the A/D module: • Configure analog pins / voltage reference / and digital I/O (ADCON1) • Select A/D input channel (ADCON0) • Select A/D conversion clock (ADCON0) • Turn on A/D module (ADCON0) 2. Wait for A/D conversion to complete. by either: • Polling for the GO/DONE bit to be cleared (interrupts disabled) OR • Waiting for the A/D interrupt 6. Configure A/D interrupt (if desired): • Clear ADIF bit • Set ADIE bit • Set PEIE bit • Set GIE bit 3. The A/D conversion time per bit is defined as TAD. For next conversion. A minimum wait of 2TAD is required before next acquisition starts 46 . Wait the required acquisition time. The following steps should be followed for doing an A/D conversion: 1. go to step 1 or step 2. Start conversion: • Set GO/DONE bit (ADCON0) 5. Read A/D result register (ADRES).011 100 101 11x A A A D A A A D A D D D A D D D VREF A VREF D D D D D D D D D D D D D RA3 VDD RA3 VDD A = Analog input D = Digital I/O So.ADC will be provided analog input from different channels and correspondingly these registers are set. 7. 4.

text = "LCD example".coding to display voltage through temperature sensor unsigned char ch. LCD_Out(2. // disable all interrupts // PORTB is output // Initialize LCD connected to PORTB // send command to LCD (cursor off) // send command to LCD (clear LCD) LCD_Cmd(LCD_CURSOR_OFF).Now.1. text = "netmax". char *text.text).1.text). void main() { INTCON = 0. LCD_Out(1. long tlong. Lcd_Init(&PORTB). unsigned int adc_rd. // assign text to string // print string a on LCD. 1st column // assign text to string // print string a on LCD. ADCON1 = 0x82. LCD_Cmd(LCD_CLEAR). 1st column // configure VDD as Vref. 1st row. TRISB = 0. 2nd row. and analog channels 47 .

48 . LCD_Out(2.. 9th column tlong = (long)adc_rd * 4610. // get ADC value from 2nd channel // print string a on LCD. while (1) { delay_ms(300) .9. LCD_Chr_CP('.1.001 volts digit // write ASCII digit at cursor point LCD_Chr_CP(48+ch).48+ch). tlong = tlong / 255.1023 -> 0-5000mV // extract volts digit // write ASCII digit at 2nd row. ch = (tlong / 100) % 10. LCD_Chr_CP('V').1 volts digit // write ASCII digit at cursor point // extract 0. // designate PORTA as input delay_ms(7000).01 volts digit // write ASCII digit at cursor point // extract 0. 2nd row.TRISA = 0xFF. ch = tlong % 10.'). // extract 0.text). ch = tlong / 1000. LCD_Chr_CP(48+ch). adc_rd = ADC_read(0). 1st column // covert adc reading to milivolts // 0. LCD_Chr(2. LCD_Chr_CP(48+ch). ch = (tlong / 10) % 10. // assign text to string text = "voltage:".

0.. The swiches whose one end are connected to pins of nontroller are shown on next page 49 .it forces no current or voltage to enter to pin and also lowers the pin from 1 to 0. Internally.when external switch is closed . delay_ms(1).so on. Similarly in PIC it is possible to address pins using Syntax: PORT( NAME).when pin is high its flip flop is sat. } } PROJECT NO-6 TO STUDY SWITCHING ACTION OF PIC PINS. Thus when switch is pressed . As in AT89s51.so .the pin becomes zero.1….F(0 to 7) Now pin can be put ON or OFF according to via resistor.delay_ms(3000) .the way of addressing pins is by p0.p0.implementing this in practical.

The coding will be as follos: #define s0 PORTC.F3 #define s4 PORTC.F2 #define s3 PORTC.F0 #define s1 PORTC.F1 #define s2 PORTC.F4 50 .

PORTC=0xff. } if(s2==0) \\3rd switch is pressed { 51 \\PORT C as input \\ ALL F/F’S TO SET \\1st switch is pressed \\2nd switch is pressed \\2nd LED glows .void main() { TRISB=0x00. \\1st LED glows delay_ms(600). do { if(s0==0) { PORTB=0x80. \\ PORT B AS OUTPUT TRISC=0xff. delay_ms(600). } if(s1==0) { PORTB=0x40.

} else { PORTB=0xff. delay_ms(600). } \\3rd LED glows \\4th switch is pressed \\4th LED glows Thus switching action is studied.So. } if(s3==0) { PORTB=0x10. PROJECT NO-7 INTERFACING OF KEYBOARD MATRIX As in last practical.we use one switch per pinof controller. delay_ms(600).PORTB=0x20. 52 . }} while(1).to use 8 pins for 8 switches.

F2 53 .F1 #define row2 PORTC.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.F0 #define row1 PORTC. h/w connection are The coding for keyboard (4*4) matrix is as follows: #define row0 PORTC.

F5 #define col2 PORTC.8. LCD_OUT(1. if(row0==0 && col0==0) { lcd_out(1. delay_ms(600). TRISC=0xff.#define row3 PORTC.F7 void main() { TRISB=0x00.F3 #define col0 PORTC." ").8. LCD_INIT(&PORTB).F4 #define col1 PORTC.F6 #define col3 PORTC. do { LCD_OUT(1.1. 54 ."k0")."SWITCH="). PORTC=0xff.

} if(row1==0 && col0==0) { lcd_out(1. } if(row0==0 && col2==0) { lcd_out(1. delay_ms(600).8. delay_ms(600)."k3"). } if(row0==0 && col3==0) { lcd_out(1."k1").} if(row0==0 && col1==0) { lcd_out(1. 55 . delay_ms(600).8.8."k2").8."k4").

} if(row2==0 && col0==0) { 56 .8.8."k6").8. } if(row1==0 && col3==0) { lcd_out(1. delay_ms(600)."k7"). } if(row1==0 && col1==0) { lcd_out(1."k5"). delay_ms(600). delay_ms(600).delay_ms(600). } if(row1==0 && col2==0) { lcd_out(1.

"k9")."k10"). } else 57 .8. } if(row2==0 && col1==0) { lcd_out(1. delay_ms(600)."k8"). } if(row2==0 && col2==0) { lcd_out(1.8. } if(row2==0 && col3==0) { lcd_out(1. delay_ms(600).lcd_out(1.8. delay_ms(600)."k11").8. delay_ms(600).

} Thus. PROJECT NO-8 SERIAL COMMUNICATION(B/W PC AND MICROCONTROLLER) To send data via single line through a bit stream is known as serial communication. Reception is of type SIPO-Serial Input Parallel Output.{Lcd_out(1. Clock used in serial communication is called BAUD RATE. Transmission is of type PISO-Parallel Input Serial Output." } while(1). } "). 58 .8.the keyboard matrx practical is performed.

such as A/D or D/A integrated circuits.PIC has two buffers and it allows full duplex communication. serial EEPROMs.to change settings we have to re configure TXSTA register The Universal Synchronous Asynchronous Receiver Transmitter (USART) module is one of the two serial I/O modules. The USART can be configured in the following modes: • Asynchronous (full duplex) • Synchronous . etc.) The USART can be configured as a full duplex asynchronous system that can communicate with peripheral devices. (USART is also known as a Serial Communications Interface or SCI.Master (half duplex) • Synchronous . such as CRT terminals and personal computers.Slave (half duplex) 59 . or it can be configured as a half duplex synchronous system that can communicate with peripheral devices.

TXSTA: TRANSMIT STATUS AND CONTROL REGISTER (ADDRESS 98h R/W-0 R/W-0 R/W-0 R/W-0 U-0 R/W-0 R-1 R/W-0 CSRC bit 7 TX9 TXEN SYNC — BRGH TRMT TX9D CSRC: Clock Source Select bit Asynchronous mode: Don’t care Synchronous mode: 1 = Master mode (Clock generated internally from BRG) 0 = Slave mode (Clock from external source) bit 6 TX9: 9-bit Transmit Enable bit 1 = Selects 9-bit transmission 0 = Selects 8-bit transmission bit 5 TXEN: Transmit Enable bit 1 = Transmit enabled 0 = Transmit disabled Note: SREN/CREN overrides TXEN in SYNC mode. bit 4 SYNC: USART Mode Select bit 1 = Synchronous mode 0 = Asynchronous mode Unimplemented: Read as '0' BRGH: High Baud Rate Select bit Asynchronous mode: 1 = High speed 0 = Low speed Synchronous mode: Unused in this mode TRMT: Transmit Shift Register Status bit 1 = TSR empty 0 = TSR full 60 bit 3 bit 2 bit 1 .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.

to transmit data.bit 0 TX9D: 9th bit of transmit data.. Can be parity bit now in mikroC UART terminal also work as shown as Now coding 1). void main() { 61 .

while(1) { usart_write('s'). usart_write('g'). usart_write('a'). usart_write('r').usart_init(2400).to transmit as well as read unsigned int i. delay_ms(600). void main() { usart_init(2400). usart_write('a'). while(1) { if(usart_data_ready() ) 62 . } } 2).

usart_write('i'). usart_write('r'). usart_write('g'). To send an array unsigned char arr[] =("netmax"). void main() { Usart_Init(2400). while(1) { 63 . } usart_write('s'). void display(unsigned char*s). usart_write('a').{ i= usart_read(). usart_write('a'). delay_ms(600). } 3).

} } void display(unsigned char*s) { while(*s!='$') { usart_Write(*s).display(arr). } } Thus serial communication has been studied successfully. delay_ms(600). s++. delay_ms(10). 64 .

Project no. 9Programming of Sunlight level measurement of PIC16F73. const char sun1[]={4,3,10,6,20,12,8,8}; const char sun2[]={14,17,0,0,0,0,0,0}; const char sun3[]={4,24,10,12,5,6,2,2}; const char sun4[]={8,8,12,20,6,10,3,4}; const char sun5[]={0,0,0,0,0,0,17,14}; const char sun6[]={2,2,6,5,12,10,24,4};

const char happy1[] = {1,2,4,8,17,18,17,16}; const char happy2[] = {31,0,0,0,17,10,17,4}; const char happy3[] = {16,8,4,2,17,9,17,1}; const char happy4[] = {16,16,16,16,9,4,2,1}; const char happy5[] = {4,4,0,31,0,0,0,31}; const char happy6[] = {1,1,1,1,18,4,8,16};

const char sadbl1[] = {30,29,27,23,14,13,14,15}; const char sadbl2[] = {0,31,31,31,14,4,14,27}; const char sadbl3[] = {15,23,27,29,14,6,14,30}; const char sadbl4[] = {15,15,15,14,23,27,29,30}; const char sadbl5[] = {27,27,31,31,0,31,31,0}; const char sadbl6[] = {30,30,30,14,29,27,23,15};

65

const char sadwh4[] = {16,16,16,17,8,4,2,1}; const char sadwh5[] = {4,4,0,0,31,0,0,31}; const char sadwh6[] = {1,1,1,17,2,4,8,16};

const char moon1[] = {16,24,24,20,20,18,10,9}; const char moon2[] = {0,0,0,0,0,0,0,0}; const char moon3[] = {0,0,0,0,0,0,0,0}; const char moon4[] = {8,8,4,2,1,0,0,0}; const char moon5[] = {16,12,3,0,16,12,3,0}; const char moon6[] = {0,0,7,25,1,6,24,0};

const char cloud4[] = {31,31,31,15,7,3,1,0}; const char cloud5[] = {31,31,31,31,31,31,31,14}; const char cloud6[] = {31,31,31,30,28,24,16,0}; 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) { unsigned int k =0; k = temp; k = k/10; k= k+48; Lcd_Chr_Cp(k); k = temp%10; k = k+48; Lcd_Chr_Cp(k); } void main() { unsigned int light_res; while(1) { TRISA = 0xFF; TRISB = 0; TRISC = 0; ADCON1 = 0x01; Lcd_Init(&PORTB); Lcd_Cmd(LCD_CLEAR); Lcd_Cmd(LCD_CURSOR_OFF);
67

//Set to input mode //Set to output mode //Set to output mode // Configure analog inputs and Vref

9.0. Lcd_Chr(1. Lcd_Chr(1. ascii(light_res). Lcd_Chr(1. Delay_ms(2000).16).15). ascii(light_res). 'L'). 'H'). '=').1. 'H'). 10. custom(sun3. 5. Lcd_Chr(1. 10. 'L').light_res = adc_read(1). 'I'). 9.2. '='). 'I'). 8. Lcd_Cmd(LCD_CURSOR_OFF). 'T'). 6. Lcd_Chr(1. //Read value from channel 1 i. 6. 7. Lcd_Chr(1. 'G'). Lcd_Chr(1. 5.1.1.1. Lcd_Cmd(LCD_CLEAR).e light sensor Lcd_Chr(1. 'T'). custom(sun2. Lcd_Chr(1. Lcd_Chr(1. 68 . 8. 'G'). if(light_res>21) { custom(sun1. Lcd_Chr(1.14). Lcd_Chr(1. 7.

5.1.15).1.15). 1. custom(cloud4.16). 2.2.16).14). custom(moon6.1.3.5.0. custom(sun2.14). custom(cloud6.16).4.16). custom(moon4. 69 . } Delay_ms(2000). 0.2.custom(sun4.1.2.3.14).1.5.4.2.1. custom(sun5.4. custom(sun6.1. } if(light_res>10 && light_res <=20) { custom(sun1.2. custom(moon2. custom(moon5.2.2. custom(sun3.15).15).2. custom(cloud5.14). custom(moon3.14).2. } if(light_res<10) { custom(moon1.15).16).6.2.

it may AC to or DC to DC voltage. The main power supply is in AC but mostly electronic ckts. smps etc. may be of different types such as regulated. then use an active feedback circuit to eliminate the remaining ripple and dependence of output voltage on input. Power supplies may be used in. work with DC. unregulated. Regulated power supplies These are the power supplies in which the output voltage is constant. These 70 . etc. Unregulated power supplies These are the power supplies in which the out put is not constant. So a system is required to convert ac to dc and these sources should able to produce stable supplies. These active devices are known as Regulators. load and environment conditions. the out put voltage is independent of the input voltage. is power. Commonly these supplies are not employed as there efficiency is very less. load and other external conditions. and also effected by the environment conditions such as temperature.e. i. That it is varies with input voltage. The unregulated power can be obtained using rectifying circuit after AC supply. The regulator voltage is mainly the DC voltage.} } POWER SYSTEM DESIGN First part of electronics ckts. so these are the variable supplies. load. A better approach to power supply design is to use enough capacitance to reduce ripple to low level. So to obtain the regulated voltage using different regulators.

Constant negative voltage regulators:- These are also the constant output voltage regulator but there output is negative in polarity. Some of them are given below with there outputs:S. 1 2 3 4 Name of regulator LM 7805 LM 7810 LM 7812 LM 7815 Output voltage 5v 10v 12v 15v These regulators are used according to the required voltage need. no 1 Name of regulator LM7905 Output voltage -5v 71 . These regulators are also employed according to voltage requirements. no. Some of them are given below:S.These are the regulators which are able to produce positive and constant voltage. The voltage regulators are of three types:1) Constant positive voltage regulators 2) Constant negative voltage regulators 3) Variable voltage regulators Constant positive voltage regulators:.regulators can be used to produce negative and positive voltage of required value.

2 3 4 LM7910 LM7912 LM7915 -10v -12v -15v Variable voltage regulators:. The most commonly variable regulators are:- • LM317 (it is positive regulator) • LM 337(it is negative regulator) There description is given below:LM317 3-Terminal Adjustable Regulator:General Description: 72 .:• 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. These regulators again of two types i.e. 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.These are the regulator whose output voltage can be varied according to the desired need.

supplies of several hundred volts can be regulated as long as the maximum input to output differential is not exceeded.The LM317 series of adjustable 3-terminal positive voltage regulators is capable of supplying in excess of 1. Further. theLM317 can be used as a precision current regulator.e.5A over a 1. They are exceptionally easy to use and require only two external resistors to set the output voltage. i. Typical application: 73 .. An optional output capacitor can be added to improve transient response. thermal overload protection and safe area protection. Also. Supplies with electronic shutdown can be achieved by clamping the adjustment terminal to ground which programs the output to 1. The adjustment terminal can be bypassed to achieve very high ripple rejection ratios which are difficult to achieve with standard voltage. theLM317 series offers full overload protection available only in IC’s.2V where most loads draw little current. avoid short-circuiting the output. Normally. Also. In addition to higher performance than fixed regulators. both line and load regulation is better than standard fixed regulators. a programmable output regulator. or by connecting a fixed resistor between the adjustment pin and output.2V to 37V output range. Included on the chip are current limit. it makes an especially simple adjustable switching regulator. the LM117 is packaged in standard transistor packages which are easily mounted and handled. 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. All overload protection circuitry remains fully functional even if the adjustment terminal is disconnected.

Guaranteed 1% output voltage tolerance (LM317A) 2.5A output current 5. Current limit constant with temperature 7. Guaranteed max.U 3 V I N V 1 L M 3 1 7 2 / C Y L I N AD J V O U T V O U T R 1 2 2 0 1 E C 2 . 0. Guaranteed 1. P+ Product Enhancement tested 8. Adjustable output down to 1.01%/V line regulation (LM317A) 3.2V 6.3% load regulation (LM317) 4. 0. Guaranteed max. 1 u F R 2 5 k Features 1. 1 u F C 1 . 80 dB ripple rejection 74 .

output terminal. a the the LM317 1. Output is short-circuit protected Packages of LM317 Application Hints: In operation.9. and The develops reference between adjustment nominal voltage.25V VREF. reference voltage is impressed across program resistor R1 and. since the voltage is constant. constant current I1 then flows 75 .

and the rate of decrease of VIN. If there is insufficient load on the output. To do this. the output will rise. When an output capacitor is connected to a regulator and the input is shorted.through the output set resistor R2. all quiescent operating current is returned to the output establishing a minimum load current requirement. In the LM317. this discharge path is through a large junction that is able to 76 . the output voltage of the regulator. 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. The discharge current depends on the value of the capacitor. the LM317 was designed to minimize IADJ and make it very constant with line and load changes. Most 10μF capacitors have low enough internal series resistance to deliver 20A spikes when shorted. giving an output voltage of Since the 100μA current from the adjustment terminal represents an error term. there is enough energy to damage parts of the IC. Although the surge is short. the output capacitor will discharge into the output of the regulator.

Discharge occurs when either the input or output is shorted. r 77 . Internal to the LM317 is a 50  esistor which limits the peak discharge current.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.

V O N 3 R 1 1 P3 O 4 T R C 13 1 1N 4007 1 1 1 5 R R R 16 C 470uF 50V 1 5 C C 1 A 6 P C 2 2 0 0 u F 10uF 25V T AN T C 1 41 7 15 00 4V U 2 6 1 R V ADJ I N 3 V O U T R 1 1 2 7 6 5 4 1K 1W L 2 1 2 3 .V S 1 L M 3 3 7 1 D 1 N 5 / T 2 4 0 0 O 2 2 D 0 N 4 4 0 0 7 I N 7 D U C T O R A U D I O _ 0 78 .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. Bench supply diagram D 1 2 U L 3 2 2 C 0 8 C B B J 1 2 3 C O N 3 R 4 8 3 R R 1 I D + 2 G 1 E 1 1 0 1 4 10uF 25V T AN T C 12 R R 0 u F 5 0 V 5 2 N 4 1 L M 3 1 2 7 / T O 2 2 0 I N 3 2 1 D 3 C 9 C 1K 1W R 12 470uF 50V C 1 A 0 P 1 D U 4 5 6 C T O V R S J 1 2 S 3 C A 7 U D I O _ 0 0 0 7 V IV N O ADJ U T 2 R 1 R R R 9 P 1 O 0 T R 8 .

howstuffworks.com The Art of Electronics (Book) 79 .com www.talkingelectronics.BIBLIOGRAPHY      Wikipedia MicroC Manuals www.