Вы находитесь на странице: 1из 60

DIGITAL CIRCUIT SIMULATOR

1. ABSTRACT
We have successfully developed the software for fulfilling the process of simulation on digital circuits including AND, OR gates simulation. Digital Circuit Simulator is one of the Electronics software products to focus specifically on the needs of Educational users. Simulation and Analysis: It has ability to quickly simulate and analyse your design within the same workspace. And you dont have to generate net lists to pre-define test points or probes to run the Simulation. Digital Circuit Simulator offers the following standard and advanced analyses:
Construction, Simulation and testing of simple digital circuits. Builds the relevant waveforms of both input and output. Basic logic gates o o o o o o

AND gates OR Gates NOT Gates NOR Gates NAND Gates XOR Gates

The Digital Circuit Simulator allows the user to select the components desired and place it anywhere on the workspace provided. Further the user can rig up the circuit and test its values at all the input and output points. The objective here is to design a Digital Circuit Simulator which has the capability to allow the user to rig up digital circuits, simulate them, debug

and verify the output. The tools used to implement this project are Visual Studio. It is compatible on Microsoft Operating system.

In the Digital Circuit maker kit we have the following features.


Six Basic gates; And, OR, NOT, XOR, NAND, NOR with different number of

inputs.
Enables the user to check the states of the circuit at various points. Enables the user to check the states of the circuit at any given time by

adding or deleting the components as and when required.


Provides a real time simulation of the digital circuits. The relevant waveforms are also made available for the user.

2. INTRODUCTION
Our software deals with simulation of logic gates. Simulation of logic gates performs the job of understanding the working of logic gates and their propagation. These circuits are made up of logic gates as they form the base for any logic circuit design. If the logic gates are not connected properly then an error shall arise. Even the smallest error occurred will drastically affect the overall working of the hardware. It becomes very difficult to find such kinds of error in such a complicated circuit. Once we find out the error it again becomes complicated for the tester to rectify the error. The process of rectifying this error is time consuming and there is wastage of money .Wastage of money arises due redesigning of buggy circuit. The recognition of need is the first step in developing the software. First step towards the solution is defining the problem. This needs the preliminary survey about the current system and what are the drawbacks of the current system and whether an alternative system can solve the problem or not. If the problem is serious enough then management needs to have an analyst to look at it. Such an assignment implies a commitment specially the analyst is hired from outside wherever necessary to analyze the problem and prepare the reports for the problem. To overcome the above problems we decided of designing a Logic Gate Simulators we shall reduce the time and money problems and will also reduce the human efforts. We deal with all logic gates like AND, OR, NOT, NAND, NOR, XOR.

OVERVIEW OF GATES

(1) AND gate (2) OR gate (3) NOT gate These gates are called as the basic logic gates. By using combination these gates we create NAND, NOR,XOR.

(1) AND gate:

A logic AND gate is a type of digital logic gate that has an output which is normally at logic level "0" and only goes "HIGH" to a logic level "1" when all of its inputs are at logic level "1". The output of a logic AND only returns "LOW" again when any of its inputs are at a logic level "0". The logic or Boolean expression given for a logic AND gate is that for Logical Multiplication which is denoted by a single dot or full stop symbol, (.)

Symbol B 0 0 1 1

Truth Table A 0 1 0 1 Q 0 0 0 1

(2)

OR gate

A logic OR gate is a type of digital logic gate that has an output which is normally at logic level "0" and only goes "HIGH" to a logic level "1" when any of its inputs are at logic level "1". The output of an OR only returns "LOW" again when all of its inputs are at a logic level "0". The logic or Boolean expression given for a logic OR gate is that for Logical Addition which is denoted by a plus sign, (+)
Symbol B 0 0 1 1 Truth Table A 0 1 0 1 Q 0 1 1 1

(3)

NOT gate
The digital logic NOT gate is the most basic of all the logical gates and is sometimes referred to as an Inverting Buffer or simply a Digital Inverter. It is a single input device which has an output level that is normally at logic level "1" and goes "LOW" to a logic level "0" when its single input is at logic level "1", in other words it "inverts" (complements) its input signal. The output from a NOT gate only returns "HIGH" again when its input is at logic level "0".

Symbol A 0 1

Truth Table Q 1 0

2.1.

OBJECTIVE Earlier, there were no effective mechanism to illustrate the working

of a gate or a circuit digitization. So we proposed to have a proper mode of solving this problem to make the process more effective and efficient. Digital logic circuits and its logic gates are not directly visible to our eyes until and unless a system is there to express the working of it. So we decided to have an objective of simulating those gates and logic circuit

2.2.

SCOPE OF SYSTEM This document covers the whole definition of the simulation project.

It basically includes the basic logic gates and their simulation. More specifically, our software (simulating gates) controls and manages the circuitry working of all the possible gates and their combination. In addition to manipulating the software, we could even have the scope of making it applicable for more complex types of circuits using these gates. We could easily understand the inner working of the gates and its circuits.

2.3.

ADVANTAGES & LIMITATIONS

2.3.1. Advantages

Represent each logic gates via simulation. Almost all combination of the circuits are simulated. Understanding simulation. Can be taken as a live propagation of digital signal through gates.
2.3.2. Disadvantages

the

digital

logic

circuits

by

simple

Cannot represent more complex type of circuits.

3. LITERATURE SURVEY

A logic gate performs a logical operation on one or more logic inputs and produces a single logic output. The logic normally performed is Boolean logic and is most commonly found in digital circuits. Logic gates are primarily implemented electronically using diodes or transistors, but can also be constructed using electromagnetic relays, optics, molecules, or even mechanical elements. In electronic logic, a logic level is represented by a voltage or current, (which depends on the type of electronic logic in use). Each logic gate requires power so that it can source and sink currents to achieve the correct output voltage. In logic circuit diagrams the power is not shown, but in a full electronic schematic, power connections are required. This program allows you to simulate simple circuit of logic gates on the screen. The gates and the wires connecting them are chosen from the toolbox of icons at the left end side of the pages and then by clicking on the appropriate symbol user can use that gate for creating circuit.

Why simulation performed?

With simulation we here mainly refer to what is called dynamic (or discrete events) stochastic simulation. Stochastic implies that one can take uncertainty and risk into account. Dynamic implies the ability to follow processes in detail over time. This kind of simulation often requires many runs in order that one should be able to draw conclusions. We here want to give the main reasons for our belief that such computer simulation is becoming an increasingly more important method. This is the extremely rapid development of computer technology. The development appears to follow what is called Moore's law: For a computer of a given price, there is a doubling in speed and capacity almost every 18 months. This implies in turn that in two decades computers become a thousand times more powerful. One can hence afford many runs. While simulation was often earlier regarded as a method of last resort, it is now rather the first alternative method to try.

Advantages of simulation:

One of the primary advantages of simulators is that they are able to provide users with practical feedback when designing real world systems. This allows the designer to determine the correctness and efficiency of a design before the system is actually constructed. Consequently, the user may explore the merits of alternative designs without actually physically building the systems. By investigating the effects of specific design decisions during the design phase rather than the construction phase, the overall cost of building the system diminishes significantly. As an example, consider the design and fabrication of integrated circuits. During the design phase, the designer is presented with a myriad of decisions regarding such things as the placement of components and the routing of the connecting wires. It would be very costly to actually fabricate all of the potential designs as a means of evaluating their respective performance. Through the use of a simulator, however, the user may investigate the relative superiority of each design without actually fabricating the circuits themselves. By mimicking the behavior of the designs, the circuit simulator is able to provide the designer with information pertaining to the correctness and efficiency of alternate designs. After carefully weighing the ramifications of each design, the best circuit may then be fabricated.

Another benefit of simulators is that they permit system designers to study a problem at several different levels of abstraction. By approaching a system at a higher level of abstraction, the designer is better able to understand the behaviors and interactions of all the high level components within the system and is therefore better equipped to counteract the complexity of the overall system. This complexity may simply overwhelm the designer if the problem had been approached from a lower level. As the designer better understands the operation of the higher level components through the use of the simulator, the lower level components may then be designed and subsequently simulated for verification and performance evaluation. The entire system may be built based upon this ``top-down'' technique. This approach is often referred to as hierarchical decomposition and is essential in any design tool and simulator which deals with the construction of complex systems. For example, with respect to circuits, it is often useful to think of a microprocessor in terms of its registers, arithmetic logic units, multiplexors and control units.

A simulator which permits the construction, interconnection and subsequent simulation of these higher level entities is much more useful than a simulator which only lets the designer build and connects simple logic gates. Working at a higher level abstraction also facilitates rapid prototyping in which preliminary systems are designed quickly for the purpose of studying the feasibility and practicality of the high-level design.

3.1. 3.2.

OPERATING SYSTEM INSIGHT INTO C#

The ECMA standard lists these design goals for C#

C# language is intended to be a simple, modern, general-purpose, objectoriented programming language. The language, and implementations thereof, should provide support for software engineering principles such as strong type checking, array bounds checking, detection of attempts to use uninitialized variables, and automatic garbage collection. Software robustness, durability, and programmer productivity are important. The language is intended for use in developing software components suitable for deployment in distributed environments. Source code portability is very important, as is programmer portability, especially for those programmers already familiar with C and C++. Support for internationalization is very important. C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions. Although C# applications are intended to be economical with regard to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language.

By design, C# is the programming language that most directly reflects the underlying Common Language Infrastructure (CLI). Most of its intrinsic types correspond to value-types implemented by the CLI framework. However, the language specification does not state the code generation requirements of the compiler: that is, it does not state that a C# compiler must target a Common Language Runtime, or generate Common Intermediate Language (CIL), or generate any other specific format. Theoretically, a C# compiler could generate machine code like traditional compilers of C++ or Fortran.
Some notable distinguishing features of C# are:

There are no global variables or functions. All methods and members must be declared within classes. Static members of public classes can substitute for global variables and functions. Local variables cannot shadow variables of the enclosing block, unlike C and C++. Variable shadowing is often considered confusing by C++ texts. C# supports a strict Boolean data type, bool. Statements that take conditions, such as while and if, require an expression of a type that implements the true operator, such as the boolean type. While C++ also has a Boolean type, it can be freely converted to and from integers, and expressions such as if(a) require only that a is convertible to bool, allowing a to be an int, or a pointer. C# disallows this "integer meaning true or false" approach on the grounds that forcing programmers to use expressions that return exactly bool can prevent certain types of common programming mistakes in C or C++ such as if (a = b) (use of assignment = instead of equality ==). In C#, memory address pointers can only be used within blocks specifically marked as unsafe, and programs with unsafe code need appropriate permissions to run. Most object access is done through safe object references, which always either point to a "live" object or have the well-

defined null value; it is impossible to obtain a reference to a "dead" object (one which has been garbage collected), or to a random block of memory. An unsafe pointer can point to an instance of a value-type, array, string, or a block of memory allocated on a stack. Code that is not marked as unsafe can still store and manipulate pointers through the System. IntPtr type, but it cannot dereference them.

Managed memory cannot be explicitly freed; instead, it is automatically garbage collected. Garbage collection addresses the problem of memory leaks by freeing the programmer of responsibility for releasing memory which is no longer needed. In addition to the try...catch construct to handle exceptions, C# has a try...finally construct to guarantee execution of the code in the finally block. Multiple inheritance is not supported, although a class can implement any number of interfaces. This was a design decision by the language's lead architect to avoid complication and simplify architectural requirements throughout CLI. C# is more type safe than C++. The only implicit conversions by default are those which are considered safe, such as widening of integers. This is enforced at compile-time, during JIT, and, in some cases, at runtime. There are no implicit conversions between Boolean and integers, nor between enumeration members and integers (except for literal 0, which can be implicitly converted to any enumerated type). Any user-defined conversion must be explicitly marked as explicit or implicit, unlike C++ copy constructors and conversion operators, which are both implicit by default. Enumeration members are placed in their own scope. C# provides properties as syntactic sugar for a common pattern in which a pair of methods, accessor (getter) and mutator (setter) encapsulate operations on a single attribute of a class.

Full type reflection and discovery is available. C# currently (as of version 4.0) has 77 reserved words. Checked exceptions are not present in C# (in contrast to Java). This has been a conscious decision based on the issues of scalability and version ability.

Features of .NET Language Interoperability : XML is used to exchange information common VSIDF to all .NET language. Intermediate language: We can generate IL code by using any of the following languages. VC++,VB.NET,C#.NET,JavaScript. Other IL languages plug into the VSIDE (cobol, perl, small talk). Next Generation Window Service It is run time environment that manages the execution code. Benefits of NGWS Cross language integration (through the CLS) Automatic memory management (garbage collection) Cross language exception handling Enhanced security (including type safety) Versioning support Simplified model for component Interaction (SOAP protocol)

Types Of Application

The NGWS will be applicable in: Console application Windows application Web application Windows controls Web controls Windows service Web service Components

Advantages of .NET

Cross Language Interoperability: That is it can support more than 25 languages in .NET. so we can create our project in preferred language and execute that project. . NET is said as language independent. Cross Language Exceptions : In this Exceptions are given to each project and we can execute that exception using .NET. Pre-defined Exceptions: .NET provides many predefined exceptions for easy usage of users. The common Language Runtime (CLR) A runtime is an environment in which programs are executed.

The Common Language Runtime is therefore the environment in which we run out .NET applications that have been compiled to a common language, namely Microsoft Intermediate Language (MSIL), often referred to simply IL. Runtimes have been around even longer than DOS, but the Common Language Runtime (CLR) is as advanced over traditional runtimes as a light build is over a candle.
Cross-Language Integration

The CLR enables managed code written in one language to seamlessly integrate with code written in another language. This includes cross-language inheritance, exception handling and marshalling.

Enhanced Security

The CLR enables managed code to declare the security they require and the gathering of evidence used to evaluate whether or not permission is granted.
Versioning and deployment support

The CLR supports side-by-side execution of multiple versions of the same component, even within the same process.
Debugging and profiling services

The CLR provides the necessary hooks to enable developers to debug and profile managed code. For example, developer tools have the ability to walk the stack of a managed code application, regardless of what language or languages the application was written in.
Memory Management

The GC (Garbage Collector) is responsible for collection objects no longer referenced by the application. The CLR gets MSIL (intermediate language) as input and it compiles into the machine level language. For that it uses the JIT (Just In

Time) compilers.
Working of .NET

A Program that is written in .net is executed using the following mechanism: PROGRAM----*IL CODE----*CLR----*MACHINE CODE The code written by us is transferred into an intermediate language code and that is passed as an input to the common language run time (similar to JVM in java) that in turn makes the IL code into an executable code using the JIT compilers.

4. SYSTEM REQUIREMENT SPECIFICATION


Software Requirements Specification (SRS) is the starting point of the software development activity. Little importance was given to this phases in the early days of software development. The emphasis was first on coding and then shifted to design. As systems grew more complex, it become evident that the goal of the entire system cannot be easily comprehended. Hence need for the requirements analysis phase arose. Now, for large software systems, requirements analysis is perhaps the most difficult activity and also the most error prone. Some of the difficulty is due to the scope of this phase. The software project is imitated by the client needs. In the beginning these needs are in the minds of various people in the client organization. The requirement analyst has to identify the requirements by talking to these people and understanding their needs. In situations where the software is to automate a currently manual process, most of the needs can be understood by observing the current practice. The SRS is a means of translating the ideas in the minds of the clients (the output) into formal document (the output of the requirements phase). Thus the output of the phase is a set of formally specified requirements, which hopefully are complete and consistent, while the input has none of these properties.

4.1.

DATA FLOW DIAGRAM

A data-flow diagram (DFD) is a graphical representation of the "flow" of data through an information system. DFDs can also be used for the visualization of data processing (structured design). On a DFD, data items flow from an external data source or an internal data store to an internal data store or an external data sink, via an internal process. A DFD provides no information about the timing or ordering of processes, or about whether processes will operate in sequence or in parallel. It is therefore quite different from a flowchart, which shows the flow of control through an algorithm, allowing a reader to determine what operations will be performed, in what order, and under what

circumstances, but not what kinds of data will be input to and output from the system, nor where the data will come from and go to, nor where the data will be stored (all of which are shown on a DFD). A two-dimensional diagram that explains how data is processed and transferred in a system. The graphical depiction identifies each source of data and how it interacts with other data sources to reach a common output. Individuals seeking to draft a data flow diagram must (1) identify external inputs and outputs, (2) determine how the inputs and outputs relate to each other, and (3) explain with graphics how these connections relate and what they result in.
Advantages of DFDs

a simple but powerful graphic technique which is easily understood. represents an information system from the viewpoint of data movements, which includes the inputs and outputs to which people can readily relate. the ability to represent the system at different levels of details gives added advantage (you can include the advantages of decomposition listed earlier) helps to define the boundaries of the system. a useful tool to use during interviews. serve to identify the information services the users require, on the basis of which the future information system will be constructed.

Context level:

LEVEL 1:

LEVEL 1.1

4.1. HARDWARE REQUIREMENTS Processor: Dual Core processor RAM: 2GB Ram HDD: 100 GB 4.2. SOFTWARE REQUIREMENTS

Operating System: MS Windows XP/win 7/8 Platform: Visual Basic.Net, .NET framework 3.5

5. SYSTEM DESIGN DOCUMENT

5.1. 5.2.

MODULE DESIGN USER INTERFACE

5.3.

I/O DESIGN

5.3.1. INPUT DESIGN

(1)

AND gate

(2)

EXNOR gate

(3)

XOR gate

(4)

NAND gate

(5)

NOR gate

(6)

NOT gate

(7)OR gate

5.3.2. OUTPUT DESIGN

(1)

Logic gate simulator

(2)

Logic circuit simulator

5.4.

PROCEDURAL DESIGN

6. CODE
Logic gate.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace LogicGates { public partial class Form1 : Form { bool and, or, xor, not = true, nand = true, nor = true, xnor = true; Image on, off; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { on = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); off = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); OnOff(); //webBrowser1.Navigate(Application.StartupPath + "\\LogicGates.html"); } private void OnOff() { picAnd.Image = (and ? on : off); picOr.Image = (or ? on : off); picXor.Image = (xor ? on : off);

picNot.Image = (not ? on : off); picNand.Image = (nand ? on : off); picNor.Image = (nor ? on : off); picXnor.Image = (xnor ? on : off); } private void CheckAnd() { and = ((btnAnd1.Text == "ON" && btnAnd2.Text == "ON") ? true : false); OnOff(); } private void CheckOr() { or = ((btnOr1.Text == "ON" || btnOr2.Text == "ON") ? true : false); OnOff(); } private void CheckXor() { xor = ((btnXor1.Text == "ON" ^ btnXor2.Text == "ON") ? true : false); OnOff(); } private void CheckNot() { not = ((btnNot.Text == "ON") ? false : true); OnOff(); } private void CheckNand() { nand = ((btnNand1.Text == "ON" && btnNand2.Text == "ON") ? false : true); OnOff(); } private void CheckNor() { nor = ((btnNor1.Text == "ON" || btnNor2.Text == "ON") ? false : true); OnOff(); } private void CheckXnor() {

xnor = ((btnXnor1.Text == "ON" && btnXnor2.Text == "ON") || (btnXnor1.Text == "OFF" && btnXnor2.Text == "OFF") ? true : false); OnOff(); } private void btnAnd1_Click(object sender, EventArgs e) { btnAnd1.Text = (btnAnd1.Text == "ON" ? "OFF" : "ON"); CheckAnd(); } private void btnAnd2_Click(object sender, EventArgs e) { btnAnd2.Text = (btnAnd2.Text == "ON" ? "OFF" : "ON"); CheckAnd(); } private void btnOr1_Click(object sender, EventArgs e) { btnOr1.Text = (btnOr1.Text == "ON" ? "OFF" : "ON"); CheckOr(); } private void btnOr2_Click(object sender, EventArgs e) { btnOr2.Text = (btnOr2.Text == "ON" ? "OFF" : "ON"); CheckOr(); } private void btnXor1_Click(object sender, EventArgs e) { btnXor1.Text = (btnXor1.Text == "ON" ? "OFF" : "ON"); CheckXor(); } private void btnXor2_Click(object sender, EventArgs e) { btnXor2.Text = (btnXor2.Text == "ON" ? "OFF" : "ON"); CheckXor(); } private void btnNot_Click(object sender, EventArgs e) { btnNot.Text = (btnNot.Text == "ON" ? "OFF" : "ON"); CheckNot();

} private void btnNand1_Click(object sender, EventArgs e) { btnNand1.Text = (btnNand1.Text == "ON" ? "OFF" : "ON"); CheckNand(); } private void btnNand2_Click(object sender, EventArgs e) { btnNand2.Text = (btnNand2.Text == "ON" ? "OFF" : "ON"); CheckNand(); } private void btnNor1_Click(object sender, EventArgs e) { btnNor1.Text = (btnNor1.Text == "ON" ? "OFF" : "ON"); CheckNor(); } private void btnNor2_Click(object sender, EventArgs e) { btnNor2.Text = (btnNor2.Text == "ON" ? "OFF" : "ON"); CheckNor(); } private void btnXnor1_Click(object sender, EventArgs e) { btnXnor1.Text = (btnXnor1.Text == "ON" ? "OFF" : "ON"); CheckXnor(); } private void btnXnor2_Click(object sender, EventArgs e) { btnXnor2.Text = (btnXnor2.Text == "ON" ? "OFF" : "ON"); CheckXnor(); } private void picNor_Click(object sender, EventArgs e) { } private void btn_circuit_simulate_Click(object sender, EventArgs e) {

var sample = new Form2(); sample.Show(); } } }

LogicCircuit.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LogicGates { public partial class Form2 : Form { Boolean gate1_out, gate2_out; public Form2() { InitializeComponent(); } private void Form2_Load(object sender, EventArgs e) { switch1.CheckState = CheckState.Unchecked; switch2.CheckState = CheckState.Unchecked; switch3.CheckState = CheckState.Unchecked; switch4.CheckState = CheckState.Unchecked; switch1.Visible = false; switch2.Visible = false; switch3.Visible = false;

switch4.Visible = false; imgGate1.Visible = false; imgGate2.Visible = false; imgGate3.Visible = false; progressBar1.Visible = false; progressBar2.Visible = false; progressBar3.Visible = false; progressBar4.Visible = false; imgline1.Visible = false; imgline2.Visible = false; imgBulb.Visible = false; progressBar1.Value = 100; progressBar2.Value = 100; //do{ // progressBar1 .Value =progressBar1 .Value +1; // //if(progressBar1 .Value //}while(progressBar1 .Value >100); } private void pictureBox1_Click(object sender, EventArgs e) { imgGate1.Image = LogicGates.Properties.Resources.and; } private void progressBar1_Click(object sender, EventArgs e) { } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (cmbgate1.SelectedItem.ToString() == "AND") { imgGate1.Image = LogicGates.Properties.Resources.and; switch1.Visible = true; switch2.Visible = true; imgGate1.Visible = true; } else if (cmbgate1.SelectedItem.ToString() == "OR") { imgGate1.Image = LogicGates.Properties.Resources.or; switch1.Visible = true; switch2.Visible = true; imgGate1.Visible = true;

} else if (cmbgate1.SelectedItem.ToString() == "NOT") { imgGate1.Image = LogicGates.Properties.Resources.not ; switch1.Visible = true; //switch1.Location .Y(switch1.Location.Y.ToString + 10); switch2.Visible = false ; imgGate1.Visible = true; } else if (cmbgate1.SelectedItem.ToString() == "NAND") { imgGate1.Image = LogicGates.Properties.Resources.nand ; switch1.Visible = true; switch2.Visible = true; imgGate1.Visible = true; } else if (cmbgate1.SelectedItem.ToString() == "NOR") { imgGate1.Image = LogicGates.Properties.Resources.nor ; switch1.Visible = true; switch2.Visible = true; imgGate1.Visible = true; } else if (cmbgate1.SelectedItem.ToString() == "XOR") { imgGate1.Image = LogicGates.Properties.Resources.exor ; switch1.Visible = true; switch2.Visible = true; imgGate1.Visible = true; } else if (cmbgate1.SelectedItem.ToString() == "XNOR") { imgGate1.Image = LogicGates.Properties.Resources.exnor; switch1.Visible = true; switch2.Visible = true; imgGate1.Visible = true; } enable_voltageflow(); } private void switch1_CheckedChanged(object sender, EventArgs e) { if (switch1.CheckState == CheckState.Checked) { switch1.Text = "HIGH";

check_circuit(); } else if (switch1.CheckState == CheckState.Unchecked ) { switch1.Text = "LOW"; check_circuit(); } } private void switch2_CheckedChanged(object sender, EventArgs e) { if (switch2.CheckState == CheckState.Checked) { switch2.Text = "HIGH"; check_circuit(); } else if (switch2.CheckState == CheckState.Unchecked ) { switch2.Text = "LOW"; check_circuit(); } } private void switch3_CheckedChanged(object sender, EventArgs e) { if (switch3.CheckState == CheckState.Checked) { switch3.Text = "HIGH"; check_circuit(); } else if (switch3.CheckState == CheckState.Unchecked ) { switch3.Text = "LOW"; check_circuit(); } } private void switch4_CheckedChanged(object sender, EventArgs e) { if (switch4.CheckState == CheckState.Checked) { switch4.Text = "HIGH"; check_circuit(); } else if (switch4.CheckState == CheckState.Unchecked )

{ switch4.Text = "LOW"; check_circuit(); } } private void cmbgate2_SelectedIndexChanged(object sender, EventArgs e) { if (cmbgate2.SelectedItem.ToString() == "AND") { imgGate2.Image = LogicGates.Properties.Resources.and; switch3.Visible = true; switch4.Visible = true; imgGate2.Visible = true; } else if (cmbgate2.SelectedItem.ToString() == "OR") { imgGate2.Image = LogicGates.Properties.Resources.or; switch3.Visible = true; switch4.Visible = true; imgGate2.Visible = true; } else if (cmbgate2.SelectedItem.ToString() == "NOT") { imgGate2.Image = LogicGates.Properties.Resources.not; switch3.Visible = true; switch4.Visible = false ; imgGate2.Visible = true; } else if (cmbgate2.SelectedItem.ToString() == "NAND") { imgGate2.Image = LogicGates.Properties.Resources.nand; switch3.Visible = true; switch4.Visible = true; imgGate2.Visible = true; } else if (cmbgate2.SelectedItem.ToString() == "NOR") { imgGate2.Image = LogicGates.Properties.Resources.nor; switch3.Visible = true; switch4.Visible = true; imgGate2.Visible = true; } else if (cmbgate2.SelectedItem.ToString() == "XOR") {

imgGate2.Image = LogicGates.Properties.Resources.exor; switch3.Visible = true; switch4.Visible = true; imgGate2.Visible = true; } else if (cmbgate2.SelectedItem.ToString() == "XNOR") { imgGate2.Image = LogicGates.Properties.Resources.exnor; switch3.Visible = true; switch4.Visible = true; imgGate2.Visible = true; } enable_voltageflow(); } private void enable_voltageflow() { if ((imgGate1 .Visible==true )&& (imgGate2 .Visible ==true) &&(imgGate3 .Visible ==true)) { progressBar1.Visible = true; progressBar2.Visible = true; progressBar3.Visible = true; progressBar4.Visible = true; imgline1.Visible = true; imgline2.Visible = true; imgBulb.Visible = true; check_circuit(); } } private void cmbgate3_SelectedIndexChanged(object sender, EventArgs e) { if (cmbgate3.SelectedItem.ToString() == "AND") { imgGate3.Image = LogicGates.Properties.Resources.and; //switch3.Visible = true; //switch4.Visible = true; imgGate3.Visible = true; } else if (cmbgate3.SelectedItem.ToString() == "OR") { imgGate3.Image = LogicGates.Properties.Resources.or; //switch3.Visible = true; //switch4.Visible = true;

imgGate3.Visible = true; } else if (cmbgate3.SelectedItem.ToString() == "NOT") { imgGate3.Image = LogicGates.Properties.Resources.not; //switch3.Visible = true; //switch4.Visible = true; imgGate3.Visible = true; } else if (cmbgate3.SelectedItem.ToString() == "NAND") { imgGate3.Image = LogicGates.Properties.Resources.nand; //switch3.Visible = true; //switch4.Visible = true; imgGate3.Visible = true; } else if (cmbgate3.SelectedItem.ToString() == "NOR") { imgGate3.Image = LogicGates.Properties.Resources.nor; //switch3.Visible = true; //switch4.Visible = true; imgGate3.Visible = true; } else if (cmbgate3.SelectedItem.ToString() == "XOR") { imgGate3.Image = LogicGates.Properties.Resources.exor; //switch3.Visible = true; //switch4.Visible = true; imgGate3.Visible = true; } else if (cmbgate3.SelectedItem.ToString() == "XNOR") { imgGate3.Image = LogicGates.Properties.Resources.exnor; //switch3.Visible = true; //switch4.Visible = true; imgGate3.Visible = true; } enable_voltageflow(); } private void check_circuit() { if ((cmbgate1.SelectedItem.ToString() == "AND")) {

if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Checked )) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Checked ) && (switch2.CheckState == CheckState.Checked ))

{ progressBar1.Style = ProgressBarStyle.Marquee ; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee ; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21 ; gate1_out = true; } } else if (cmbgate1.SelectedItem.ToString() == "OR") { if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; }

else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } } else if (cmbgate1.SelectedItem.ToString() == "NOT") { if (switch1.Checked) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else

{ progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } } else if (cmbgate1.SelectedItem.ToString() == "NAND") { if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Unchecked))

{ progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } } else if (cmbgate1.SelectedItem.ToString() == "NOR") { if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; }

else if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } } else if (cmbgate1.SelectedItem.ToString() == "XOR") {

if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Checked)) {

progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } } else if (cmbgate1.SelectedItem.ToString() == "XNOR") { if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Unchecked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } else if ((switch1.CheckState == CheckState.Unchecked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Unchecked)) {

progressBar1.Style = ProgressBarStyle.Continuous; progressBar1.MarqueeAnimationSpeed = 0; progressBar1.Value = 0; progressBar3.Style = ProgressBarStyle.Continuous; progressBar3.MarqueeAnimationSpeed = 0; progressBar3.Value = 0; imgline1.Image = LogicGates.Properties.Resources.line_off; gate1_out = false; } else if ((switch1.CheckState == CheckState.Checked) && (switch2.CheckState == CheckState.Checked)) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 30; progressBar1.Value = 100; progressBar3.Style = ProgressBarStyle.Marquee; progressBar3.MarqueeAnimationSpeed = 30; progressBar3.Value = 100; imgline1.Image = LogicGates.Properties.Resources.line21; gate1_out = true; } } //*************************************************second gate ********************************************** //****************************************************************************** ***************************** if (cmbgate2.SelectedItem.ToString() == "AND") { if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0;

progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21;

gate2_out = true ; } } else if (cmbgate2.SelectedItem.ToString() == "OR") { if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21;

gate2_out = true; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } } else if (cmbgate2.SelectedItem.ToString() == "NOT") { if (switch3.Checked) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; }

} else if (cmbgate2.SelectedItem.ToString() == "NAND") { if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } else if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true;

} else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } } else if (cmbgate2.SelectedItem.ToString() == "NOR") { if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true;

} else if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0;

progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } } else if (cmbgate2.SelectedItem.ToString() == "XOR") { if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0;

progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off;

gate2_out = false; } } else if (cmbgate2.SelectedItem.ToString() == "XNOR") { if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } else if ((switch3.CheckState == CheckState.Unchecked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0; imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Unchecked)) { progressBar2.Style = ProgressBarStyle.Continuous; progressBar2.MarqueeAnimationSpeed = 0; progressBar2.Value = 0; progressBar4.Style = ProgressBarStyle.Continuous; progressBar4.MarqueeAnimationSpeed = 0; progressBar4.Value = 0;

imgline2.Image = LogicGates.Properties.Resources.line_off; gate2_out = false; } else if ((switch3.CheckState == CheckState.Checked) && (switch4.CheckState == CheckState.Checked)) { progressBar2.Style = ProgressBarStyle.Marquee; progressBar2.MarqueeAnimationSpeed = 30; progressBar2.Value = 100; progressBar4.Style = ProgressBarStyle.Marquee; progressBar4.MarqueeAnimationSpeed = 30; progressBar4.Value = 100; imgline2.Image = LogicGates.Properties.Resources.line21; gate2_out = true; } } if (cmbgate3.SelectedItem.ToString() == "AND") { if ((gate1_out == false) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb .Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == false) && (gate2_out == true )) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == true ) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } }

else if (cmbgate3.SelectedItem.ToString() == "OR") { if ((gate1_out == false) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == false) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } } else if (cmbgate3.SelectedItem.ToString() == "NAND") { if ((gate1_out == false) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == false) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == false)) { imgBulb.Visible = true;

imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } } else if (cmbgate3.SelectedItem.ToString() == "NOR") { if ((gate1_out == false) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == false) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } } else if (cmbgate3.SelectedItem.ToString() == "XOR") { if ((gate1_out == false) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); }

else if ((gate1_out == false) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } } else if (cmbgate3.SelectedItem.ToString() == "XNOR") { if ((gate1_out == false) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); } else if ((gate1_out == false) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == false)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\offbulb.jpg"); } else if ((gate1_out == true) && (gate2_out == true)) { imgBulb.Visible = true; imgBulb.Image = Image.FromFile(Application.StartupPath + "\\onbulb.jpg"); }

} } } }

7. CONCLUSION
We conclude that our automated software always performed well in simulation of the logic gates as well as their propagation. And it is always responsive to any of the further services. It can be further enhanced with additional simulations done.

8. FUTURE SCOPE
Our project deals with digital logic gates and their circuits. Our software can be widely used to simulate the propagation of flow of signals within different combination of these gates. By simulation of logic gates we could easily understand the inner working of each. Our software has a future scope that it can be future enhanced to simulate more complex circuits. We could even deal with more number of transmission channels in future.

9. BIBLIOGRAPHY Web references


www.scribd.com/doc/3499130/Logic_Gates www.facstaff.bucknell.edu/mastascu/.../Logic/Logic1.html en.wikipedia.org/wiki/Logic gate

Book references

Вам также может понравиться