Last Sync: 2022-09-28 11:00:05
This commit is contained in:
parent
8432e322f0
commit
6db63537ad
3 changed files with 41 additions and 28 deletions
0
Hardware/Analogue_and_digital.md
Normal file
0
Hardware/Analogue_and_digital.md
Normal file
|
@ -1,8 +1,9 @@
|
||||||
---
|
---
|
||||||
|
title: The binary number system
|
||||||
categories:
|
categories:
|
||||||
- Mathematics
|
- Mathematics
|
||||||
- Computer Architecture
|
- Computer Architecture
|
||||||
tags: [binary]
|
tags: [binary, number-systems]
|
||||||
---
|
---
|
||||||
|
|
||||||
# The binary number system
|
# The binary number system
|
||||||
|
@ -17,22 +18,30 @@ $1, 2, 3, 4, 5, 6, 7, 8, 9$
|
||||||
|
|
||||||
When we have completed all the possible intervals between $0$ and $9$, we start again in a new column.
|
When we have completed all the possible intervals between $0$ and $9$, we start again in a new column.
|
||||||
|
|
||||||
The principle of counting in decimal:
|
The principle of counting in decimal:
|
||||||
|
|
||||||

|
```
|
||||||
|
0009
|
||||||
|
0010
|
||||||
|
0011
|
||||||
|
0012
|
||||||
|
0013
|
||||||
|
...
|
||||||
|
0019
|
||||||
|
0020
|
||||||
|
0021
|
||||||
|
```
|
||||||
|
|
||||||
Thus each column is ten times larger than the previous column:
|
Thus each column is ten times larger than the previous column:
|
||||||
|
|
||||||
* Ten \[$10^1$\] is ten times larger than one \[$10^0$\]
|
- Ten ($10^1$) is ten times larger than one ($10^0$)
|
||||||
* A hundred \[$10^2$\] is ten times larger than ten \[$10^1$\]
|
- A hundred ($10^2$) is ten times larger than ten ($10^1$)
|
||||||
|
|
||||||
We use this knowledge of the exponents of the base of 10 to read integers that contain multiple digits (i.e. any number greater than 9).
|
We use this knowledge of the exponents of the base of 10 to read integers that contain multiple digits (i.e. any number greater than 9).
|
||||||
|
|
||||||
Thus 264 is the sum of
|
Thus 264 is the sum of
|
||||||
|
|
||||||
* $4 * (10^0)$
|
$$[4 \cdot (10^0)] + [6 \cdot (10^1)] + [2 \cdot 10^2] $$
|
||||||
* $6 * (10^1)$
|
|
||||||
* $2 * (10^2)$
|
|
||||||
|
|
||||||
## Binary number system
|
## Binary number system
|
||||||
|
|
||||||
|
@ -56,15 +65,19 @@ $$ 0001, 0010, 0011, 0100 $$
|
||||||
|
|
||||||
Counting in binary:
|
Counting in binary:
|
||||||
|
|
||||||

|
```
|
||||||
|
000000
|
||||||
|
000001
|
||||||
|
000010
|
||||||
|
000011
|
||||||
|
000100
|
||||||
|
000101
|
||||||
|
000111
|
||||||
|
```
|
||||||
|
|
||||||
## Relation to Turing Machines
|
## Converting decimal to binary
|
||||||
|
|
||||||
It's obvious that there is a clear relation between the binary number system and Turing Machinees, since in their most basic instance, Turing Machines work with ones and zeros. In order for us to get Turing Machines to compute digital numbers we only need to convert from decimal to binary.
|
Let's convert 6 into binary:
|
||||||
|
|
||||||
### Example decimal to binary conversion
|
|
||||||
|
|
||||||
Let's convert 6 and into binary:
|
|
||||||
|
|
||||||
If we have before us the binary place values ($1, 2, 4, 8$). We know that 6 is equal to: **1 in the two column and 1 in the 4 column → 110**
|
If we have before us the binary place values ($1, 2, 4, 8$). We know that 6 is equal to: **1 in the two column and 1 in the 4 column → 110**
|
||||||
|
|
||||||
|
@ -78,7 +91,7 @@ And for comparison:
|
||||||
|
|
||||||
Or we can express the binary as:
|
Or we can express the binary as:
|
||||||
|
|
||||||
$$ (1 * 2) + (1 * 4) $$
|
$$ (1 _ 2) + (1 _ 4) $$
|
||||||
|
|
||||||
Or more concisely as:
|
Or more concisely as:
|
||||||
|
|
||||||
|
@ -89,5 +102,3 @@ $$ 2^1 + 2^2 $$
|
||||||
Let's convert 23 into binary:
|
Let's convert 23 into binary:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
---
|
---
|
||||||
|
title: Why computers use binary
|
||||||
categories:
|
categories:
|
||||||
- Mathematics
|
- Mathematics
|
||||||
- Computer Architecture
|
- Computer Architecture
|
||||||
tags: [binary]
|
tags: [binary]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Why computers use binary
|
# Why computers use binary
|
||||||
|
|
||||||
## Now we know how binary works, how does it relate to computing?
|
## Now we know how binary works, how does it relate to computing?
|
||||||
|
|
||||||
The reason is straight forward: it is the simplest way on the level of pure engineering of representing numerical and logical values; both of which are the basic foundations of programming. An electronic circuit or transistor only needs to represent two states: on (1) and off (0) which corresponds to the switch on an electrical circuit.
|
The reason is straight forward: it is the simplest way on the level of pure engineering of representing numerical and logical values; both of which are the basic foundations of programming. An electronic circuit or transistor only needs to represent two states: on (1) and off (0) which corresponds to the switch on an electrical circuit.
|
||||||
|
@ -15,8 +17,7 @@ A single circuit representing the binary values of 1 and 0:
|
||||||
|
|
||||||
It would be much more complicated to have to represent ten different states under the decimal number system, although denary computers do exist.
|
It would be much more complicated to have to represent ten different states under the decimal number system, although denary computers do exist.
|
||||||
|
|
||||||
>
|
> We will see later that 1/0 also corresponds to the basic values of logic: true and false. This is what allows us to build up complex circuits and programs based on primitive truth conditions.
|
||||||
> We will see later that 1/0 also corresponds to the basic values of logic: true and false. This is what allows us to build up complex circuits and programs based on primitive truth conditions.
|
|
||||||
|
|
||||||
If we want more digits, we just need to add in more circuits, and we can represent as large a binary number as we need. We just need one switch for every digit we want to represent. The switches used in modern computers are so cheap and so small that you can literally get billions of them on a single circuit board.
|
If we want more digits, we just need to add in more circuits, and we can represent as large a binary number as we need. We just need one switch for every digit we want to represent. The switches used in modern computers are so cheap and so small that you can literally get billions of them on a single circuit board.
|
||||||
|
|
||||||
|
@ -33,9 +34,9 @@ The following breaks down how we get from the binary number system → electrica
|
||||||
1. ”Data”= a piece or pieces of **information**
|
1. ”Data”= a piece or pieces of **information**
|
||||||
|
|
||||||
1. In computing all data is represented in **binary form:**
|
1. In computing all data is represented in **binary form:**
|
||||||
|
|
||||||
2.1. ”Binary” means that the value of a piece of data is exclusively one thing or another
|
2.1. ”Binary” means that the value of a piece of data is exclusively one thing or another
|
||||||
|
|
||||||
2.2. The values in binary code are exclusively 1 and 0 (either a piece of data is a 1 or it is a 0, it can never be both). Binary can also be expressed in logical terms where 1 is equal to `true` and 0 is equal to `false`
|
2.2. The values in binary code are exclusively 1 and 0 (either a piece of data is a 1 or it is a 0, it can never be both). Binary can also be expressed in logical terms where 1 is equal to `true` and 0 is equal to `false`
|
||||||
|
|
||||||
1. The smallest piece of data is a **bit**
|
1. The smallest piece of data is a **bit**
|
||||||
|
@ -44,11 +45,12 @@ The following breaks down how we get from the binary number system → electrica
|
||||||
|
|
||||||
1. Thus by 1-4, **a bit is either 1 or 0**
|
1. Thus by 1-4, **a bit is either 1 or 0**
|
||||||
|
|
||||||
1. Binary form bears an isomorphic relation to switches on electrical circuits (the hardware of computers). Thus binary code can be *mapped onto circuits*.
|
1. Binary form bears an isomorphic relation to switches on electrical circuits (the hardware of computers). Thus binary code can be _mapped onto circuits_.
|
||||||
|
|
||||||
* Circuits are controlled by switches
|
- Circuits are controlled by switches
|
||||||
* A switch is a binary function: it is either on or off ”On/off” corresponding to 1/0.
|
- A switch is a binary function: it is either on or off ”On/off” corresponding to 1/0.
|
||||||
* In this way, switches control the flow of electric current
|
- In this way, switches control the flow of electric current
|
||||||
|
|
||||||
1. Thus by the above, hardware (which is a physical structure made up of electric circuits) is **readily programmable in binary terms**
|
1. Thus by the above, hardware (which is a physical structure made up of electric circuits) is **readily programmable in binary terms**
|
||||||
|
|
||||||
1. Restatement of 6: in order for hardware to be programmed the program must provide the hardware with something that it can actually perform. The program must be formulated in binary code.
|
1. Restatement of 6: in order for hardware to be programmed the program must provide the hardware with something that it can actually perform. The program must be formulated in binary code.
|
||||||
|
|
Loading…
Add table
Reference in a new issue