Contents
1. Half-adder circuit
From here on, I will introduce things that combine multiple circuits as an application.
First of all, a half-adder circuit is a circuit that is used to perform binary addition.
Half adders cannot be used for additions with more than two bits (a bit is one digit of a binary number).
Circuit Diagram
The circuit is a combination of an XOR circuit and
an AND circuit.The black circles above the circuits
also indicate that the intersecting circuits are connected.
![Circuit Symbols for Half-Adder Circuits](../../img/circuit/HARF-ADDER-figure.png)
Binary addition
Before we get into the truth table, let's talk about binary addition.
First of all, we usually use decimal numbers, which are expressed
as a combination of 0~9, and the digit increases when it reaches 10.
On the other hand, binary numbers are expressed
as a combination of 0 and 1, and the digit increases when it reaches 2.
Therefore, 1 + 1 in binary becomes 2, and the digit increases,
so the answer is 10, the digit increases.
Truth table
Let's look at the truth-value table.
First, if the input of A is 1 and the input of B is 0,
then S(sum) is 1.
Next, if both the input of A and the input of B are 1,
then In the XOR circuit, if the same value is input to both inputs,
the output will be 0, so S will be 0. In the AND circuit,
the output is 1 only when both inputs are 1, so C (the digit) is 1.
![半加算回路の真理値表](../../img/circuit/HANkasannkairo.png)
2. Multiplexer
A multiplexer is a signal switcher that selects a signal to be output
from multiple signals. It is similar to a vending machine,
where a variety of drinks come out of one vending slot by selecting a button.
About AND and OR circuits with three or more inputs
Let's think about AND and OR circuits with three or more inputs,
looking at the truth table.
AND circuit
![Truth table for AND with 3 or more inputs](../../img/circuit/3nyuuryokuAND.png)
First of all, the AND circuit will only output 1 when the inputs are all 1's,
and the output will be 0 for all other patterns.
OR circuit
![Truth table for OR with 3 or more inputs](../../img/circuit/3nyuuryokuOR.png)
Next, an OR circuit will have an output of 1 if any of the inputs are 1,
and an output of 0 if all the inputs are 0.
This means that even if the number of inputs changes,
the output of an OR circuit will be 1 when any of the inputs is 1,
and the output of an AND circuit will be 1
only when all the inputs are 1 respectively.
Circuit diagrams and truth tables
The multiplexer consists of an OR circuit and an AND circuit.
The white circle also inverts the input.
![multiplexer circuit](../../img/circuit/MULTIPLEXER-figure2_en.png)
By inverting the input in the white circle,
the AND circuit determines the signal and input,
and the OR circuit combines the signals.
The OR circuit summarizes the signal.
![Multiplexer Truth Table](../../img/circuit/marutipurekusa_en.png)
Now let's look at the patterns for each signal along with the table above.
Signal 0
First, let's focus on signal 0.
Signal 0 is the result of the inversion of the inputs
from A and B when the inputs A and B are 0,
so that all signals entering the AND circuit become 1,
and the input outputs signal 0.
![Multiplexer input 0](../../img/circuit/MULTIPLEXER-figure2_0_en.jpg)
Signal 1
Next, let's focus on signal 1.
Signal 1 is output because when input A is 1 and input B is 0,
the input from B is inverted and all inputs to the AND circuit are set to 1.
![Multiplexer Input 1](../../img/circuit/MULTIPLEXER-figure2_1_en.jpg)
Signal 2
Next, we will focus on signal 2.
Signal 2 is output because when input A is 1 and input B is 0,
the input from A is inverted and all inputs to the AND circuit become 1.
![Multiplexer input 2](../../img/circuit/MULTIPLEXER-figure2_2_en.jpg)
Signal 3
Finally, we will focus on signal 3.
Signal 3 is output by receiving inputs from A and B when inputs A and B are 1.
![Multiplexer input 3](../../img/circuit/MULTIPLEXER-figure2_3_en.jpg)
Summary
In this way, by switching inputs A and B on and off,
it is possible to select which of the signals 0 to 3 will be output.
The same mechanism can be used for the vending machine
and TV input switching mentioned above.
3. RS flip-flop circuit
A flip-flop circuit is a circuit that has the ability
to store past inputs and reflect them in the output.
There are various types of flip-flops depending on their structure and function.
In this section, I will explain the RS type, which is a typical type.
Circuit Diagram
RS flip flop circuit has the appearance of two NOR circuits
side by side and one of the inputs of each circuit
is connected to the output part of the other NOR circuit
and crossed, as shown in the circuit diagram.
![Circuit symbol for RS flip-flop circuit](../../img/circuit/RS_figure.png)
Circuit symbol
A circuit symbol is an abbreviation for a circuit diagram, and the circuit symbol for an RS flip-flop circuit is as shown in the figure on the right.
![Circuit symbol for RS flip-flop circuit](../../img/circuit/rskigou.jpg)
Truth table
Now, let's see how the RS circuit works
based on the table and schematic below.
Let's consider the case where the input is S:1 and R:0,
divided into ①~③.
State ①
Since the input of 1 from S goes to the NOR circuit,
the output of Q# will be 0. Also, for the lower NOR circuit,
only S is fixed among the inputs Q and S. However,
due to the nature of the NOR circuit, if one of the inputs is 1,
the output will always be 0, so the output of the lower NOR circuit will be 0.
![RS flip-flop circuit 1](../../img/circuit/RS_figure_1.png)
State ②
Since the output of Q# is now 0, the 1 input that used to go to Q
is no longer there, and it is inverted in the NOR circuit to make the output of Q 1.
![RS flip-flop circuit 2](../../img/circuit/RS_figure_2.png)
State ③
Since the output of Q goes into the NOR circuit on the S side,
the output remains unchanged from the previous time even if S is set to 0.
![RS flip-flop circuit 3](../../img/circuit/RS_figure_3.png)
Also, it is forbidden to set S and R to 1.
![Truth table of RS flip-flop circuit](../../img/circuit/RS-flip_table_en.png)
RS flip-flop circuit made in Minecraft
The RS flip-flop circuit made in Minecraft looks like this.
The button corresponds to the input and the lamp corresponds to the output.
![RS flip-flop circuit made with a microcontroller](../../img/circuit/RS-flip_minecraft_1.png)