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.
- LED Bicycle Lights
- AD108 frequency multiplier capable of inputting asymmetric square wave
- How to make a four-level water level indicator with full water alarm function
- Rectangular Pulse Frequency Doubler
- Simple and practical circuit designed using diode forward voltage drop
- Simple and easy to make energy-saving LED flashlight
- Production of an LED lighting lamp
- UHF amplifier circuit
- Precision unity gain inverting amplifier circuit composed of INA105
- Tremolo Amplifier Circuit
- Do you know the difference between analog circuits and digital circuits?
- Basic digital logic gates
- Digital circuit part of ICL7106 chip (1)
- Digital circuit sound and light control stair delay switch circuit (4)
- Touch-type delay circuit using digital circuits (5)
- Touch-type delay circuit using digital circuits (3)
- Touch-type delay circuit using digital circuits (1)
- 9V charger with digital circuit timer
- 9V charger with digital circuit timer
- 4017 Basic Demonstration Circuit