Kapil Trining Report

download Kapil Trining Report

of 31

Transcript of Kapil Trining Report

  • 8/3/2019 Kapil Trining Report

    1/31

    SUMMER TRAINING REPORT

    0n

    EMBEDDED SYSTEMS BASED ON PIC MICROCONTROLLER

    Submitted in partial fulfillment of the requirements

    for the award of degree of

    Bachelor of Technology

    in

    Electronics and Communication Enginnering

    Guide: Mr Naveen Kumar Submitted by: KAPIL1508177EC2

    DEPARTMENT OF ELECTRONICS AND COMMUNICATION

    N.C COLLEGE OF ENGINEERING (permanently affiliated to KURUKSHETRA

    UNIVERSITY)

    ISRANA,PANIPAT

    1

  • 8/3/2019 Kapil Trining Report

    2/31

    ACKNOWLEDGEMENT

    I would like to articulate our profound gratitude and indebtedness to ourproject guide NAVEEN KUMAR; EMTECH FOUNDATION, who has alwaysbeen a constant motivation and guiding factor throughout the project timein and out as well. It has been a great pleasurefor us to get an opportunity to work under him and complete the projectsuccessfully.

    An undertaking of this nature could never have been attempted with ourreference to andinspiration from the works of others whose details are

    mentioned in references section. I acknowledge my indebtedness to all ofthem. Last but not the least, my sincere thanks to all of my friends whohave patiently extended all sorts of help for accomplishing thisundertaking.

    KAPIL(1508177)EC2

    2

  • 8/3/2019 Kapil Trining Report

    3/31

    CONTENTS

    Chapter 1 05

    1.1 Introduction........ . 051.2 Objectives..... 05

    1.3 Main Contributers......05

    1.3.1 Robhatah Robotic Solution Pvt Ltd ....05

    1.3.2 Jiyanjani Technologies Pvt Ltd08

    1.3.3 Simpal technologies.....09

    1.3.4 Aspirant Infotech Pvt Ltd.10

    Chapter 2.......11

    Training. . .......11

    2.1 Abstract... ....11

    2.2 Microchip PIC Microcontroller .. ...12

    2.2.1Introduction....12

    2.2.2 Software Used....17

    2.2.3Interfacing..18

    2.2.3.1 LED...18

    2.2.3.2Keypad Matrix....19

    2.2.3.3Liquid Crystal Display....20

    2.1.3.4 Seven Segment Display..21

    3

  • 8/3/2019 Kapil Trining Report

    4/31

    2.2.4 Timers/counters.21

    2.2.5ADC..22

    2.2.6 USART.25

    2.2.7 EEPROM Memory...26

    3. PROJECT ..28

    3.1 INTRODUCTION ..28

    3.2 COMPONENTS USED...28

    3.3 BLOCK DIAGRAM ...28

    3.4 WORKING .29

    3.4.1 LDR 29

    3.4.2 ADC 30

    3.5 APPLICATIONS .31

    4

  • 8/3/2019 Kapil Trining Report

    5/31

    Chapter 1 :-

    1.1 Introduction

    EMTECH Foundation is an ISO 9001:2001 certified Embedded Systems/ MicrocontrollerTraining and Consultancy Company, powered by a passion to provide the best of services in theindustry. Being In IT business for a couple of years, today Emtech is a leading solution providerfor embedded system designs across the globe.

    1.1 Obectives

    As Competitive scenarios, across the globe. Providing students a Technical Platform to become

    a industry ready professionals.We, Engineering the Engineers, Emtech Foundation Ignitingminds.

    Our vision is to setup the best Robotic Design Center in India. We aim to ensure that ourclients get the best of embedded solutions, with dedicated support from the talented anddedicated team of software professionals to the best of their needs.To meet the expectations of industry clients as well as students.

    Fig 1.1 Microchip logo Fig 1.2 Atmel logo

    1.3 Main Contributers

    1.3.1 ROBHATAH PVT LTD

    5

  • 8/3/2019 Kapil Trining Report

    6/31

    Humanoid

    It is a Private Limited in robotic technology consulting and consumer product manufacturingcompany founded in Singapore in the year 2004. Our technical team consists of the celebratedpioneers of international Robotic Research. Dr. Prahlad Vadakkepat, Director and chief mentorof Robhatah is also the general secretary of FIRA and holds prestigious positions in manyAssociations like IEEE, IETE etc.

    We provide robotics technology licenses, new concept and product development andconsultancy services to our clients. Robhatahs two main capability groups, CorporateConsulting and Consumer Product Development, function strategically to exploit the synergiesbetween them.

    The Consumer Product Development team develops innovative robotic solutions that addresschallenges in day-to-day life. This group focuses on delivering products that strongly appeal tocustomers by striking the right balance between product value and product cost.

    The Consulting team provides robotic research consultancy services to clients who haveunique robotic needs, like health care providers, industries handling hazardous materials andthe military.

    .

    6

  • 8/3/2019 Kapil Trining Report

    7/31

    manus Genus

    TheM a NU S and GeNUS humanoid robots are capable of walking on rough terrains and to climb

    Robot SoccerInitiated and developed the complete robotic soccer system as a test bed for cooperative roboticresearch.The robot soccer teams developed has won two awards:

    1. Second prize (2nd) in FIRA Robot World Cup Beijing 20012. Second prize in Singapore Robotic Games 2002.

    .

    Bipedal

    Legged robots have distinct advantages over their wheeledcounterparts when working in arbitrarily complex terrains -they can generally cross obstacles more easily, and exhibit

    greater adaptability. These features are important in several applications Bipedalsuch as exploration, maintenance, intervention and service. These

    application domains are beyond the realm of traditional manufacturing robots.

    7

    http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/73/154/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/73/154/http://vadakkepat.com/web/content/view/72/153/http://vadakkepat.com/web/content/view/72/153/
  • 8/3/2019 Kapil Trining Report

    8/31

    RevobotThe Revobot educational kit is the one of its kind fromRobhatah Robotic Solutions intended to facilitate students, professionals and hobbyists with a concrete platform fortheir foray into the exciting world of robotics andartificial intelligence.

    Revobot

    Vacuum Cleaner

    vacuum cleaner

    A robotic vacuum cleaner is a compact mechanical device that does not require a human to runit. They are small, round, and move automatically to pick up dirt. Advances in microchip

    technology have created these lightweight, cordless vacuums that rely on infrared technology tohelp them avoid bumping into walls and to navigate around furniture. The round robotic vacuumis protected by a rubber bumper around its circumference. Some models come with a wall-mounted storage bracket.

    1.3.2 JIYANJANI TECHNOLOGIES PVT. LTD

    Jiyanjani Technologies Pvt. Ltd., is well known name for providing PCB Design & Embedded

    Solutions to R & D division of organization in India. At Jiyanjani we have expertise in providingconsulting & solution to various electronics companies. Under the brand of Jiyanjani now wehave some other tie ups with world leading solution providers for various types of industries. AtJiyanjani our priority is to build a very strong, mutually-beneficial and long-lasting relationshipwith our customers. As a part of this philosophy, we provide unparalleled post-sales technicalsupport to our customers till they dont need us.

    8

    http://www.robhatah.in/home/index.php?option=com_content&view=article&id=65&Itemid=86
  • 8/3/2019 Kapil Trining Report

    9/31

    We have diverse business offers, products and solutions. We are a major player in areas such asEmbedded System Designing, PCB Designing & Manufacturing Services, Strategic Electronics,IT etc. with our team of experts located at New Delhi. We offer leading edge technologyproducts and solutions in the advance technology areas.With a strong team of well-trained andexperienced engineers, Product Support and Training Division of Jiyanjani Technologies provide pre-sales and post-sales support and training to the wide range of academic and researchinstitutions and corporate clients.

    1.3.3 SIMPAL TECHNOLOGIES

    Simpaltechnologiesis the AuthorizedAlliance PartnerofRenesasSingaporeRegion

    Embedded projects

    1.3.4 ASPIRANT INFOTECH PVT. LTD

    Aspirant is a privately held company.Aspirant solely focuses on customers challenges andprovide solutions to ensure that our customers are secured enough to handle the external attackor internal sabotage and have maximum productivity. Aspirant with its focus and niche in IT

    9

  • 8/3/2019 Kapil Trining Report

    10/31

    Security arena (for IT Infrastructure & Networks) strives to provide solutions for PrivilegedPassword Management, Remote Vendor Management, Single Sign-On solutions, Internet Accessmanagement, Patch and Compliance Management, Eliminate Administrator Rights, LeastPrivilege Access, Appliance based eMail solutions and IT Helpdesk solutions.

    Manufacturing, Telecommunications, Banking, Insurance, Finance, Healthcare and Publicutilities are our key-sectors. Client-Server, Web Enabling, Network Consultation etc are amongthe many services we offer.

    Products:

    Aspirant vision

    Privileged Password Management:

    Internet Access Management:

    Privilege Manager:

    Security & Compliance:

    Web Filtering

    Network Access Control

    Email Solution

    Patch & Compliance Mgt

    Single Sign on

    Internet Security Appliance

    10

  • 8/3/2019 Kapil Trining Report

    11/31

    CHAPTER 2

    MY TRAINING

    2.1 ABSTRACT

    At Emtech Foundation, I learnt the design and development process in an embedded systemsproject.My area of study was basics of the EMBEDDED SYSTEM which can be used to give prototypeof one of the big working model or can design simple small working model.

    I studied and worked on Microchips PIC16F877A microcontroller.o Interfacingo Programmingo Debuggingo Simulation

    I studied the basic about the PIC I learnt the Design and Development process in the embedded systems. I worked on hardware testing that included:

    o Path testingo Testing for short circuito Components testing

    These were tought to us by the help of MUTIMETER only I studied the PCB designing process.

    o Design circuit using ORCADo Pasting the circuit on Coppero Etching processo Drillingo Use of abrasives for cleaning

    11

  • 8/3/2019 Kapil Trining Report

    12/31

    2.2 MICROCHIPS PIC MICROCONTROLLER

    2.2.1 Introduction

    Microchip Technology (NASDAQ: MCHP) is an American manufacturer of microcontroller,

    memory and analog semiconductors. The company was founded in 1987 when General

    Instrument spun off its microelectronics division as a wholly owned subsidiary. Its products

    include microcontrollers (PICmicro,dsPIC / PIC24,PIC32), SerialEEPROM devices,

    SerialSRAM devices, KEELOQ devices, radio frequency (RF) devices, thermal, power and

    battery management analog devices, as well as linear, interface and mixed signal devices. Some

    of the interface devices include USB,ZigBee/MiWi, Controller Area Network, andEthernet.

    In April 2009, Microchip Technology announced the nanoWatt XLP Microcontrollers (With

    Worlds Lowest Sleep Current).

    Corporate headquarters is located at Chandler, Arizona with wafer fabs in Tempe,

    Arizona andGresham, Oregon.

    PIC controller

    PIC is a family ofHarvard architecturemicrocontrollers made byMicrochip Technology,

    derived from the PIC1640[1] originally developed by General Instrument's Microelectronics

    Division. The name PIC initially referred to "Programmable Interface Controller".

    PICs are popular with both industrial developers and hobbyists alike due to their low cost, wide

    availability, large user base, extensive collection of application notes, availability of low cost or

    free development tools, and serial programming (and re-programming with flash memory)

    capability.

    12

    http://en.wikipedia.org/wiki/NASDAQhttp://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=MCHP&selected=MCHPhttp://en.wikipedia.org/wiki/USAhttp://en.wikipedia.org/wiki/Semiconductorshttp://en.wikipedia.org/wiki/General_Instrumenthttp://en.wikipedia.org/wiki/General_Instrumenthttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/PIC_microcontrollerhttp://en.wikipedia.org/wiki/PIC_microcontrollerhttp://en.wikipedia.org/wiki/PIC24#PIC24_and_dsPIC_16-bit_Microcontrollershttp://en.wikipedia.org/wiki/PIC32http://en.wikipedia.org/wiki/PIC32http://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/Static_random_access_memoryhttp://en.wikipedia.org/wiki/KeeLoqhttp://en.wikipedia.org/wiki/Radio_frequencyhttp://en.wikipedia.org/wiki/USBhttp://en.wikipedia.org/wiki/ZigBeehttp://en.wikipedia.org/wiki/ZigBeehttp://en.wikipedia.org/wiki/MiWihttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/Ethernethttp://en.wikipedia.org/wiki/Ethernethttp://en.wikipedia.org/wiki/Chandler,_Arizonahttp://en.wikipedia.org/wiki/Tempe,_Arizonahttp://en.wikipedia.org/wiki/Tempe,_Arizonahttp://en.wikipedia.org/wiki/Gresham,_Oregonhttp://en.wikipedia.org/wiki/Gresham,_Oregonhttp://en.wikipedia.org/wiki/File:PIC_microcontrollers.jpghttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Microchip_Technologyhttp://en.wikipedia.org/wiki/Microchip_Technologyhttp://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-PICmicrofamilytree-0http://en.wikipedia.org/wiki/General_Instrumenthttp://en.wikipedia.org/wiki/General_Instrumenthttp://en.wikipedia.org/wiki/File:PIC_microcontrollers.jpghttp://en.wikipedia.org/wiki/File:Microchip_logo.svghttp://en.wikipedia.org/wiki/NASDAQhttp://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=MCHP&selected=MCHPhttp://en.wikipedia.org/wiki/USAhttp://en.wikipedia.org/wiki/Semiconductorshttp://en.wikipedia.org/wiki/General_Instrumenthttp://en.wikipedia.org/wiki/General_Instrumenthttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/PIC_microcontrollerhttp://en.wikipedia.org/wiki/PIC24#PIC24_and_dsPIC_16-bit_Microcontrollershttp://en.wikipedia.org/wiki/PIC32http://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/Static_random_access_memoryhttp://en.wikipedia.org/wiki/KeeLoqhttp://en.wikipedia.org/wiki/Radio_frequencyhttp://en.wikipedia.org/wiki/USBhttp://en.wikipedia.org/wiki/ZigBeehttp://en.wikipedia.org/wiki/MiWihttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/Ethernethttp://en.wikipedia.org/wiki/Chandler,_Arizonahttp://en.wikipedia.org/wiki/Tempe,_Arizonahttp://en.wikipedia.org/wiki/Tempe,_Arizonahttp://en.wikipedia.org/wiki/Gresham,_Oregonhttp://en.wikipedia.org/wiki/Harvard_architecturehttp://en.wikipedia.org/wiki/Microcontrollerhttp://en.wikipedia.org/wiki/Microchip_Technologyhttp://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-PICmicrofamilytree-0http://en.wikipedia.org/wiki/General_Instrument
  • 8/3/2019 Kapil Trining Report

    13/31

    FEATURES OF THE PIC MICROCONTROLLER :-

    --Harvard Architecture

    Instruction Pipelining

    Large Register File

    Single Cycle Instructions

    Single Word Instructions

    Long Word Instructions

    Reduced Instruction Set

    Orthogonal Instruction Set

    Baseline Core devices

    These devices feature a 12-bit wide code memory, a 32-byte register file, and a tiny two level

    deep call stack. They are represented by the PIC10 series, as well as by some PIC12 and PIC16

    devices. Baseline devices are available in 6-pin to 40-pin packages.

    Generally the first 7 to 9 bytes of the register file are special-purpose registers, and the remainingbytes are general purpose RAM. If banked RAM is implemented, the bank number is selected by

    the high 3 bits of the FSR. This affects register numbers 1631; registers 015 are global and not

    affected by the bank select bits.

    Mid-Range core devices

    These devices feature a 14-bit wide code memory, and an improved 8 level deep call stack. The

    instruction set differs very little from the baseline devices, but the increased opcode width allows

    128 registers and 2048 words of code to be directly addressed. The mid-range core is available in

    the majority of devices labeled PIC12 and PIC16.

    The first 32 bytes of the register space are allocated to special-purpose registers; the remaining

    96 bytes are used for general-purpose RAM. If banked RAM is used, the high 16 registers

    (0x700x7F) are global, as are a few of the most important special-purpose registers, including

    the STATUS register which holds the RAM bank select bits. (The other global registers are FSR

    13

  • 8/3/2019 Kapil Trining Report

    14/31

    and INDF, the low 8 bits of the program counter PCL, the PC high preload register PCLATH,

    and the master interrupt control register INTCON.)

    PIC18 High End core devices

    Microchip introduced the PIC18 architecture in 2000. Unlike the 17 series, it has proven to bevery popular, with a large number of device variants presently in manufacture. In contrast to

    earlier devices, which were more often than not programmed in assembly, C has become the

    predominant development language .

    PIC24 and dsPIC 16-bit microcontrollers

    In 2001, Microchip introduced the dsPIC series of chips,[7]which entered mass production in

    late 2004. They are Microchip's first inherently 16-bit microcontrollers. PIC24 devices are

    designed as general purpose microcontrollers. dsPIC devices includedigital signalprocessingcapabilities in addition.

    PIC32 32-bit microcontrollers

    In November 2007 Microchip introduced the new PIC32MX family of 32-bit microcontrollers.

    The initial device line-up is based on the industry standard MIPS32 M4K Core. The device can

    be programmed using the Microchip MPLAB C Compiler for PIC32 MCUs, a variant of the

    GCC compiler. The first 18 models currently in production (PIC32MX3xx and PIC32MX4xx)

    are pin to pin compatible and share the same peripherals set with the PIC24FxxGA0xx family of

    (16-bit) devices allowing the use of common libraries, software and hardware tools.

    The PIC32 architecture brings a number of new features to Microchip portfolio, including:

    The highest execution speed 80 MIPS (90+ Dhrystone MIPS @80 MHz)

    The largest FLASH memory: 512 kByte

    One instruction per clock cycle execution

    The first cached processor

    Allows execution from RAM

    Full Speed Host/Dual Role and OTG USB capabilities

    Full JTAG and 2 wire programming and debugging

    Real-time trace

    Variants

    14

    http://en.wikipedia.org/w/index.php?title=DsPIC&action=edit&redlink=1http://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-6http://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-6http://en.wikipedia.org/wiki/Digital_signal_processinghttp://en.wikipedia.org/wiki/Digital_signal_processinghttp://en.wikipedia.org/wiki/Digital_signal_processinghttp://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2018&mcparam=en532888http://en.wikipedia.org/w/index.php?title=MIPS32_M4K_Core&action=edit&redlink=1http://microchip.com/c32http://en.wikipedia.org/wiki/Dhrystonehttp://en.wikipedia.org/w/index.php?title=DsPIC&action=edit&redlink=1http://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-6http://en.wikipedia.org/wiki/Digital_signal_processinghttp://en.wikipedia.org/wiki/Digital_signal_processinghttp://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2018&mcparam=en532888http://en.wikipedia.org/w/index.php?title=MIPS32_M4K_Core&action=edit&redlink=1http://microchip.com/c32http://en.wikipedia.org/wiki/Dhrystone
  • 8/3/2019 Kapil Trining Report

    15/31

    Within a series, there are still many device variants depending on what hardware resources the

    chip features.

    General purpose I/O pins.

    Internal clock oscillators. 8/16/32 Bit Timers.

    Internal EEPROM Memory.

    Synchronous/Asynchronous Serial Interface USART.

    MSSP Peripheral forIC and SPICommunications.

    Capture/Compare and PWMmodules.

    Analog-to-digital converters (up to ~1.0 MHz).

    USB,Ethernet, CAN interfacing support.

    External memory interface. Integrated analog RF front ends (PIC16F639, and rfPIC).

    KEELOQ Rolling code encryption peripheral (encode/decode)

    Microchip Programmers

    Microchip PICSTART Plus programmer

    There are many programmers/debuggers available directly from Microchip.

    Current Microchip Programmers (as of 1/2010)[15]

    PICKit 3 (USB interface)

    PICStart Plus (RS232 serial interface) : intelligent. MPLAB ICD 3 (USB 2.0 interface)

    MPLAB PM3 (RS232 serial and USB interface)

    MPLAB REAL ICE (USB 2.0 interface) : ICSP programming only

    Legacy Microchip Programmers

    PICKit 2 (USB interface)

    15

    http://en.wikipedia.org/wiki/GPIOhttp://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/USARThttp://en.wikipedia.org/wiki/USARThttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Analog-to-digital_converterhttp://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/Ethernethttp://en.wikipedia.org/wiki/Ethernethttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/KeeLoqhttp://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-14http://www.microchipdirect.com/ProductSearch.aspx?Keywords=PG164130http://www.microchipdirect.com/ProductSearch.aspx?Keywords=PG164120http://en.wikipedia.org/wiki/File:Picstart_plus.jpghttp://en.wikipedia.org/wiki/File:Picstart_plus.jpghttp://en.wikipedia.org/wiki/GPIOhttp://en.wikipedia.org/wiki/EEPROMhttp://en.wikipedia.org/wiki/USARThttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Serial_Peripheral_Interfacehttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Analog-to-digital_converterhttp://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/Ethernethttp://en.wikipedia.org/wiki/Controller_Area_Networkhttp://en.wikipedia.org/wiki/KeeLoqhttp://en.wikipedia.org/wiki/PIC_microcontroller#cite_note-14http://www.microchipdirect.com/ProductSearch.aspx?Keywords=PG164130http://www.microchipdirect.com/ProductSearch.aspx?Keywords=PG164120
  • 8/3/2019 Kapil Trining Report

    16/31

    MPLAB ICD2 (RS232 serial and USB 1.0 interface) : ICSP programming only

    PICKit 1 (USB interface)

    PRO MATE II (RS232 serial interface) : intelligent.

    In-Circuit Debugging

    Later model PICs feature an ICD (in-circuit debugging) interface, built into the CPU core. ICD

    debuggers (MPLAB ICD2 and other third party) can communicate with this interface using three

    lines. This cheap and simple debugging system comes at a price however, namely limited

    breakpoint count (1 on older pics 3 on newer PICs), loss of some IO (with the exception of some

    surface mount 44-pin PICs which have dedicated lines for debugging) and loss of some features

    of the chip. For small PICs, where the loss of IO caused by this method would be unacceptable,

    special headers are made which are fitted with PICs that have extra pins specifically for

    debugging.In-Circuit Emulators

    Microchip offers three full in circuit emulators: the MPLAB ICE2000 (parallel interface, a USB

    converter is available); the newer MPLAB ICE4000 (USB 2.0 connection); and most recently,

    the REAL ICE. All of these ICE tools can be used with the MPLAB IDE for full source-level

    debugging of code running on the target.

    The ICE2000 requires emulator modules, and the test hardware must provide a socket which can

    take either an emulator module, or a production device.

    The REAL ICE connects directly to production devices which support in-circuit emulation

    through the PGC/PGD programming interface, or through a high speed connection which uses

    two more pins.

    2.2.2 SOFTWARE USED

    MPLAB IDE is a software program that runs on a PC to develop applications for Microchipmicrocontrollers. It is called an Integrated Development Environment, or IDE, because it

    16

    http://en.wikipedia.org/wiki/PICKithttp://en.wikipedia.org/wiki/PICKit
  • 8/3/2019 Kapil Trining Report

    17/31

    provides a single integrated Environment to develop code for embedded microcontrollers.Experienced embedded systems designers may want to skip ahead Section1.7Components ofMPLAB IDE.

    Here in this environment we can develop our program in the EDITOR , can see the o/p as and

    When required to check out whether the program is going right as required or not and to do thisWe make use of the SIMULATOR tolls provided to us by IDE eg. LCD,LED,KEYPAD etc.

    MPLAB IDE 7.40

    ` MPLAB IDE

    2.2.3 INTERFACING

    17

  • 8/3/2019 Kapil Trining Report

    18/31

    2.2.3.1 LED

    Now the most basic way to detect the o/p is 1 or 0 is that the connect the LEDHere we can connect 8 leds to see the output , we can specify the pin to the eachLED .As in this example we have connected the LED s to the PORT D (all eight pins)

    This is very useful feature of the simulator IDE .

    .

    led intrfacing

    2.2.3.2 KEYPAD MATRIX

    Keys are used to transfer the logic from one side of it to another.Its an 4x4 matrix of keys providing us a total of 16 keys with the use of only 8 pins.We get the maximum hardware utilization out of it. We can have 16 functions out of our 16

    keys, can have more by multiplexing it.Here one thing has to be kept in mind that scan lines should be the o/p lines And the return linesshould be the i/p lines.This I have used in my project to allow the user to enter the password sothis tool helped me a lot in debugging and to confirm that my program is rightSo it was indespensible for me

    18

  • 8/3/2019 Kapil Trining Report

    19/31

    Keypad matrix

    2.2.3.2 LIQUID CRYSTAL DISPLAY

    This is the most looked after feature as it make the o/p or display very attractive , As it is one ofthe best GUI (graphic user interface) .

    A liquid crystal display (LCD) is a flat panel display, electronic visual display, video

    display that uses the light modulating properties ofliquid crystals (LCs). LCs do not emit lightdirectly

    .

    They are used in a wide range of applications, including computer monitors, television,instrument panels, aircraft cockpit displays, signage, etc. They are common in consumer devicessuch as video players, gaming devices, clocks, watches,calculators, and telephones. LCDs havedisplacedcathode ray tube (CRT) displays in most applications. They are usually more compact,lightweight, portable, less expensive, more reliable, and easier on the eyes.

    19

    http://en.wikipedia.org/wiki/Flat_panel_displayhttp://en.wikipedia.org/wiki/Flat_panel_displayhttp://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Video_displayhttp://en.wikipedia.org/wiki/Video_displayhttp://en.wikipedia.org/wiki/Liquid_Crystalshttp://en.wikipedia.org/wiki/Computer_monitorhttp://en.wikipedia.org/wiki/Computer_monitorhttp://en.wikipedia.org/wiki/Televisionhttp://en.wikipedia.org/wiki/Flight_instrumentshttp://en.wikipedia.org/wiki/Signagehttp://en.wikipedia.org/wiki/Clockhttp://en.wikipedia.org/wiki/Calculatorhttp://en.wikipedia.org/wiki/Calculatorhttp://en.wikipedia.org/wiki/Telephonehttp://en.wikipedia.org/wiki/Cathode_ray_tubehttp://en.wikipedia.org/wiki/Cathode_ray_tubehttp://en.wikipedia.org/wiki/Flat_panel_displayhttp://en.wikipedia.org/wiki/Electronic_visual_displayhttp://en.wikipedia.org/wiki/Video_displayhttp://en.wikipedia.org/wiki/Video_displayhttp://en.wikipedia.org/wiki/Liquid_Crystalshttp://en.wikipedia.org/wiki/Computer_monitorhttp://en.wikipedia.org/wiki/Televisionhttp://en.wikipedia.org/wiki/Flight_instrumentshttp://en.wikipedia.org/wiki/Signagehttp://en.wikipedia.org/wiki/Clockhttp://en.wikipedia.org/wiki/Calculatorhttp://en.wikipedia.org/wiki/Telephonehttp://en.wikipedia.org/wiki/Cathode_ray_tube
  • 8/3/2019 Kapil Trining Report

    20/31

    LCD

    In it we can select by our choice which pin of PIC to connect as the enable pinAnd which to connect as the RS pin (to select the DATA or COMMAND )

    2.1.3.5 SEVEN SEGMENT DISPLAY

    Seven segment display- This is the cheap GUI and it is easy to handle used in the AC s in our college

    20

  • 8/3/2019 Kapil Trining Report

    21/31

    2.2.4 TIMERS /COUNTERS

    PIC 16 had three timers: Timer0 Timer1

    Timer2I used them to create a delay of 1ms, 1s and also made them act as a counter forexternally generated pulse.

    2.2.5 ADC

    Most important specification of ADCs is the resolution. This specifies how accurately the ADCmeasures the analog input signals. Common ADCs are 8 bit, 10 bit and 12 bit. For example if thereference voltage(explained latter) of ADC is 0 to 5v then a 8 bit ADC will break it in 256divisions so it can measure it accurately up to 5/256 v= 19mV approx. While the 10 bit ADC will

    break the range in 5/1024 = 4.8mV approx. So you can see that the 8 bit ADC can't tell thedifference between 1mV and 18mV. The ADC in PIC16 are 10 bit.

    Other specification include (but not limited to) the sampling rate, that means how fast the ADCcan take readings. Microchipclaims that pic18f4520's ADC can go as high as 100K samples persecond.

    ADC Terminology

    Reference Voltage: The reference voltage specifies the minimum and maximum voltage rangeof analog input. In PIC 18 there are two reference voltage, one is the Vref- and one is Vref+. TheVref- specifies the minimum input voltage of analog input while the Vref+ specifies the

    maximum. For example if the input signal Vref- is applied to analog input channel then the resultof conversion will be 0 and if voltage equal to Vref+ is applied to the input channel the resultwill be 1023 (max value for 10bit ADC).

    Fig2.9: ADC Reference Voltage.

    The Vref+ and Vref- pins are available in PIN5 and PIN4 of the PIC16F877A chip. So you canconnect the reference voltage here. For a simple design the Vref- is GND and Vref+ is Vcc. Asthis is such a common configuration that the ADC can be set up to use these reference internally.

    21

    http://microchip.com/http://microchip.com/http://microchip.com/
  • 8/3/2019 Kapil Trining Report

    22/31

    Therefore you do not need to connect these on the external Vref pins, so you can use them forother purpose.

    FORMULA FOR THE DIGITAL OUTPUT IS :-

    Digital o/p = {( Vin - Vref- ) / (Vref+ - Vref-)}x1023

    ADC Channels: The ADC module is connected to several channels via a multiplexer. Themultiplexer can connect the input of the ADC to any of the available channels. This allows youto connect many analog signals to the MCU (say 3 temperature sensors). In PIC18F877A thereare 8 analog input channels, they are named AN0, AN1 etc. You can have a look at the pinconfiguration on the previous page .Acquisition Time: When an specific channel is selected the voltage from that input channel is

    stored in an internal holding capacitor. It takes some time for the capacitor to get fully chargedand become equal to the applied voltage. This time is called acquisition time. Once acquisitiontime is over the input channel is disconnected from the source and the conversion begin. Theacquisition times depends on several factor like the source impedance, Vdd of the system andtemperature. You can refer to the page 227 and 228 in the datasheet for details on its calculation.A safe value is 2.45uS, so the delay of this much time should atleast be given.

    ADC Clock: ADC Requires a clock source to do its conversion, this is called ADC Clock. Thetime period of the ADC Clock is called TAD. It is also the time required to generate 1 bit ofconversion. The ADC requires 11 TAD to do a 10 bit conversion. It can be derived from theCPU clock (called TOSC) by dividing it by a suitable division factor. There are Seven possible

    option. 2 x TOSC 4 x TOSC 8 x TOSC 16 x TOSC 32 x TOSC 64 x TOSC Internal RC

    For Correct A/D Conversion, the A/D conversion clock (TAD) must be as short as possible butgreater than the minimum TAD . See table 26-25 in PIC16F877A datasheet it is 0.7uS forPIC16FXXXX device .We are running at 4MHz.

    22

  • 8/3/2019 Kapil Trining Report

    23/31

    CONTROL REGISTERS :-

    ADCON0 :-

    ADCON1:-

    OUTPUT REGISTERS :-

    23

  • 8/3/2019 Kapil Trining Report

    24/31

    ADC BLOCK DIAGRAM :-

    (from datasheet)

    2.2.6 USART- ASYNCHRONOUS TRANSMISSION

    The Universal Synchronous Asynchronous ReceiverTransmitter (USART) module is one of thetwo serial I/O modules. (USART is also known as a Serial Communications Interface or SCI.)The USART can be configured as a full-duplex asynchronous system that can communicate withperipheral devices, such as CRT terminals and personal computers. It can also be configured as ahalf-duplex synchronous system that can communicate with peripheral devices, such as A/DorD/A integrated circuits, serial EEPROMs and so on. The USART module implementsadditional features, by this we can take in data i.e digital from various serial devices so caninterface them with the PICThese are

    - RFID- GPS

    Etc.

    24

  • 8/3/2019 Kapil Trining Report

    25/31

    usart.2.2.7 EEPROM MEMORY

    EEPROM (also written E2PROM and pronounced "e-e-prom," "double-e prom" or simply "e-

    squared") stands for Electrically Erasable Programmable Read-Only Memory and is a type

    ofnon-volatile memoryused in computers and other electronic devices to store small amounts of

    data that must be saved when power is removed, e.g., calibration tables or device configuration.

    When larger amounts of static data are to be stored (such as in USB flash drives) a specific type

    of EEPROM such asflash memory is more economical than traditional EEPROM devices.

    EEPROMs are realized as arrays offloating-gate transistors.

    EEPROM is user-modifiable read-only memory (ROM) that can be erased and reprogrammed

    (written to) repeatedly through the application of higher than normal electrical voltage generated

    externally or internally in the case of modern EEPROMs. Unlike EPROM chips, EEPROMs do

    not need to be removed from the computer to be modified. However, an EEPROM chip has to be

    erased and reprogrammed in its entirety, not selectively. It also has a limited life - that is, the

    number of times it can be reprogrammed is limited to tens or hundreds of thousands of times. In

    an EEPROM that is frequently reprogrammed while the computer is in use, the life of the

    EEPROM can be an important design consideration.

    25

    http://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/Floating-gate_transistorhttp://en.wikipedia.org/wiki/Non-volatile_memoryhttp://en.wikipedia.org/wiki/USB_flash_drivehttp://en.wikipedia.org/wiki/Flash_memoryhttp://en.wikipedia.org/wiki/Floating-gate_transistor
  • 8/3/2019 Kapil Trining Report

    26/31

    Eeprom memory editor

    26

  • 8/3/2019 Kapil Trining Report

    27/31

    3. PROJECT

    NAME :- COLOR SENSOR

    3.1 :- INTRODUCTION

    System: way of organizing a task. Embedded : 1. put into a machinery

    2. specific purpose3. controller-based

    3.2 COMPONENTS USED :-

    1. Harvard architecture of PIC16F877A2. 8 bit microcontroller

    3. 10 bit ADC4. 8K ROM5. 368 Bytes RAM6. 5 I/O ports ETC.

    3.3 BLOCK DIAGRAM :-

    3.4 WORKING

    PIC16F877A

    ADC

    LDR

    UNITS DISPLAY

    UNITS

    27

  • 8/3/2019 Kapil Trining Report

    28/31

    - LDR senses the light intensity reflected- Sent signal to ADC- Compare with pre known value- So correspondingly glow that color LED

    WORKING OF THE INDIVIDUAL COMPONENTS :-

    3.4.1

    LDR(LIGHT DEPENDENT RESISTOR)

    CdS Absorbs light & gain energy to jump from valence band to conduction bandThis generates free e- & thereby, current increases & resistance decreases when li-ght falls.

    28

  • 8/3/2019 Kapil Trining Report

    29/31

    29

  • 8/3/2019 Kapil Trining Report

    30/31

    FUNCTION OF ADC:

    SAR ADC 0808 INBUILT 8 Inputs Controlled By 3-Channels 2 SFG: ADCON 0&1

    Pcfg decided from datasheet V(D) = [V(in) / V(dd)]*1023

    FIGURE:

    30

  • 8/3/2019 Kapil Trining Report

    31/31

    APPLICATIONS:

    1. FOOD INDUSTRY

    2. IN DIFFENTIATING PACKAGING OF WAFERS.

    3. IN SMART CARD READERS

    4. AT ENTRY GATE FOR SECURITY