[Notes] Digital Circuit Basics 2 - Digital Coding and Logic Circuits

Number System, Coding and Logical Algebra


number system

This section mainly describes decimal, binary, hexadecimal and their corresponding conversion rules. There are already many corresponding articles on the Internet, and the conversion from two to ten is often used in development. Take a lot of pen and ink to record the notes here


coding

The process of representing various numbers or symbols with binary numbers is called encoding. Encoding is done by encoding circuit

BCD code

8421BCDThe code is a weighted code, and its 4-bit binary weight from high to low is 23=8, 22=4, 21=2, 20=1

2421BCDThe bit weights of the 4-bit binary of the code from high to low are 2, 4, 2, 1 The
5421BCDbit weights of the 4-bit binary of the code from high to low are 5, 4, 2, 1


3 yards left

It is obtained by adding 3 (0011) to the 8421BCD code, which is an unauthorized code


gray code

The unweighted code with only 1 digit difference between two adjacent codes is called Gray code

insert image description here


Logical Algebra

The following is a table of all logical operations

insert image description here


combinational logic circuit


Combinational logic circuit analysis and design

According to the following combinational logic circuit, the corresponding logical expression is analyzed as

insert image description here

Y = A B + A ˉ C + B ˉ C Y=AB+\bar{A}C+\bar{B}C Y=AB+AˉC+BˉC


Encoder

The process of converting an input signal into a set of binary codes is called encoding. Encoder refers to the circuit that can realize the encoding function

common encoder

  • Only one input signal is allowed at any time
  • Multiple signals are input at the same time, and the encoded output will be confused
  • Close S0, because A is not connected to the circuit, so the output is 0
  • Close S5, at this time G1=1 G3=1, so output binary 101

insert image description here


priority encoder

  • Multiple signals are allowed to be input at the same time
  • Only the signal with the highest priority among the input signals is encoded and output
  • 74LS148 is a commonly used 8-wire-3-wire priority encoder chip
  • 38 Encoder, the priority of the 8 input pins from high to low is 7, 6, 5...0
    Enable EI=1, the output is 1, unable to encode,
    enable EI=0 and run encoding at this time

insert image description here

In addition, there is a 16-4 encoder, but it is not commonly used, so you don't need to learn it


decoder

Decoding is the process of translating binary codes into specific output signals. The circuit that can complete the decoding function is called a decoder

Binary Decoder

The following shows a two-input, four-output binary decoder

For example: when A=0, B=0, the non-gate GA outputs "1", the non-gate GB outputs "1", and the two input terminals of the AND gate G3 input "0" at the same time, so the output terminal Y3=0

insert image description here


digital display

The digital display is a digital tube, which can intuitively display the decimal number with the signal of the decoder

Common seven-segment digital tubes are divided into common cathode (input high level conduction) and common anode (input low level conduction) two connection methods

Detect the polarity of the digital tube: select the ×10kΩ gear of the multimeter, connect the black test lead to the com pin (common pin), and connect the red test lead to any pin other than the com pin. If the measured resistance is small, the digital tube is a common anode ; If the measured resistance value is close to infinity, it is a common cathode


When the fluorescent digital display is working, an AC voltage of about 6.3V must be provided to the filament, and electrons can only be emitted after the filament heats up.

The liquid crystal display does not require current when it works, and consumes very little power. However, since it does not emit light, it needs to be illuminated by an external light source to display digital numbers.


display decoder

The main function of the decoder is to translate the input binary code into a certain output signal, and let the output signal drive the display to display the characters corresponding to the input code

common forBCD 七段显示译码器

The display decoder is generally combined with the digital tube, and different levels are given through the input terminal, so that the output terminal outputs an eight-bit binary code, thereby driving the corresponding LED of the digital tube to light up

insert image description here


adder

half adder

The addition of two 1-bit binary numbers is called half-add, and the circuit that realizes the half-add function is called a half-adder

The half adder can be composed in the following two ways, and the corresponding circuit symbols are shown on the far right side of the figure below

When the A terminal inputs "0" and the B terminal inputs "1", the S terminal of the XOR gate outputs "1" (the function of the XOR gate is that the output is "0" when the input is the same, and the output is "1" when the input is different. ”), while the C terminal of the AND gate outputs “0”, that is“0+1=1”

insert image description here


full adder

Full addition is an addition operation with carry. In addition to adding two identical digits, it also needs to add the carry digit sent from the lower bit.

It consists of two half adders with an OR gate, Cn-1 means carry, if it is 1, it means low bit carry, if it is 0, it means no carry

insert image description here


There is also a so-called multi-bit adder, which consists of multiple full adders or a mixture of full adders and half adders


Numerical Comparator

equivalence comparator

A one-bit equivalent comparator, which can be implemented using an exclusive NOR gate (output 1 for the same input, and output 0 for different inputs)
provides two input terminals AB and one output terminal Y

The multi-bit equivalent comparator can be realized only by using multiple XNOR gates and one AND gate

insert image description here


Numerical Comparator

One-bit numeric comparator using one XNOR gate, two AND gates, and two NOT gates

insert image description here

74LS85It is a commonly used 4-bit numerical comparator chip


data selector

The data selector is also called a multi-channel selection switch. It is a circuit with multiple inputs and one output. Its function is to select one of the outputs from multiple input data under the action of the selection control signal.

A common four-to-one selector, which input is controlled by S0 and S1

  • When S0=0, S1=1, A2 data can be output from Y terminal through AND gate G2 and OR gate G4
  • When S0=1, S1=1, AND gate G3 is turned on, and A3 data is selected for output
  • When S0=0, S1=0, AND gate G0 is turned on, and A0 data is selected for output
  • When S0=1, S1=0, AND gate G1 is turned on, and A1 data is selected for output

insert image description here


parity checker

Parity can be divided into odd and even. For odd parity, if there is an odd number of "1" in the data, the result of the parity is 0, if there is an even number of "1" in the data, the result of the parity is 1; for even parity, if there is an even number of "1", the verification result is 0, if there is an odd number of "1" in the data, the verification result is 1

The following figure shows the actual role of the parity checker

  1. The sender sends data 10101100
  2. The parity checker at the sending end is set to odd parity, so because there are an even number of 1s, it outputs 1
  3. The output value of the parity checker on the sending side is transferred to the parity checker on the receiving side
  4. The parity checker at the receiving end receives the data from the transmitter and performs an odd check
  5. If the results are consistent, it means that the verification is successful and the data is not lost

insert image description here

A parity checker can be constructed using XOR gates as shown in the following figure

insert image description here


Guess you like

Origin blog.csdn.net/delete_you/article/details/131623283