### BINARY LOGIC & LOGIC GATES

In this post we will look few basic concepts of logic gates. Before going into it, first we should know what is mean by Binary Logic i.e zero '0' logic and logic '1' .

### BINARY LOGIC:

As we know that computer only understand zero's and one's. What actually mean by this? Here zero or one are the representation of the 'low level voltage' and 'high level voltage' . Logic 1 is the high level voltage i.e 3-5v and Logic 0 is the low level voltage i.e 0v in terms of microcontroller (TTL logic). In CMOS logic representation of 'logic1' is  around 9v and 'logic0' is  0v.

So, when we say 0 or 1 it purely means that low voltage and high voltage respectively.

• When we say that register X stored with 01111000 , it means each bit represents each logic level i.e when 0 means 0v is stored in it and 1 means 5v stored in it.
• When we say that register X is stored with 55H (hexadecimal) value, then it simply means register is stored with 01010101 (55h after conversion to binary). Registers dont know which value have been stored but they only concern whether it is 0v or 5v.
Note: Registers are the storage elements whose storage capacity is depended on the number of bits(just say boxes) it have. For example if its an eight bit register then it can store upto 8 boxes i.e each box can have value 1 or 0 i.e high or low voltage level.Maximum value it can store is all 1's i.e 11111111 i.e decimal 255.

### LOGIC GATES:

Now let us look at few important gates and its operation with example. Note that i'm not going to explain all the gates , i just touch few of them whose operation is more frequently used in programming.

AND GATE:

Any of of the input is zero then the output will be zero. Look at the symbol and truth table below

Simply remember AND as multiplication (x) 0x0 = 0 , 0x1 = 0, 1x0 = 0, 1x1 = 1.

Example: Perform AND operation on 10101110 , 11100101

10101110
11100101
---------------
10100100
---------------

OR GATE:

If any one of the input is 1 then the output will be 1.

Simply remember OR operation as addition(+) without carry i.e 0+0=0, 0+1=1, 1+0=1, 1+1=1(without carry)

Example: Perform OR operation on 10101110 , 11100101

10101110
11100101
---------------
11101111
---------------

XOR GATE:

When both the inputs are equal then output will be 0 , if both the inputs are not equal then output will be 1.

If input A and B are equal then output is 0 or else 1.

Example: Perform XOR operation on 10101110 , 11100101

10101110
11100101
---------------
01001011
---------------

I have just explained important gates above with its example. If you want to know more gates you can just google it.

AUTHOR: YOUSTRON SIC

sajid niaz said...

thankxx

YOUSTRON SIC said...

welcome :-)

Raju said...

How many gates are there?. Do we use only these three gates or all of them we need to know?

YOUSTRON SIC said...

If u red my post carefully you would have understood it

"Note that i'm not going to explain all the gates , i just touch few of them whose operation is more frequently used in programming. "

Aman Rustagi said...

Binary logical operators are similar to bitwise operators in C programming. C language support AND, OR, XOR and NOT

uncf hdn said...

Quel est notre produit? - La meilleure marque de luxe au monde regarde des kopie horloges de la plus haute qualité! Si vous voulez avoir ces Kopie Horloges IWC de luxe, vous voulez porter ces montres sur votre poignet, mais arrêtez-vous en raison de leur prix élevé. Alors s'il vous plaît arrêtez vos pas, c'est votre endroit le plus correct..

High quality from a trust worthy buy raybans
sunglasses
dealer? here can offer you the best in high quality, including fake ray ban,
active sunglasses
clubmaster etc.

Tangki Fiber said...

I feel this is among the such a lot vital info for me. And i am satisfied studying your article. However wanna commentary on few general things, The website style is ideal, the articles is truly nice
Tangki Panel
Tangki Fiberglass
Jual Septic Tank