# Analog & digital electronics, logic gates, conversion of decimal numbers and binary numbers

### Analog electronics

There are two types to deal with the input voltage and the output voltage in the electric circuit which are the analog electronics and the digital electronics, Analog electronics are electronics that deal with the physical quantities as it is, such that it converts them into continuous electronic signals which means it takes any values of the decimal numbers.

#### Applications

1. Microphone: Converting the sound into an electric signal.
2. Normal video camera: Converting the image into an electric signal.
3. Normal television:

At sender: The sound or the image are converted into electric signals then into electromagnetic signals.

At receiver: The electromagnetic signals are converted into electric signals in antenna then the receiver device converts it into sound and image.

Disturbance (Electronic noise): Source of the disturbance is the random motion of the electrons as they are charges if they move, they cause a random current, The disturbance affects on the analog signals where noise interfere with the analog signals which carry the information and disturb it.

#### Digital electronics

Digital electronics are the electronics that deal with the physical quantities after converting them into discrete code based on two values only (0, 1) where code 0 logic low and code 1 logic high.

At sender: All the connected electric signals are converted into digital signals using analog to digital converter (ADC).

At receiver: The digital signals are converted into analog signals using digital to analog converter (DAC).

##### Applications
1. Cell phone.
2. Digital satellite channels.
3. Laser CD.
4. Computer devices.

All the letters and the numbers which enter the computer are converted into binary codes, The image is divided into small elements (pixels) then it is converted into binary codes (1, 0), The calculations are processed based on binary algebra.

The information is stored in the temporary memory (RAM) or the permanent memory (Hard disk) in the form of magnetization in a certain direction which means (0) or magnetization in the opposite direction which means (1).

Source of the disturbance is the random motion of the electrons as they are charges if they move, they cause random current, The information isn’t the value of the signal that noise might interfere with it and cause disturbance but the information is only code (1, 0) and it does not matter if noise is added to it.

##### Converting the analog number (decimal) into digital code (binary number)
1. To convert the analog number (decimal) into digital code (binary number), Divide the decimal number by 2 if the product has a remainder put 1 in the remainder cell, If the product has no remainder, put 0 in the remainder cell.
2. Divide the product by 2 and so until the product becomes less than 1, so we put 0 in the product cell, 1 in the remainder cell.
3. Write down the numbers in the remainder cell respectively inside the two brackets: ( )2.

Example: The digital code of the analog number 19 is (10011)2

##### Converting digital code (binary number) into the analog number (decimal)
1. To convert digital code (binary number) into the analog number (decimal), Write down the code (0, 1) each number separately in the order and below each number from the right side write the binary system (20, 2¹, 2², 2³ ……).
2. Write down the product of multiplying the code (0 a, 1) in the binary system ( 20, 2¹, 2², 2³ …… ).
3. Add the produced numbers to obtain the required analog number.

Example: Find the analog number for the digital code (10001)2

The summation of the product = 1 × 20 + 0 × 2¹ + 0 × 2² + 0 × 2³ + 1 × 24 = 1 + 0 + 0 + 0 + 16 = 17 which is the required analog number.

### Logic gates

The digital electronics is the base of many instruments and electronic components such as logic gates, Modern applications of electronics such as computer circuits and modern communication systems depend on digital circuits called logic gates.

We can calculate the number of possibilities in the truth table from the relation 2n where n is the number of input, Logic gates are parts of electronic circuits of modern devices which perform logic operations on the digital signals depends on codes (0, 1), There are different types of logic gates:

##### Inversion (NOT)

The number of input and output: One input and one output.

Logic operation: Inverse (The output is inverse of the input): If the input is 0 the output is 1 If the input is 1 the output is 0.

The equivalent electric circuit: A key in parallel in the circuit, when operating the key, the lamp lights and when closing it, the lamp does not light.

##### Coincidence (AND)

The number of input and output: Two or more inputs and one output.

Logic operation: Simultaneity the output is not one unless all inputs are one, When the two inputs are 1 and 0 the output is 0 When the two inputs are 1 and 1 the output is 1.

Two keys are in series in the circuit, The lamp will not light until the two keys are closed.

##### Optionality (OR)

The number of input and output: Two or more inputs and one output.

Logic operation: Optional the output is one or more of inputs is one, When the two inputs are 0, the output is 0, When the two inputs are 1 and 0 the output is 1, When the two inputs are 1 the output is 1.

Two keys are in parallel with each other in the circuit, The lamp will light when one key is closed or the two keys are closed.

Transistors types, structure (pnp transistor & npn transistor)