You are on page 1of 29

Before going to enter into the project firstly we have to know about the Simulation :

SIMULATION: Simulation is a tool used to predict the behaviors of the system.They are different types of system Simulation. In Weather system Simulation used to predict the Weather and in Mechanical System to predict the behavior of the Aircraft in flight. Inlay it doesnt exit in physical form.

Electronic circuit simulation is a specialized area where the simulation engine, in the form of digital computer software, uses mathematical models to replicate the behavior of an actual electronic device or circuit.

The Basis of Electronic Circuit Simulators:

The most well-known circuit simulators (of type analog, event driven, or VSM) are based on a simulation engine known as SPICE. SPICE stands for Simulation Program with Integrated Circuit Emphasis developed at the Electronics Laboratory of the University of California,Berkeley,by Laurence Negel in 1980s. SPICE is a general-purpose circuit simulation program for nonlinear dc, nonlinear transient, and linear ac analyses. Circuits may contain resistors, capacitors, inductors, mutual inductors, independent voltage and current sources, four types of dependent sources These programs provide the GUI (Graphical User Interface) , but use the basic vers.ion of SPICE simulation engine to perform all the circuit calculations. SPICE3F5 or PROSPICE is the most recent versions of SPICE.

Circuit Description in SPICE:

The circuit to be analyzed is described to SPICE by a set of element lines, which define the circuit topology and element values The first line in the input file must be the title, and the last line must be ".END". Each element in the circuit is specified by an element line The first letter of the element name specifies the element type. floating point number followed by one of the following scale factors: T = 1012; G = 109; Meg = 106; K = 103; mil = 25.46; m = 103; u (0or ) = 106; n = 109; p = 1012; f = 1015

Device Models of SPICE:

General form of device models is .MODEL MNAME



MNAME in the above is the model name. The following model names are fifteen types.
Example: .MODEL MOD1 NPN (BF=50 IS=1E-13 VBF=50)

SPICE Sub-circuits:
There is no limit on the size or complexity of sub-circuits, and sub-circuits may contain other sub-circuits.

Modern circuit simulators include both analog and eventdriven digital simulation capabilities, and are known as mixed-mode simulators. Simulating the circuit of an embedded system by means of computer software requires a special concern. This is because an embedded computing system contains not only the system board

necessary other components), but also the software code (may include user application, boot ROM, device drivers, operating system, and various libraries used to implement the software functions) running on the system board.
Virtual system modeling (VSM) is often the term coined for circuit simulation of embedded and other microcomputer systems.

General form of the sub-circuit line is .SUBCKT SUBNAM N1 <N2 N3 ...>. A circuit definition is begun with a .SUBCKT line. SUBNAM is the subcircuit name, and N1, N2, ... are the external nodes, which cannot be zero.
The group of element lines which immediately follow the .SUBCKT line define the sub-circuit. The last line in a sub-circuit definition is the .ENDS line. Example:


Sub-circuits are used in SPICE by specifying pseudo-elements beginning with the letter X, General form of subcircuit calls is XYYYYYYY N1 <N2 N3 ...> SUBNAM Example X1 2 4 17 3 1 MULTI General form of INCLUDE lines is .INCLUDE filename Example: .INCLUDE /users/spice/common/wattmeter.cir

Models Using SPICE for VSM:

A SPICE model is an ASCII net list file. Whilst SPICE3F5 has many features not supported by PSPICE, PSPICE has some primitive types that are different, and also uses a different syntax for some of the newer things that have been added to both products.

Types of Circuit Simulation in Virtual System Modeling (VSM):

VSM can be used in two rather distinct ways either for Interactive Simulation or from Graph Based simulation Interactive simulation is used to see whether a circuit design basically works or not the graph based simulation is used to troubleshoot or to take very detailed measurements.

Interactive Simulation:
Animation Control Panel

It is used in VSM tools to perform interactive simulation.

It Consists of PLAY , STEP, PAUSE & STOP

The PLAY button is used to start the simulator.

The PAUSE button suspends the animation The STOP button tells the simulator engine (e.g., PROSPICE) to stop doing a real time simulation.

The STEP button allows the user to step through the animation at a defined rate.

The following points are necessary to setting up an interactive simulation in VSM tools:

The user needs to pick the required components from the device libraries Placing the components on the schematic
Editing the components in order to assign appropriate values and properties
Attaching the source code (.ASM file) as well as the object code (.HEX file) to the microprocessor/microcontroller objects on the schematic.

Wiring the circuit components on the schematic

Deleting and moving the components from the schematic Running the simulation by clicking the PLAY button on the Animation Control Panel

VSM tools may contain other animation effects

Virtual Instruments:
A variety of virtual instruments are normally provided in VSM device libraries to perform interactive simulation. These include Voltmeters and Ammeters, Oscilloscope, Logic Analyser, Signal Generator, Digital Pattern Generator, etc.

A brief description of these virtual instruments is given here under. Voltmeters and Ammeters Oscilloscope
VSM tools normally supply standard Oscilloscope

The oscilloscope can operate in 3 modes, indicated as follows:

Single Beam - neither Dual nor X- Y LEDs are lit In this mode, the Chi and Ch2 LEDs indicate which channel is being displayed Dual Beam - the Dual LED is lit. In this mode, the Chi and Ch2 LEDs indicate which channel is being used for triggering X-Y mode - the X-Y LED is lit

Logic Analyser:
A logic analyser operates by continuously recording incoming digital data into a large capture buffer The schematic of virtual Logic Analyser supplied with a typical VSM tool is as shown below:

Signal Generator:
Square, saw-tooth, triangle and sine output waveforms Output frequency range from 0-12MHz in 8 ranges

Digital Pattern Generator: A virtual digital pattern generator is the digital equivalent of the analog signal generator.

Graph Based Simulation:

Graph based simulation is also the only way to perform analyses which do not take place in real time at all Graph based simulation involves five main stages. These are summarized below: Entering the circuit to be simulated

Placing signal generators at points that require stimulus and test probes at points that user wish to inspect
Placing a graph corresponding with the type of the analysis to perform e .g. frequency graph to display a frequency analysis.

Adding the signal generators and test probes to the graph in order to display the data they generate / record.
Setting up the simulation parameters (such as the runtime) and executing the simulation.

Types of Analysis:
A variety of graphs are normally provided with VSM tools, each one of which displays the results of a different type of circuit analysis Analogue Transient Analysis: An analog graph plots voltages, and/or currents against time, much like an oscilloscope. For example, a current can be multiplied by a voltage to give a plot of instantaneous power. This mode of analysis is often referred to as Transient Analysis. Digital Transient Analysis: A digital graph plots logic levels against time, much like a logic analyser. Digital transient analysis is computed using a technique know as Event Driven Simulation.

Mixed Mode Transient Analysis:

A mixed mode graph combines both analogue and digital signals on the same graph Mixed mode transient analysis combines both the Non-Linear Nodal Analysis of SPICE3F5 with the Event Driven Simulation of DSIM.
Iteration round this loop continues until a steady state is found, or until the iteration limit is reached

Frequency Analysis:
Frequency analysis plots small signal voltage or current gains against frequency. This is also known as a Bode plot, and both magnitude and phase can be displayed.

DC Sweep Analysis:
A DC Sweep curve shows the steady state voltage (or current) levels of the probed points around the circuit, as the swept variable is increased

In a DC sweep analysis PROSPICE will repeatedly find the operating point of the circuit, incrementing the swept variable between calculations.

AC Sweep Analysis:
This type of analysis creates a family of frequency response curves for different values of a swept variable.

DC Transfer Curve Analysis:

This graph type is specifically designed for producing characteristic curve families for semiconductor devices, although it occasionally finds other applications. Method of computation for this analysis is very similar to the computation for a DC Sweep analysis except that two values can be swept.

Noise Analysis:
A noise graph plots input or output noise voltages against frequency The SPICE simulator engine can model the thermal noise generated in resistors and semiconductor devices. For this reason, there is the option to display them in dBs.

Distortion Analysis:
Distortion analysis determines the level of distortion harmonics produced by the circuit under test. These can be either the 2nd and 3rd harmonics of a single fundamental or the inter modulation products of two test signals.

Fourier Analysis:
Fourier analysis is the process of transforming time domain data into to the frequency domain Fourier analyses are created by first executing a Transient Analysis and then performing a Fast Fourier Transform (FFT) on the resulting data. This process involves discrete time sampling of the time domain data with the result that the use Nyquist sampling criterion applies.

Audio Analysis:
Audio analyses are performed in exactly the same way as for Transient Analysis except that after simulation Data is re-sampled at one of the standard PC sampling rates (11025, 22050 or 44100 Hz) then written out in audio file format using the standard Windows functions provided for this purpose.

Interactive Analysis:
The Interactive Analysis type combines the advantages of interactive and graph based simulation. This analysis is especially useful in examining what happens when a particular control is operated in a design.

Digital Conformance Analysis:

The method of computation is identical to that for a digital transient analysis, except that two sets of results can be stored in the graph

DC Operating Point Analysis:

This is an analysis type for which there is no corresponding graph. It is possible to compute the operating point without a graph. In this case, an attempt may be made to simulate the entire schematic as one partition

Working with VSM Tools:

A few Virtual System Modeling (VSM) tools that can simulate the circuit behavior of embedded systems or other microcomputer systems are available in recent times. In this project Labcenter Electronics Proteus VSM is used to simulate a couple of exemplary embedded system circuits. An overview and features of this tool is discussed now.

Proteus VSM:
Proteus VSM is the latest and popular Virtual System Modeling (VSM) tool developed by Lab center Electronics. It combines mixed mode circuit simulation, animated components and microprocessor models to form a system that can simulate complete microcontroller based designs. Using this tool it is possible to develop and test such designs before a physical prototype is constructed.

Proteus VSM uses ISIS schematic capture software to provide the environment for design entry and development
The heart of Proteus VSM is PROSPICE. As with ISIS, PROSPICE is an established product that uses a SPICE3f5 analogue simulator kernel together with fast event-driven digital simulator to provide seamless mixed-mode simulation

Exemplary Applications:
To demonstrate how embedded system circuits can be simulated and verified using

commercial Virtual System Modeling tool, (Labcenter Electronics Proteus VSM)

Two exemplary applications are considered. The first one being an LCD Display Driver using 8051 microcontroller The second one is a Traffic Lights Embedded System using PIC16F84A.

The details of the schematic entry, wiring of components, attaching source code the processors, simulation process and the results of simulation are presented for these two applications in the following sections.

LCD Display Driver Using 8051 Microcontroller:

This exemplary application demonstrates how an 8051 can be used to

drive a standard alphanumeric LCD display.

Circuit Schematic:
The schematic of the circuit to be constructed for the application LCD DISPLAY DRIVER USING 8051 MICROCONTROLLER is shown below. The circuit consists of an 80C51 microcontroller, (4 kB ROM, 128B RAM, 48-bit I/O, 316-bit Timers) 202 Alphanumeric LCD (LM032) display, 74LS373 latch, 1.2 MHz Crystal Clock, 33pF capacitors (2 Nos.) NAND gate.

Circuit Schematic Entry

Proteus VSM program is launched, and a new design sheet is opened by selecting New Design from the File menu. Devices are placed on the design sheet from Proteus VSM library by clicking on Pick Devices button and selecting the particular device. Various pins of the devices are carefully wired according to the circuit schematic shown above using Wire Mode and Bus Mode wiring tools.

Writing the Program

Source Listing: The source code for a particular target processor can be written in assembly language using a standard text editor and can be saved with an extension .ASM.

Source Code:
Attaching the Source Files The next stage is to attach the program to our design in order that we can successfully simulate its behavior. We do this through the commands on the Source Menu. Go to the Source Menu now and select the Add/Remove Source Files Command. Click on the New button, browse until you reach the directory where you placed the source code file and select that file. Click open and the file should appear in the Source Code Filename drop down list box.

To attach the file to the processor, right click on the schematic part for the processor and then left click on the part. This will bring up the Edit Component dialogue form which contains a field for Program File.

Simulating the Circuit:

Results of the Simulation After the PLAY button of the Animation Control Panel is pressed, the Proteus VSM starts simulating the behavior of the circuit. The LCD device is initialized first and then displays the characters LCD DISPLAY DRIVER and USING 8051 PROCESSOR in two lines. After the above two lines are displayed for a moment, the display is cleared and the text RAJESH & RAMESH and USIG & DSD 2010 are displayed on the LCD panel

Traffic Lights Embedded System Using PIC16F84A:

This exemplary application demonstrates how traffic lights embedded system can be constructed using PIC16F84A microcontroller. The system consists of two traffic light objects with three coloured lights each, namely, red, amber and green. The system has four states (designated states 0 to 3): Circuit Schematic

State 0: traffic light 1 is lit green and traffic light 2 is lit red. State 1: traffic light 1 is lit amber and traffic light 2 is lit red and amber State 2: traffic light 1 is lit red and traffic light 2 is lit green State 3: traffic light 1 is lit red and amber, and traffic light 2 is lit amber

Circuit Schematic Entry Writing the Program Source Code Attaching the Source Files Simulating the Circuit

Results of the Simulation:

After the PLAY button of the Animation Control Panel is pressed, the Proteus VSM starts : simulating the behavior of the circuit.

After the processor is initialized, traffic lights are setup to state 0. In this state traffic light 1 is lit green while traffic light 2 is lit red. After a preset delay the traffic lights are driven to state 1. In this state traffic light 1 is lit amber while traffic light 2 is lit both red and amber. After the preset delay the traffic lights are driven to state 2. In this state traffic light 1 is lit red while traffic light 2 is lit green. Finally, the traffic lights are driven to state 3 after the preset delay. In this state traffic light 1 is lit both red and amber while traffic light 2 is lit amber.

The states 0 through 3 are cycled repeatedly until the user stops simulation by pressing the stop button of the animation control panel.