Home > Basic Circuits >Basic Practical Circuits > Basic digital logic gates

Basic digital logic gates

Source: InternetPublisher:石榴姐 Keywords: digital circuit logic gate circuit Updated: 2021/05/21

Whether it is digital circuits or C language, we will often encounter logical operations and logic circuits. Here I will introduce them. Everyone will have a brief understanding first. If you know that there is such a thing, you will encounter it later and study it in detail.

First of all, within the conceptual category of "logic", there are two logical values: true and false. When corresponding to digital circuits or C language, they become "non-zero value" and "zero value". Value, that is, logical "false" is the value of "0" in digital circuits or C language, and logical "true" is all other "non-zero values".

Then, let's analyze several main logical operators in detail. We assume that there are 2 byte variables: A and B. The result of some logical operation on the two is F.

The following logical operators operate on the overall value of the variable, and are usually called logical operators:

&&: Logical AND, F = A && B. When the values ​​of A and B are both true (that is, non-zero values, the same below), the operation result F is true (the specific value is 1, the same below); when A, When any one of the B values ​​is false (that is, 0, the same below), the result F is false (the specific value is 0, the same below).

||: Logical OR, F = A || B. When either A or B is true, the operation result F is true; when both A and B are false, the result F is false.

!: Logical negation, F = !A. When the value of A is false, the operation result F is true; when the value of A is true, the result F is false.

The following logical operators operate on each bit in the variable, and are usually called bitwise operators:

&: Bitwise AND, F = A & B, perform AND operation on each bit of the two bytes A and B, and then combine the obtained results of each bit into the total result F, for example, A = 0b11001100, B = 0b11110000, then the result F is equal to 0b11000000.

|: Bitwise OR, F = A | B, perform an OR operation on each bit of the two bytes A and B, and then combine the obtained results of each bit into the total result F, for example, A = 0b11001100, B = 0b11110000, then the result F is equal to 0b11111100.

~: Bitwise inversion, F = ~A, perform a NOT operation (that is, inversion) on each bit in the A byte, and then combine the obtained results of each bit into the total result F, for example, A = 0b11001100, Then the result F is equal to 0b00110011; we have already used this operator in the previous running water lamp experiment. Now if we look back, it will be much clearer.

^: Bitwise XOR, XOR means that if the values ​​of both sides of the operation are different (that is, different), the result is true, and if the values ​​of both sides are the same, the result is false. There is no XOR operation based on the overall value of the variable in C language, so we only take bitwise XOR as an example, F = A ^ B, A = 0b11001100, B = 0b11110000, then the result F is equal to 0b00111100.

When we read information or chip manuals in the future, we will often encounter some circuit symbols. Table 1 shows the commonly used symbols in digital circuits. Knowing these symbols will help us understand the logical structure of the device, especially focusing on understanding the "foreign symbols" in the following table. Popular Graphic Symbols”. Let’s take a brief look at it here first. If you encounter it later, you can check it here.

 

Basic digital logic gates

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号