Introduction to Newbie Programmer Series Introduction to Computer The Computer Programming Language Setting up the Computer for Programming
 Lets Get Started !
Beginning C Programming Variables a Handbag ! Basic Variable types in C Basic Formatted Output Basic Formatted Input
Looping Repeating Concept Different Kinds of Loops Advanced concepts and trick with Loops
Operators, An Introduction Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Miscellaneous Operators and Operators Precedence
 Controlling the Flow
Flow Charts Conditional Statements Using Goto and Label Break and Continue the loops Switch the Cases Some Practical Applications of Control Flow
 The program structure
The program Structure Functions More Concepts of Functions Scope of the Variables across functions How the C language itself Works ? Scope of the Variables across files Static Variables Auto and Register Variables #define PreProcessor Some more PreProcessors
 Arrays and Structures
Introduction to Arrays Arrays, some more Concepts Arrays, Cool Examples Structures Introduction Structure, Some more Concepts Structure, Some Examples
 File Management
Basics of File management in C Steps Involved with File Handling in C
Inside Logic Gates – The Electronic Logic Binary Number System Mathematical Reasoning
Newbie Programmer
full book coming soon
by Shubham Ramdeo

How does electronic gadgets really have logic working in themselves ?

Its been so long I have written an article out of the Newbie Programmer Series. But somehow this is one of its part. I was about to write on using logic operators but I found that before diving into the usage of logic, we have to learn how logic works in electronic world.

Introduction to electronic logic

You have somewhere heard of Logic Gates. These are nothing but specially designed circuits that allow the circuit designers to use logic. Below, I am giving a simple layout of these gates just to show how they work. The actual circuits are complicated but I tend to keep everything simple on my site.

What do you need ?

It's not a hard thing to understand how logic works in electronic circuits. All you need is to imagine the following things :

  1. A battery
  2. Some wires
  3. Some switches
  4. Some bulbs
  5. For digitalness, We say '1' if bulb is on, and '0' if bulb is off.

The Logic of 'on' and 'off'

As said above, for a computer, on means 1 and off means 0. You can understand this easily with the below diagram.
If bulb glows 1, if bulb doesn't glow then 0

Logic of on and off, 1 and 0, based on bulb glows or not.

The electronic Logic Gates

What you have learned above is a simple one. Just on and off. But we need to use the special compound logic like AND OR NOT. Lets discuss them one by one.

AND logic

 If you are using AND logic between two conditions, the AND logic says that to proceed further, both the conditions must be true.  You can understand this with the pic below. It's like to make the bulb 'glow', both the switches must be 'on'.
If A is on, B is also on, the bulb glows

The AND logic. Both A and B switches must be on, =1 to make the bulb glow.

You can see that when both A and B switches are on then only the process of glowing the bulb proceeds.

The Digital USE of AND:

If A = 1, and B is also = 1, then Z = 1. if any one of A or B is 0, Z = 0. You can check this by the AND Formula : A x B.

OR logic

If you are using OR logic between two conditions, the OR logic says that to proceed further, at least one of the conditions must be true. You can understand this with the pic below. It's like to make the bulb 'glow', at least one of the switches either A or B must be on.
Either or both of A and B 'on' the bulb glows

The OR logic. Either A or B or Both should be 'on' '1' to make the bulb glow

You can see that Z should be connected to either A or B or both. But in AND gate you have to connect both, here one is enough.

The Digital USE of OR:

Use OR formula : A + B, only when both A = 0, B = 0, Z = 0. Otherwise whenever atleast one of A or B is 1, A+B=Z becomes 1.

NOT logic

If you are using NOT logic, the NOT logic says that to proceed further, the condition must NOT TRUE. You can understand this with the pic below. It's like to make the bulb 'glow', the switch A must not be 'on'.
when A is off bulb goes on. This logic gives reverse of 1 and 0

The NOT logic. When A is 'on' bulb goes 'off'

You can see that if the Z switch is on, circuit will get shorted and bulb will not glow.

The Digital USE of NOT:

Its simple. Reverse of A. When A is off, Bulb is on. So If A = 0, Z becomes 1. Otherwise if A is 1, Z is 0. So Z is reverse of A. (simple ???)

These were basic circuits. Circuit designers connect them together to make more complicated logic. But to keep it simple so I think that's enough. You can search for XOR, NOR, NAND gates which are nothing but using NOT gates together with the other gates. You can make your own logic. Stay connected for more.

Please share this as much as you can so that we can get connected with more and more people who want to learn programming.

© Shubham Ramdeo

Site Map
© Shubham Ramdeo