You are on page 1of 44

CHAPTER-1 INTRODUCTION

1.1: EMBEDDED SYSTEMS An embedded system is a computer system designed to perform one or a few dedicated functions often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs. Embedded systems control many devices in common use today. Embedded systems are controlled by one or more main processing cores that are typically either microcontrollers or digital signal processors (DSP). The key characteristic, however, is being dedicated to handle a particular task, which may require very powerful processors. For example, air traffic control systems may usefully be viewed as embedded, even though they involve mainframe computers and dedicated regional and national networks between airports and radar sites. (Each radarprobably includes one or more embedded systems of its own.) Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. Physically embedded systems range from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. In general, "embedded system" is not a strictly definable term, as most systems have some element of extensibility or programmability. For example, handheld computers share some elements with embedded systems such as the operating systems and microprocessors which power them, but they allow different applications to be loaded and peripherals to be connected. Moreover, even systems which don't expose programmability as a primary feature generally need to support
1

software updates. On a continuum from "general purpose" to "embedded", large application systems will have subcomponents at most points even if the system as a whole is "designed to perform one or a few dedicated functions", and is thus appropriate to call "embedded".

1.2: NEED FOR EMBEDDED SYSTEMS The uses of embedded systems are virtually limitless, because every day new products are introduced to the market that utilizes embedded computers in novel ways. In recent years, hardware such as microprocessors, microcontrollers, and FPGA chips have become much cheaper. So when implementing a new form of control, it's wiser to just buy the generic chip and write your own custom software for it. Producing a custom-made chip to handle a particular task or set of tasks costs far more time and money. Many embedded computers even come with extensive libraries, so that "writing your own software" becomes a very trivial task indeed. From an implementation viewpoint, there is a major difference between a computer and an embedded system. Embedded systems are often required to provide Real-Time response. The main elements that make embedded systems unique are its reliability and ease in debugging.

1.2.1: Debugging Embedded debugging may be performed at different levels, depending on the facilities available. From simplest to most sophisticate they can be roughly grouped into the following areas Interactive resident debugging, using the simple shell provided by the embedded operating system (e.g. Forth and Basic) External debugging using logging or serial port output to trace operation using either a monitor in flash or using a debug server like the Remedy Debugger which even works for heterogeneous multi core systems. An in-circuit debugger (ICD), a hardware device that connects to the microprocessor via a JTAG or Nexus interface. This allows the operation of the
2

microprocessor to be controlled externally, but is typically restricted to specific debugging capabilities in the processor. An in-circuit emulator replaces the microprocessor with a simulated equivalent, providing full control over all aspects of the microprocessor. A complete emulator provides a simulation of all aspects of the hardware, allowing all of it to be controlled and modified and allowing debugging on a normal PC. Unless restricted to external debugging, the programmer can typically load and run software through the tools, view the code running in the processor, and start or stop its operation. The view of the code may be as assembly code or source-code. Because an embedded system is often composed of a wide variety of elements, the debugging strategy may vary. For instance, debugging a software(and microprocessor) centric embedded system is different from debugging an embedded system where most of the processing is performed by peripherals (DSP, FPGA, coprocessor). An increasing number of embedded systems today use more than one single processor core. A common problem with multi-core development is the proper synchronization of software execution. In such a case, the embedded system design may wish to check the data traffic on the busses between the processor cores, which requires very low-level debugging, at signal/bus level, with a logic analyzer, for instance.

1.2.2: Reliability Embedded systems often reside in machines that are expected to run continuously for years without errors and in some cases recover by themselves if an error occurs. Therefore the software is usually developed and tested more carefully than that for personal computers, and unreliable mechanical moving parts such as disk drives, switches or buttons are avoided. Specific reliability issues may include

The system cannot safely be shut down for repair, or it is too inaccessible to repair. Examples include space systems, undersea cables, navigational beacons, bore-hole systems, and automobiles.

The system must be kept running for safety reasons. "Limp modes" are less tolerable. Often backups are selected by an operator. Examples include aircraft navigation, reactor control systems, safety-critical chemical factory controls, train signals, engines on single-engine aircraft.

The system will lose large amounts of money when shut down: Telephone switches, factory controls, bridge and elevator controls, funds transfer and market making, automated sales and service.

A variety of techniques are used, sometimes in combination, to recover from errorsboth software bugs such as memory leaks, and also soft errors in the hardware: Watchdog timer that resets the computer unless the software periodically notifies the watchdog Subsystems with redundant spares that can be switched over to software "limp modes that provide partial function. Designing with a Trusted Computing Base (TCB) architecture ensures a highly secure & reliable system environment. An Embedded Hypervisor is able to provide secure encapsulation for any subsystem component, so that a compromised software component cannot interfere with other subsystems, or privileged-level system software. This encapsulation keeps faults from propagating from one subsystem to another, improving reliability. This may also allow a subsystem to be automatically shut down and restarted on fault detection. Immunity Aware Programming.

1.3: EXPLANATION OF EMBEDDED SYSTEMS 1.3.1: Software Architecture There are several different types of software architecture in common use.

Simple Control Loop In this design, the software simply has a loop. The loop calls subroutines, each of which manages a part of the hardware or software.

Interrupt Controlled System Some embedded systems are predominantly interrupt controlled. This means that tasks performed by the system are triggered by different kinds of events. An interrupt could be generated for example by a timer in a predefined frequency, or by a serial port controller receiving a byte. These kinds of systems are used if event handlers need low latency and the event handlers are short and simple. Usually these kinds of systems run a simple task in a main loop also, but this task is not very sensitive to unexpected delays. Sometimes the interrupt handler will add longer tasks to a queue structure. Later, after the interrupt handler has finished, these tasks are executed by the main loop. This method brings the system close to a multitasking kernel with discrete processes.

Cooperative Multitasking A non-preemptive multitasking system is very similar to the simple control loop scheme, except that the loop is hidden in an API. The programmer defines a series of tasks, and each task gets its own environment to run in. When a task is idle, it calls an idle routine, usually called pause, wait, yield, nop (stands for no operation), etc. The advantages and disadvantages are very similar to the control loop, except that adding new software is easier, by simply writing a new task, or adding to the queue-interpreter.

Primitive Multitasking In this type of system, a low-level piece of code switches between tasks or threads based on a timer (connected to an interrupt). This is the level at which the
5

system is generally considered to have an "operating system" kernel. Depending on how much functionality is required, it introduces more or less of the complexities of managing multiple tasks running conceptually in parallel. As any code can potentially damage the data of another task (except in larger systems using an MMU) programs must be carefully designed and tested, and access to shared data must be controlled by some synchronization strategy, such as message queues, semaphores or a non-blocking synchronization scheme. Because of these complexities, it is common for organizations to buy a realtime operating system, allowing the application programmers to concentrate on device functionality rather than operating system services, at least for large systems; smaller systems often cannot afford the overhead associated with a generic real time system, due to limitations regarding memory size, performance, and/or battery life. Microkernels and Exokernels A microkernel is a logical step up from a real-time OS. The usual arrangement is that the operating system kernel allocates memory and switches the CPU to different threads of execution. User mode processes implement major functions such as file systems, network interfaces, etc. In general, microkernels succeed when the task switching and intertask communication is fast, and fail when they are slow. Exokernels communicate efficiently by normal subroutine calls. The hardware and all the software in the system are available to, and extensible by application programmers. Based on performance, functionality, requirement the embedded systems are divided into three categories

1.3.2: Stand Alone Embedded System These systems takes the input in the form of electrical signals from transducers or commands from human beings such as pressing of a button etc.., process them and produces desired output. This entire process of taking input, processing it and giving output is done in standalone mode. Such embedded systems comes under stand alone embedded systems Example: microwave oven, air conditioner etc...
6

1.3.3: Real-time embedded systems Embedded systems which are used to perform a specific task or operation in a specific time period those systems are called as real-time embedded systems. There are two types of real-time embedded systems . Hard Real-time embedded systems These embedded systems follow an absolute dead line time period i.e.., if the tasking is not done in a particular time period then there is a cause of damage to the entire equipment.

Soft Real Time embedded systems These embedded systems follow a relative dead line time period i.e.., if the task is not done in a particular time that will not cause damage to the equipment. Consider a TV remote control system, if the remote control takes a few milliseconds delay it will not cause damage either to the TV or to the remote control. These systems which will not cause damage when they are not operated at considerable time period those systems comes under soft real-time embedded systems.

1.4: INTRODUCTION TO OSCILLOSCOPES An oscilloscope is a type of electronic test instrument that allows signal voltages to be viewed, usually as a two-dimensional graph of one or more electrical potential differences (vertical(Y) axis) plotted as a function of time or of some other voltage (horizontal(x) axis). Although an oscilloscope displays voltage on its vertical axis, any other quantity that can be converted to a voltage can be displayed as well. In most instances, oscilloscopes show events that repeat with either no change or change slowly. The oscilloscope is one of the most versatile and widely-used electronic instruments.

Figure 1: Traditional Oscilloscope Oscilloscopes are commonly used when it is desired to observe the exact wave shape of an electrical signal. In addition to the amplitude of the signal, an oscilloscope can show distortion and measure frequency, time between two events (such as pulse width or pulse rise time), and relative timing of two related signals. Some modern digital oscilloscopes can analyze and display the spectrum of a repetitive event The digital oscilloscope attempts to achieve the same functionality as a traditional oscilloscope, using a PIC microcontroller for data acquisition (including appropriate analogue circuitry) which transfers the data to the PC (via USB). A Microsoft Windows based software application will then display the waveform as it would appear on a traditional CRT oscilloscope. This software application will have additional features not present on a traditional oscilloscope (e.g. printing / saving waveforms) with greater flexibly as additional features can be added as their developed without the need for new hardware. Additional function is added in the circuitry such as MULTIMETER MODE which enables the PC-scope to measure the circuit parameters like capacitance, resistance, current and voltage of the required component. Digital oscilloscopes have two main advantages over traditional analogue scopes

1. The ability to observe slow and very slow signals as a solid presentation on the screen. Slow moving signals in the 10-100 Hz range are difficult to see and measure on a normal analogue oscilloscope due to the flicker of the trace and the short persistence of the spot on the screen. 2. The ability to hold or retain a signal in memory for long periods.

The PIC microcontroller has a built-in ADC (8, 10 or 12 bits) which has a voltage range of 0 to 5V. This voltage range is not ideal as most oscilloscopes have a much wider voltage range including negative voltages (e.g. -100 to 100V); hence an analogue circuit is requiredto reduce the voltage positive signals so they fall between 2.5 and 5V and voltage negative signals between 0 and 2.5V (i.e. bipolar). The built-in ADC on the PIC is slow and will limit the maximum sampling frequency; hence an external Flash ADC with direct memory access will be required to produce a highperformance digital storage oscilloscope (e.g. AD9070 10Bit, 100MSPS ADC)

CHAPTER-2 AIM AND SCOPE OF PROJECT


2.1:AIM OF THE PROJECT The main aim of the PC based is to improve the features of the oscilloscope. The circuit comprises of micro controller which has a USB 2.0-compliant transceiver and a CPU running up to 12MIPS. The digital oscilloscope attempts to achieve the same functionality as a traditional oscilloscope, using a PIC microcontroller for data acquisition (including appropriate analogue circuitry) which transfers the data to the PC (via USB). A Microsoft Windows based software application will then display the waveform as it would appear on a traditional CRT oscilloscope. This software application will have additional features not present on a traditional oscilloscope (e.g. printing / saving waveforms) with greater flexibly as additional features can be added as their developed without the need for new hardware.

2.2: SCOPE OF THE PROJECT: Additional function is added in the circuitry such as MULTIMETER MODE which enables the PC-scope to measure the circuit parameters like capacitance, resistance, current and voltage of the required component.The major advantage of this two-channel PC based oscilloscope is to drive the analogue-to-digital converters and an analogue input to a PIC micro controller.The major advantage of this twochannel PC based oscilloscope is to drive the analogue-to-digital converters and an analogue input to a PIC micro controller.

10

CHAPTER-3 DESCRIPTION OF HARDWARE COMPONENTS


3.1: RESISTORS A resistor is a two-terminalelectronic component that produces a voltage across its terminals that is proportional to the electric current passing through it in accordance with Ohm's law:

V = IR
Or X Y A Figure 2: Resistor symbol B

Resistors are elements of electrical networks and electronic circuits and are ubiquitous in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).

3.1.1: Fixed Resistors The primary characteristics of a resistor are the resistance, the tolerance, maximum working voltage and the power rating. Other characteristics include temperature coefficient, noise, and inductance. Less well-known is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is applied voltage. Critical resistance is determined by the design, materials and dimensions of the resistor. Thus if the characteristics are not varied then they are said to be fixed resistors. Resistors can be integrated into hybrid and printed circuits, as well as integrated circuits. Size, and position of leads (or terminals) are relevant to equipment designers; resistors must be physically large enough not to overheat when dissipating their power.
11

Figure 3:A typical axial resistor The electrical functionality of a resistor is specified by its resistance: common commercial resistors are manufactured over a range of more than nine orders of magnitude. When specifying that resistance in an electronic design, the required precision of the resistance may require attention to the manufacturing tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the resistance may also be of concern in some precision applications. Practical resistors are also specified as having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a particular circuit that is mainly concerned in power electronics applications. 3.1.2: Variable Resistors-Presets These are miniature versions of the standard variable resistor. They are designed to be mounted directly onto the circuit board and adjusted only when the circuit is built. For example: to set the frequency of an alarm tone. A small screwdriver or similar tool is required to adjust presets. Presets are much cheaper than standard variable resistors so they are sometimes used in projects where a standard variable resistor would normally be used. Multi-turn presets are used where very precise adjustments must be made. The screw must be turned many times (10+) to move the slider from one end of the track to the other, giving very fine control.

Figure 4: Preset Symbol


12

3.2: CAPACITORS A capacitor (formerly known as condenser) is a passive two-terminal electrical component used to store energy in an electric field. The forms of practical capacitors vary widely, but all contain at least two electrical conductors separated by a dielectric (insulator).

C Figure 5: Capacitor symbol Mainly used capacitors here are 1. Ceramic capacitor 2. Polyester capacitor 3. Electrolytic capacitor

3.2.1: Ceramic Capacitors In electronics, a ceramic capacitor is a capacitor constructed of alternating layers of metal and ceramic, with the ceramic material acting as the dielectric. The temperature coefficient depends on whether the dielectric is Class 1 or Class 2.A ceramic capacitor is a two-terminal non-polar device. The classical ceramic capacitor is the "disc capacitor". This device pre-dates the transistor and was used extensively in vacuum-tube equipment. A ceramic capacitor (especially the class 2) often has high dissipation factor, high frequency coefficient of dissipation.

Figure 6:Ceramic capacitors


13

3.2.2:Polyester Capacitors Polyester capacitors use a polyester dielectric and they are ideally suited to decoupling or bypass applications. In polyester capacitor has dielectric strength of 150% less than of 5 sec, and it has high quality and stable operating voltages.

Figure 7:Polyester capacitors 3.2.3:Electrolytic Capacitors An electrolytic capacitor is a type of capacitor that uses an electrolyte, an ionic conducting liquid, as one of its plates, to achieve a larger capacitance per unit volume than other types. They are often referred to in electronics usage simply as "electrolytics". They are used in relatively high-current and low-frequency electrical circuits, particularly in power supply filters, where they store charge needed to moderate output voltage and current fluctuations in rectifier output. They are also widely used as coupling capacitors in circuits where AC should be conducted but DC should not.

Figure 8:Electrolytic capacitors

3.3 USB 2.0 Universal Serial Bus (USB) is an industry standard developed in the mid-1990s that defines the cables, connectors and communications protocol used in a bus for
14

connection, communication and power supply between computers and electronic devices. USB was designed to standardize the connection of computer peripheralssuch as keyboards, pointing devices, digital cameras, printers, portable media players, disk drives and network adapters to personal computers, both to communicate and to supply electric power. It has become commonplace on other devices, such as smart phones, PDAs and video game consoles.USB has effectively replaced a variety of earlier interfaces, such as serial and parallel ports, as well as separatepower chargersfor portable devices. The USB 2.0 specification was released in April 2000 and was ratified by the USB Implementers Forum (USB-IF) at the end of 2001. Hewlett-Packard, Intel, Lucent Technologies(now Alcatel-Lucent), NEC and Philips jointly led the initiative to develop a higher data transfer rate, with the resulting specification achieving 480 Mbit/s, a fortyfold increase over the original USB 1.1 specification.USB 2.0 a popular version of USB developed to improve on the performance and reliability of older versions of the standard called USB 1.0 and USB 1.1 (together often referred to asUSB 1.x) USB 2.0 is also known as USB Hi-Speed.

Figure 9: USB Plug The B-style connector is designed for use on USB peripheral devices. The Bstyle interface is squarish in shape, and has slightly beveled corners on the top ends of the connector. Like the A connector, it uses the friction of the connector body to stay in place. The B-socket is an "upstream" connector that is only used on peripheral devices.

15

Figure 10: USB 2.0 Type-B Connector 3.4: Crystal Oscillator A crystal oscillator is an electronic oscillator circuit that uses the

mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio

transmittersandreceivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them became known as "crystal oscillators."

Figure 11: Symbol of crystal Oscillator Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion (2109) crystals are manufactured annually. Most are used for consumer devices such

as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.

16

CHAPTER-4 BLOCK DIAGRAM


4.1: BLOCK DIAGRAM OF THE PROJECT

Figure 12:Block diagram of the Two Channel PC based oscilloscope 4.2: FUNCTION GENERATOR The function generator is a device which generates the signals in required range of frequencies, voltages.

Figure13: Function generator


17

Internally it consists of an oscillator which generatesThe required signals are generated and given to the oscilloscope for the measurement purpose. The below figure shows the basic function generator

4.3: PROBES These are used for the connection purpose, between function generator and oscilloscope kit.

Figure14: connecting probe

4.4 MICROCONTROLLERS

Figure 15: Microcontrollers

4.4.1: Introduction to Microcontrollers Circumstances that user find ourselves in today in the field of microcontrollers had their beginnings in the development of technology of integrated circuits. This development has made it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for production of microprocessors, and the first
18

computers were made by adding external peripherals such as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted in creation of integrated circuits. These integrated circuits contained both processor and peripherals. That is how the first chip containing a microcomputer, or what would later be known as a microcontroller came about. Microprocessors and microcontrollers are widely used in embedded systems products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. The microcontroller used in this project is PIC16F877A. The PIC families of microcontrollers are developed by Microchip Technology Inc. Currently they are some of the most popular microcontrollers, selling over 120 million devices each year. There are basically four families of PIC microcontrollers: PIC12CXXX 12/14-bit program word PIC 16C5X 12-bit program word PIC16CXXX and PIC16FXXX 14-bit program word PIC17CXXX and PIC18CXXX 16-bit program word

4.4.2:Description 4.4.2.1:Introduction to PIC Microcontrollers PIC stands for Peripheral Interface Controller given by Microchip Technology to identify its single-chip microcontrollers. These devices have been very successful in 8-bit microcontrollers. The main reason is that Microchip Technology has continuously upgraded the device architecture and added needed peripherals to the microcontroller to suit customers' requirements. The development tools such as assembler and simulator are freely available on the internet at www.microchip.com.

Low - end PIC Architectures

19

Microchip PIC microcontrollers are available in various types. When PIC microcontroller MCU was first available from General Instruments in early 1980's, the microcontroller consisted of a simple processor executing 12-bit wide instructions with basic I/O functions. These devices are known as low-end architectures. They have limited program memory and are meant for applications requiring simple interface functions and small program & data memories. Some of the low-end device numbers are 12C5XX, 16C5X and 16C505.

Mid-range PIC Architectures Mid-range PIC architectures are built by upgrading low-end architectures with more number of peripherals, more number of registers and more data/program memory. Some are: 16C6X,16C7X and 16F87X. Program memory type is indicated by an alphabet. C = EPROM, F = Flash, RC = Mask ROM

4.4.2.2: Popularity of the PIC microcontrollers is due to the following factors 1. Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4 clock cycles. 2. Instruction set simplicity: The instruction set consists of just 35 instructions (as opposed to 111 instructions for 8051). 3. Power-on-reset and brown-out reset: Brown-out-reset means when the power supply goes below a specified voltage (say 4V), it causes PIC to reset; hence malfunction is avoided. A watch dog timer (user programmable) resets the processor if the software/program ever malfunctions and deviates from its normal operation. 4. PIC microcontroller has four optional clock sources. Low power crystal Mid-range crystal High range crystal RC oscillator (low cost).

5. Programmable timers and on-chip ADC.


20

6. Up to 12 independent interrupt sources. 7. EPROM/OTP/ROM/Flash memory option. 8. I/O port expansion capability . 4.4.3: CPU Architecture The CPU uses Harvard architecture with separate Program and Variable (data) memory interface. This facilitates instruction fetch and the operation on

data/accessing of variables simultaneously.The Architecture of PIC microcontroller is shown below: program 8 bits Program Data memory Register Special purpose registers CPU + Data memory

14 bits

13 bit

8 bits

14 bit

Figure 16: Architecture of PIC microcontroller

4.4.4: MicrocontrollerPIC18F2550 4.4.4.1: A Brief History of PIC18F2550 The original PIC was built to be used with General Instruments' new 16-bit CPU, the CP1600. While generally a good CPU, the CP1600 had poor I/O performance, and the 8-bit PIC was developed in 1975 to improve performance of the overall system by offloading I/O tasks from the CPU. The PIC used simple microcode stored in ROM to perform its tasks, and although the term was not used at the time, it shares some common features with RISC designs. In 1985, General Instruments spun off their microelectronics division and the new ownership cancelled almost everything which by this time was mostly out-ofdate. The PIC, however, was upgraded with internal EPROM to produce a programmable channel controller and today a huge variety of PICs are available with
21

various on-board peripherals (serial communication modules, UARTs, motor control kernels, etc.) and program memory from 256 words to 64k words and more (a "word" is one assembly language instruction, varying from 12, 14 or 16 bits depending on the specific PIC micro family). PIC and PIC micro are registered trademarks of Microchip Technology. It is generally thought that PIC stands for Peripheral Interface Controller, although General Instruments' original acronym for the initial PIC1640 and PIC1650 devices was "Programmable Interface Controller". The acronym was quickly replaced with "Programmable Intelligent Computer". 4.4.4.2: Introduction PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to "Peripheral 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. Microchip announced on February 2008 the shipment of its six billionth PIC processor. The 18F2550 is a microcontroller for more demanding applications having lots of program memory (16k) and RAM (2k) and a full USB interface- V2.0 Compliant (Low Speed (1.5 Mb/s) and Full Speed (12 Mb/s).

4.4.4.3:Features 10-bit, up to 13-channels Analog-to-Digital Converter module (A/D) with programmable acquisition time Two-Speed Oscillator Start-up Flexible Oscillator Structure Wide operating voltage range (2.0V to 5.5V 8 x 8 Single-Cycle Hardware Multiplier High-current sink/source 25 mA/25 mA

22

Dual oscillator options allow microcontroller and USB module to run at different clock speeds. Power-on Reset (POR), Power-up Timer (PWRT) and Oscillator Start-up Timer (OST). Watchdog Timer (WDT) In-Circuit Serial Programming TM (ICSPTM) via two pins. Full Speed USB 2.0 (12Mbit/s) interface 1K byte Dual Port RAM + 1K byte GP RAM. 16 Endpoints (IN/OUT) Consists of internal Pull Up resistors (D+/D-). Pin-to-pin compatible with PIC16C7X5

23

4.4.4.4: PIN Description

Figure 17: PIN Diagram of PIC18F2550

24

Table 1: Pin Description of PIC18F2550 Pin name 0 Digital I/O Yes Analog input No Pin on Chip 21

Other I2C I/O - SPI SDI I2C SCL SPI SCK Serial Tx Serial Rx SPI SDO PWM PWM -

Microchip name

RB0/AN12/INT0/FLT0/SDI/SDA

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes

No No No No Yes Yes Yes

22 23 24 25 26 27 28 17 18 11 12 13 2 3 4

RB1/AN10/INT1/SCK/SCL RB2/AN8/INT2/VMO RB3/AN9/CCP2/VPO RB4/AN11/KBI0 RB5/KBI1/PGM RB6/KBI2/PGC RB7/KBI3/PGD RC6/TX/CK RC7/RX/DT/SDO RC0/T1OSO/T13CK RC1/T1OSI/CCP2/UOE RC2/CCP1 RA0/AN0 RA1/AN1 RA2/AN2/VREF-/CVREF

25

16 17 Run USB+ USBVusb Reset Vdd (5V) Vss (GND) Vss (GND) OSC1 OSC2

Yes Yes Output only -

Yes Yes -

Run USB USB USB Reset switch -

5 7 6 16 15 14 1 20

RA3/AN3/VREF+ RA5/AN4/SS/HLVDIN/C2OU RA4/T0CKI/C1OUT/RCV RC5/D+/VP RC4/D-/VM VUSB MCLR/VPP/RE3 Vdd

Vss

Quartz Quartz

19 9 10

Vss OSC1/CLKI OSC2/CLKO/RA6

VSS, VDD: Supply voltages. I/O Port Depending on the device selected and featuresenabled, there are up to five ports available. Some pinsof the I/O ports are multiplexed with an alternatefunction from the peripheral features on the device. Ingeneral, when a peripheral is enabled, that pin may notbe used as a general purpose I/O pin.Each port has three registers for its operation. Theseregisters are TRIS register (data direction register)
26

PORT register (reads the levels on the pins of thedevice) LAT register (output latch) The Data Latch register (LATA) is useful for readmodify-write operations on the value driven by the I/Opins.

PortA PortA is an 8-bit wide, bidirectional port. The correspondingdata direction register is TRISA. Setting aTRISA bit (= 1) will make the corresponding PortA pinan input. Clearing a TRISA bit (= 0) willmake the corresponding PortA pin an.Reading the PortA register reads the status of thepins; writing to it will write to the port latch.

PortB PortB is an 8-bit wide, bidirectional port. The correspondingdata direction register is TRISB. Setting aTRISB bit (= 1) will make the corresponding PortBpin an input. Clearing a TRISB bit (= 0) will make the corresponding PortB pin an output. Each of the PortB pins has a weak internal pull-up. Asingle control bit can turn on all the pull-ups.

PortC PortC is a 7-bit wide, bidirectional port. The correspondingdata direction register is TRISC. Setting aTRISC bit (= 1) will make the corresponding PortCpin an input. Clearing a TRISC bit (= 0) will make the corresponding PortC pin an output. PortC is primarily multiplexed with serial communicationmodules, including the EUSART, MSSP moduleand the USB module. Except for RC4 andRC5, PortC uses Schmitt Trigger input buffers.

PortE PortE is a 4-bit wide port.Three pins (RE0/AN5/CK1SPP,

RE1/AN6/CK2SPPand RE2/AN7/OESPP) are individually configurable asinputs or outputs. These pins have Schmitt Trigger input buffers. When selected as an analog input, thesepins will read as 0s.
27

Memories There are three types of memory in PIC18F2550 enhancedmicrocontroller devices: Program Memory Data RAM Data EEPROM As Harvard architecture devices, the data and programmemories use separate busses; this allows for concurrentaccess of the two memory spaces. The dataEEPROM, for practical purposes, can be regarded asa peripheral device, since it is addressed and accessedthrough a set of control registers.

4.5 MCP6S91 4.5.1 Description The Microchip Technology Inc. MCP6S91/2/3 isanalog Programmable Gain Amplifiers (PGAs). Theycan be configured for gains from +1 V/V to +32 V/V andthe input multiplexer can select one of up to two channelsthrough a SPI port. The serial interface can alsoput the PGA into shutdown to conserve power. These PGAs are optimized for high-speed, low offset voltageand single-supply operation with rail-to-rail input andoutput capability. These specifications support singlesupplyapplications needing flexible performance ormultiple inputs.The one-channel MCP6S91 and the two-channelMCP6S92 are available in 8-pin PDIP, SOIC and MSOPpackages. The two-channel MCP6S93 is available in a10-pin MSOP package. All parts are fully specified from-40C to +125C.

28

4.5.2: PIN Configuration of MCP6S91


VOUT CH0 VREF VSS

1 2 3 4 MCP6S91

8 7 6 5

VDD SCK SI CS

Figure 17: Top view of MCP6S91 Table 2: PIN Description of MCP6S91 PIN Name VOUT CH0,CH1 VREF VSS CS SI SO SCK VDD Function Analog output Analog inputs External reference pin Negative power supply Chip select Serial data input Serial data output Clock input Positive power supply

4.5.3:Features Multiplexed Inputs: 1 or 2 channels. 8 Gain Selections: o +1, +2, +4, +5, +8, +10, +16 or +32 V/V Serial Peripheral Interface (SPI). Rail-to-Rail Input and Output. Low Gain Error: 1% (max).
29

Offset Mismatch Between Channels: 0 V. High Bandwidth: 1 to 18 MHz (typ). Low Noise: 10 nV/Hz @ 10 kHz (typ). Low Supply Current: 1.0 mA (typ). Single Supply: 2.5V to 5.5V. Extended Temperature Range: -40C to +125C.

4.5.4: Applications A/D Converter Driver. Multiplexed Analog Applications. Data Acquisition. Industrial Instrumentation. Test Equipment. Medical Instrumentation.

4.6: LF353 4.6.1: Description This IC has two operational amplifiers. Op-Amp A is used as Voltage Shifting Amplifier. Op-Amp B is used as Voltage Followers. TheLF353isaJFETinputoperationalamplifierwith internallycompensatedinputoffsetvoltage.TheJFETinput deviceprovideswidebandwidth,lowinputbiascurrents and offsetcurrents. 4.6.2: PIN CONFIGURATION OF LF353
OUT1 IN1 (-) IN1 (+) VEE

an

1 2 3 4 LF353

8 7 6 5

VCC OUT2 IN2 (-) IN2 (+)

Figure 19: Top view of LF353


30

Figure 20: 8-pin DIP

Table 3: Absolute maximum ratings PARAMETER Power supply voltage Differential input voltage Input voltage range Output short circuit duration Power dissipation Operating temperature range SYMBOL Vcc VI(diff) VI Pd Topr VALUE 18 30 15 Continuous 500 0 to +70 UNIT V V V mW C

4.6.3:Features
Internally trimmed offset voltage: 10mV Low input bias current: 50pA Wide gain bandwidth: 4MHz High slew rate: 13V/s High Input impedance: 1012

4.6.4:Applications High speed integrators. Digital to analog converters. Sample and hold circuits.
31

4.7:ICL7660 4.7.1:Description The MAX1044 and ICL7660 is monolithic, CMOS switched-capacitor voltage converters that invert, double, divide, or multiply a positive input voltage. They arepin compatible with the industry-standard ICL7660 andLTC1044. Operation is guaranteed from 1.5V to 10V withno external diode over the full temperature range. Theydeliver 10mA with a 0.5V output drop. The MAX1044 has a BOOST pin that raises the oscillator frequencyabove the audio band and reduces external capacitorsize requirements. The MAX1044/ICL7660combines low quiescent currentand high efficiency. Oscillator control circuitry and four power MOSFET switches are included on-chip. 4.7.2: PIN configuration of ICL7660

Figure21: Top view of ICL7660

Figure22: 8 PIN Dip The ICL7660 performs supply voltage conversions from positive to negative for an input range of +1.5V to +10.0V resulting in complementary output voltages of 32

1.5V to -10.0V.Only 2 noncritical external capacitors are needed for the charge pump and charge reservoir functions. The ICL7660 and ICL7660A can also be connected to function as voltage doublers and will generate output voltages up to +18.6V with a +10V input. The oscillator, when unloaded, oscillates at a nominal frequencyof 10 kHz for an input supply voltage of 5.0V. This frequencycan be lowered by the addition of an externalcapacitor to the OSC terminal, or the oscillator may beoverdriven by an external clock.The LV terminal may be tied to GROUND to bypass theinternal series regulator and improve low voltage (LV) operation.At medium to high voltages (+3.5V to +10.0V for theICL7660 and +3.5V to +12.0V for the ICL7660A), the LV pinis left floating to prevent device latch up. Table 4: Absolute maximum ratings Parameter Supply voltage Supply current Operating temperature Oscillator frequency Power efficiency Symbol V+ I+ TA Fosc Pef Value of ICL7660 10.5 500 -55 to 125 10 98 Unit V A C KHz %

4.7.3: Features Simple conversion of +5v logic supply to 5v supplies. Typical power efficiency of 98%. Wide operating voltage range. Easy to use requires only two external non-critical passive components.

4.7.4:Applications On board negative supply for dynamic RAMs. Dataacquisition systems. Inexpensive negative supplies.

CHAPTER-5
33

OPERATION OF THE CIRCUIT

5.1: COMPONENTS USED IN PC BASED OSCILLOSCOPE

Hardware components Resistors Capacitors 1. Ceramic 2. Polyester 3. Electrolytic ICs 1. Voltage converters 2. Dual operational amplifiers : ICL7660 : LF353 : (2.7pF -2, 68nF -4, 150nF -1) : (0.022F-1) : (10F -1,47F -1) : (1M -2, 82K -2, 33K -2, 220K -2, 150K -2, 1K -2, 4.7K -2)

3. Programmable gain amplifiers : MCP6S91 4. Micro controller Crystal Oscillator USB : PIC18F2550 : 4MHz : Type-B socket, Cable

5.2: CIRCUIT DIAGRAM


34

Figure 23: Circuit Diagram for PC Based Oscilloscope

5.3: OPERATION
35

Theheart

ofthis

oscilloscope

is

USB2.0-compliant

microcontroller

PIC18F2550 from Microchip.You canalso use PIC18F2445 in place of PIC18F2550. ThismicrocontrollerhasaUSB2.0-complianttransceiverandaCPUrunning up to 12 MIPS. MCP6S91 is an analogue programmable gain amplifier that is well suited to driving analogue to digital convertors (ADCS) and an analogue input to a PIC microcontroller. To MCP6S91 programmable gain amplifiers (IC2&IC3) make it possible to choose the input ranges for each of the two channels, by selecting a gain from 1:1 to 32:1. And the amplifiers are small, cheap and easy to use. A simple three wire serial peripheral interface (SPI) allows the PIC to control them through its pins 5, 6, 7. TheMCP6S91amplifierisdesigned exhibitphaseinversion when the with input CMOSinputdevices. pins exceed the It isdesignedtonot voltages. The

supply

maximumvoltage thatcanbeappliedtotheinputpinis0.3V (VSS) to +0.3V (VDD). Input voltages that exceed the absolute maximum rating can cause excessive current into or out of the output pins .current beyond +/-2 mA can cause reliability problems. Applications that exceed this rating must be externally limited with a resistor to the input pin. Vref(pin 3), which is ananalogue input,shouldbeatavoltagebetween V SS and VDD. The voltageatthispin shifts theoutputvoltage. The SPIinterface inputs are chip-select (CS), serial input (SI) and serial clock (SCK). These areSchmitt-triggered, CMOS logic inputs. Theonlydisadvantageisthatthese amplifiersacceptonlypositivesignals. Thats

whyvoltage-shifting amplifiersLF353(IC4Aand IC5A) are used, one each for each channel input.The LF353 isaJFET inputoperational amplifierwith aninternally

compensated inputoffset voltage. The JFET input deviceprovideswideband- width, lo winputbias currentsand offset currents.This voltage-shiftingamplifier resultsinahigh input impedance and anattenuationfactorof1:4.5. A16V input signal isthen shiftedtothe5Vrange when theprogrammed gain is 1:1. Two halves of the LF353(IC4BandIC5B)are used asvoltagefollowersto provide a low-impedance shifting voltage (Vref) totheprogrammableamplifiers. This voltage must beprecisely adjustedwithtwo4.7-kilo- ohm presets to measure precisely 2.5V level on theinputsofIC2andIC3 whentheinputsignalsare grounded. Because LF353 op-ampsneedasymmetrical supply voltage, a small DC-DC
36

voltageconverter ICL7660 (IC6) is used to feed 5V to LF353. With its small 8-pin DIP package, it needs onlytwo polarized capacitors. ICL7660 can bereplaced with aMAX1044. The MAX1044 and ICL7660 are monolithic,CMOS switched-capacitor volt- age converters that invert, double divide or multiply a positive input voltage. These are pin compatiblewith the industry-standard LTC1044. All the data is transmitted on the D+/D- symmetrical pins using a variable bit rate. The position of a resistor (R13) on D+ or D- allows you to choose between the full-speed (12 Mbps) and lowspeed modes (1.5 Mbps). Note that the IC18F2550/2455 devices have built-in pull-up resistors designed to meet the requirements of low-speed and fullspeed USB. The UPUEN bit (UCFG=4) enables the internal pull-ups. In this project, R13 is not used. External pullup may also be used. The VUSB pin may be used to pull up D+ or D-. The pull-up resistor must be 1.5 kilo-ohms (5%) as required by the USB specification

5.3.1: PIC Software The program for the microcontrolleris written in C language. MPLAB7.31 along with MPLAB_C18 is usedas the software tool for development. Ifeverything is fine, plug the oscilloscopewith a USB cable to your PC (runningWindows 98SE or higher version). ANew hardware detectedUSB2-MiniOscilloscopedialogue box must immediate appear on the screen. Now in you can start Basic the 6, driver called

installationprocess.User-interface

softwarewritten

Visual

OscilloPIC,is given torun the set up program from theSetup files. Now by running the OscilloPIC we can obtain the results.

5.4:EXPERIMENTAL RESULTS By running the OscilloPIC, the application program looks like asmall digital oscilloscope as shownin the screenshot below.Various settings for operationsare given in the following menubars: 1. Inputs: Selects the activechannels. 2. Sampling: Sets time-base andnumber of samples. 3. Trigger: Sets the triggeringCondition. 4. Cursors: Selects horizontal orvertical cursor positions. 5. Num: Shows numericalsampled values, with an exportcommand (text file format).
37

6. Config: Configures gain andoffset errors Calibration is to be done asdescribed below before readingthe output signals on the monitorscreen by clicking channels calibrationunder Config menu bar.Feed the input waveforms (say,sine, rectangular, saw tooth, etc)from the source. Click go button. The output waveform will bedisplayed on the monitor screen.Channel-1 and channel-2 outputwaveforms can be differentiated bygreen and red lines, respectively.By default, the time base is 200 sper division and amplitude is 4Vper division. You can set these parametersas per your requirements.

Test and calibration The firststep is to adjust the zero offset error. Connect the two analogue inputs tothe ground level and tune the two 4.7kilo-ohm presets until pin 2 of bothMCP6S21 is at 2.5V. A more precisetuning can be achieved through OscilloPICsoftware. Choose the smallestcalibration value at 0.5V for both theinputs.The zero calibrationcommand tells the PICto start its own internalcompensation for all calibrations.Dont forget toconnect the inputs to theground while calibrating.The second parameterto check is the gain error.By clicking the gain calibrationcommand, itspossible to specify a smallcorrection factor. Thiscan be done after

severalmeasurements. You haveto know the actual levelsand the measured levels (with the cursors)for the two channels. The gain erroris less than 0.1 per cent. The numberof samples can be set between 10 and500. The minimum sampl ing rate is5 s for one channel and 10 s for two channels.

38

Figure 24: Output waveforms on a PC

39

Figure 25: Overview of project kit

5.5:ADVANTAGES Lighter more portable. Signals can be stored and processed later. No need of additional power supply for PCB. The ability to observe slow and very slow signals as a solid presentation on the screen. The PCBO has a very interactive GUI making it more convenient to use than conventional oscilloscopes. The circuit is extremely cheap and easy to make.

5.6:DISADVANTAGES It can effectively process the signals up to 10 KHz. Limited to serial communication.
40

5.7:APPLICATIONS Monitoring of sound waves, which are difficult to monitor on a traditional oscilloscope due to the low frequencies involved. Monitoring of serial communications. Because of the low cost of the PC based oscilloscope, it is economical for a school / technical college to have large quantities available for students. In radar systems. Medical sector.

41

CHAPTER-6 CONCLUSION AND FUTURE SCOPE

6.1:CONCLUSION The PC based is to improve the features of the oscilloscope. The circuit comprises of micro controller which has a USB 2.0-compliant transceiver and a CPU running up to 12MIPS.The oscilloscope uses IC PIC18F2550 from Microchip as the main controller, which makes the oscilloscope compact as there is no need of additional power supply for the entire circuit board. Thus we conclude that the conventional oscilloscope can be replaced with the PC based oscilloscope.

6.2: FUTURE SCOPE The performance of the oscilloscope can be improved by changing the PIC and its ADC with a faster model. AD9238 (20 MS/s) is a good choice. This fast, parallel ADC converter could be used with a powerful DSP PIC. A PIC18Fx455 could be used for its USB link. This two channel pc based oscilloscope is extended to multi channel pc based oscilloscope.

42

REFERENCES
[1] Basic electronic module [2] D. Roy Chowdary, Shail B. Jain, Linear Integrated circuits new age international (p) LTD, 2nd Edition 2003. [3] S.Salivahanan, Electronics devices and circuits, Tata McGraw-hill publishing company LTD, NEWDELHI-110008, 2000

REFERENCES ON WEB

[1] www.electronicsforu.com [2] www.wikipedia.com [3] www.alldatasheets.com

43

44

You might also like