A computer, of course, needs to do operations with its bits, in order to achieve the results we expect ...

The operations with the bits are called BOOLEAN ALGEBRA (from the name of its creator: George BOOLE [1815-1864] one with two BRONZE ATTRIBUTES, let me tell you ...)

Let's start with the first operation: NEGATION (NOT)
It simply inverts the value of the bit: hence NOT 1 = 0 and NOT 0 = 1
If you think about it is simple enough: if it is not 1 .... it can not be anything else that 0 ... isn't it?

To define a Boolean operation, the TRUTH TABLE is used, that is a simple table in which the results of the operation are put, which is simple to do, as there are only 4 possible combinations ...
Since we have talked about truth, it is good to specify that 1 = TRUE and 0 = FALSE

Now let's see the OR (like in grammar "OR"):
The OR operation is TRUE if AT LEAST ONE of the terms is TRUE, if you prefer you can also say that the OR operation is 1 if at least one of the terms is 1

The truth table is now simple to define ...
0 OR 0 = 0
0 OR 1 = 1
1 OR 0 = 1
1 OR 1 = 1

In a very similar way we have operation AND (grammar "AND", in the sense of conjunction)

The AND operation is TRUE if ALL the terms are TRUE, if you prefer you can also say that the AND operation is equal to 1 if ALL the terms are 1
The truth table is still very simple:
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1

The parentheses are also valid in Boolean algebra, indicating that the operation contained in them must be done first, otherwise the order in which the operations are performed is 1 °) NOT, 2 °) AND, 3 °) OR

A small example:

1 AND 0 OR 1 AND 1 OR 0

first you make the AND, so it comes:

0 OR 1 OR 0 = 1

If instead I had written

(1 AND 0) OR 1 AND (1 OR 0)

First I should do the brackets, then:

0 OR 1 AND 0

Then the AND ...

0 OR 0 = 0

The ASCII table is a conventional code used for the representation of text characters through the bytes: each byte is made to correspond to a different character of the keyboard (letters, numbers, signs).
In reality, the ASCII standard covers only the first 128 bytes (from 00000000 to 01111111), the subsequent bytes up to 256 make up the extended ASCII table which presents various national versions.
The standard ASCII table contains numeric digits, uppercase and lowercase letters (uppercase and lowercase have different ASCII codes) punctuation, arithmetic symbols and other symbols ($, &,%, @, #, etc.). Having been conceived in America, the standard ASCII table does not include accented letters (unknown to the English spelling).
The first 32 bytes of the standard table are also reserved for control signals and various functions.

 

Codifica binaria (8-bit) Codifica Esadecimale Codifica Decimale Codifica ASCII
0 0 0 NUL
1 1 1 SOH
10 2 2 STX
11 3 3 ETX
100 4 4 EOT
101 5 5 ENQ
110 6 6 ACK
111 7 7 BEL
1000 8 8 BS
1001 9 9 HT
1010 A 10 LF
1011 B 11 VT
1100 C 12 FF
1101 D 13 CR
1110 E 14 SO
1111 F 15 SI
10000 10 16 DLE
10001 11 17 DC1
10010 12 18 DC2
10011 13 19 DC3
10100 14 20 DC4
10101 15 21 NAK
10110 16 22 SYN
10111 17 23 ETB
11000 18 24 CAN
11001 19 25 EM
11010 1A 26 SUB
11011 1B 27 ESC
11100 1C 28 FS
11101 1D 29 GS
11110 1E 30 RS
11111 1F 31 US
100000 20 32 SPACE
100001 21 33 !
100010 22 34 "
100011 23 35 #
100100 24 36 $
100101 25 37 %
100110 26 38 &
100111 27 39 '
101000 28 40 (
101001 29 41 )
101010 2A 42 *
101011 2B 43 +
101100 2C 44 ,
101101 2D 45 -
101110 2E 46 .
101111 2F 47 /
110000 30 48 0
110001 31 49 1
110010 32 50 2
110011 33 51 3
110100 34 52 4
110101 35 53 5
110110 36 54 6
110111 37 55 7
111000 38 56 8
111001 39 57 9
111010 3A 58 :
111011 3B 59 ;
111100 3C 60 <
111101 3D 61 =
111110 3E 62 >
111111 3F 63 ?
1000000 40 64 @
1000001 41 65 A
1000010 42 66 B
1000011 43 67 C
1000100 44 68 D
1000101 45 69 E
1000110 46 70 F
1000111 47 71 G
1001000 48 72 H
1001001 49 73 I
1001010 4A 74 J
1001011 4B 75 K
1001100 4C 76 L
1001101 4D 77 M
1001110 4E 78 N
1001111 4F 79 O
1010000 50 80 P
1010001 51 81 Q
1010010 52 82 R
1010011 53 83 S
1010100 54 84 T
1010101 55 85 U
1010110 56 86 V
1010111 57 87 W
1011000 58 88 X
1011001 59 89 Y
1011010 5A 90 Z
1011011 5B 91 [
1011100 5C 92 \
1011101 5D 93 ]
1011110 5E 94 ^
1011111 5F 95 _
1100000 60 96 `
1100001 61 97 a
1100010 62 98 b
1100011 63 99 c
1100100 64 100 d
1100101 65 101 e
1100110 66 102 f
1100111 67 103 g
1101000 68 104 h
1101001 69 105 i
1101010 6A 106 j
1101011 6B 107 k
1101100 6C 108 l
1101101 6D 109 m
1101110 6E 110 n
1101111 6F 111 o
1110000 70 112 p
1110001 71 113 q
1110010 72 114 r
1110011 73 115 s
1110100 74 116 t
1110101 75 117 u
1110110 76 118 v
1110111 77 119 w
1111000 78 120 x
1111001 79 121 y
1111010 7A 122 z
1111011 7B 123 {
1111100 7C 124 |
1111101 7D 125 }
1111110 7E 126 ~
1111111 7F 127 DEL



Do not be frightened by the strange symbols: many are simpler than you think ... for example, the CR, which you find in correspondence of byte 13 ... is nothing more than the Carriage Return: that is, the simple going-forward.

We have seen that the binary code uses only two SYMBOLS to represent any quantity, symbols that are "0" and "1".

Well, only two symbols are VERY EASY to represent with the tools that are available in a Computer: electricity, switches, etc ...

In computers there are electronic components that may or may NOT have "current". These "currents" are also easily measurable, also because we are not interested in a precise measure, but only know if there are or are not there.

If there is current the value of the binary code is "1", if the current is not there then the value is "0".

(I used the term "current", because it is the one with which generically indicates the presence or absence of electrical phenomena, for the accuracy I tell you that the value that is measured, in reality, is that of a continuous tension: at the beginning such voltage assumed the values ​​of +5 Vdc (5 volts in direct voltage) and 0 Vdc or even + 5 Vdc and - 5 Vdc, to indicate respectively "1" and "0", today we also use lower voltages, so we save energy... and the PC consumes less)

The same concept, given the ease of representation, is applied, more or less, to each component that needs to store data. For example an hard disk: the heads read magnetic charge values, present, or NOT present, in certain areas of the surface of the disc plates.

We have seen that with the binary code we represent all quantities with only two symbols.
These two symbols represent the MINIMUM information possible: there is or there is no voltage on the basic component.
This information is called BIT: Basic Information Technology.
A single bit can then take the values ​​0 or 1.
TWO bits can have 4 different values ​​(22 = 4): 00,01,10,11 which represent the numbers 0,1,2,3
EIGHT bit can take 256 different values ​​(28 = 256): from 00000000 to 11111111, representing the numbers from 0 to 255

A set of eight bits is called BYTE, a byte is therefore another unit of measurement that can take 256 different values.
These values, by convention, are used in a PC, to represent the digits from 0 to 9, all the letters, uppercase and lowercase, all the punctuation symbols, and other symbols.
The correspondence between bytes and symbols represented is summarized and contained in the so-called Standard ASCII table

Through the bytes, the words, the instructions, the programs that the PC is able to interpret are made up, to do ... what we want !! (Almost always ... he he he !!)

Reminding us that at the base of everything there is always the binary code, and therefore that we are reasoning in base 2, we now see other units of measurement:

1 Kilobyte = 1 Kb = 1024 Bytes (1024 because 210 = 1024)
1 Megabyte = 1 Mb = 1024 Kb = 1,048,576 bytes
1 Gigabyte = 1Gb = 1024 Mb = 1.048.576 Kb = 1.073.741.824 bytes

As a curiosity, I inform you that a set of 4 bits is called "Nibble", today it is almost unused, but there was a time when this unit of measurement had its own precise motivation. In particular, just think that there were 4-bit CPUs.

The Binary Code 

To understand informatics, the first thing to do is to learn and to understand the language on which it's based. 

There are a lot of pages, available in internet, about this argument, but I want to use a different way to explain it, in a more simple language, so that (I hope) a lot of people could understand this "strange way to count". 

Everyone can count in the usual way, the decimal one, but WHY do we use that method ?

I believe I can say that human beings, in every time, in every place, have found very simple to count objects using something at FINGERtips !! 

Infact, I'm talking about fingers!! 

Let's say, the number 25, we all know it represents 2 tens and 5 units, this means that you have to raise up twice ALL the fingers of both hands, then five fingers more, in order to count 25 things. 

Every new position in a number, from right to left, tells us how many times you have to count ALL the available ciphers for the nearest right position. This is the keyword, to understand: "all the available ciphers". 

In decimal system, obviously, we have ten digits available, these are: 1,2,3,4,5,6,7,8,9,0 (I put "zero" at bottom to make it all clear).

Then, we say that 10 is the base of the numbering (then, it's also the base for exponentiation, we'll see them in a moment) 

So, if we say 15, we are saying that we count every "finger" (digit) ONE time, then again 5 digits (the grandtotal, as we all know, is [1 x 10 + 5 x 1] or, same thing, [1 ten + 5 units]). 

Let's repeat the reasoning, with a greater number, we choose 1296. 

Meanwhile, see it decomposed: 

position

digit

1

2

9

6

meaning

thousands

hundreds

tens

units

Power of 10

103

102

101

100

This table is a "classical" one, bou now I'd like to represent that number using all people that we need for "count" it. 

Here are 4 friends: Tony, Harry, Terence and Uma.

Uma's hands count from 1 to 1296, while she does this, other friends keep trace of the counting, in this way: 
Terence raise a finger every time that Uma ends a serie of 10, and she has begun again. 
[When Uma raises all fingers, it means she counted 10, so she immediately lowers all fingers, and Terence raises one finger, keep in mind: NOBODY stays with all fingers up] 
Harry raises a finger every time that Terence ends a serie of 10 and he has begun again. 
Tony raises a finger every time that Harry ends a serie of 10 and he has begun again. 

Obviously, the final result will be this one: 

Tony

Harry

Terence

Uma

1 finger up

2 fingers up

9 fingers up

6 fingers up

 

Well, what if these friends have only TWO fingers at all? 

Here's what wuold happen, for example, to count the number 25: 

[Remember the fact that, when we count in this way, who is REALLY counting all items is the rightmost person {i.e. Uma}, and when a friend raises all fingers happens this: he lowers all fingers and the nearest left friend raises one more finger to signal that his right friend has ended a serie and begun again] 

Our Uma has ONLY two fingers, how may times does she raise all of them? 
Obviously 25 divided by 2 that is 12, with the remainder of 1, it means that Uma will stay with 1 finger up

So, Terence must count how many times Uma raised all fingers, that is 12, but he has only two fingers too, then he'll raise them 12 divided by 2, that's equal to 6 with remainder of 0, Terence will stay with NO fingers up. 

Again, Harry must count how many times Terence raised all his fingers, that is 6, then Harry will raise his fingers 6 divided by 2 that's equal to 3 with NO remainder 

Tony should count the 3 times Harry's raised his fingers, so: he'll raise all his fingers once and will remain with 1 finger up. 

We need another friend, Paul: he counts how many times Tony has "lowered all his fingers" (that means how many times he has done a complete counting), that is only once. Paul will stay with one finger up. 


Paul

Tony

Harry

Terence

Uma

friends

1 finger up

1 finger up

NO fingers up

NO fingers up

1 finger up

fingers

1

1

0

0

1

Binary cyphers

24

23

22

21

20

power of 2

1 x 24

1 x 23

0 x 22

0 x 21

1 x 20

Sum=25

The number 25, in binary code, is 11001. 
The base of the numbering is 2

Exactly as in the case of decimal numbering, the meaning of the number 11001 is what follows (we begin from the rightmost position, the 1st position, that is the position of the UNITS, i.e. the POWER ZERO of the base choosen for counting): 

1 x 20 = 1 x 1 = 1 
0 x 21 = 0 x 2 = 0 
0 x 22 = 0 x 4 = 0 
1 x 23 = 1 x 8 = 8 
1 x 24 = 1 x 16 = 16 

and... 1+8+16= 25 !! 

Binary numbering has only two cyphers to form all numbers, these are "0" and "1". 

Let's see the method to convert: 

To transform the number 324 from base 10 (decimal) to base 2 (binary) we go through a sequence of divisions by the base: 


step

number

divided by

equals

with remainder of

 

1

324

2

162

0

(this is the rightmost cypher of the result)

2

162

2

81

0

 

3

81

2

40

1

 

4

40

2

20

0

 

5

20

2

10

0

 

6

10

2

5

0

 

7

5

2

2

1

 

8

2

2

1

0

 

9

1

2

0

1

 

 

We have found that 324 base 10 equals to 101000100 base 2 !! 

This method is good for every base. 

If we have base 16 (HEXADECIMAL code, or numbering), we'd use the same method, as seen before, but, having only 10 cyphers, we'd use 6 MORE SYMBOLS for ths new way of numbering: by convention capital letters A,B,C,D,E,F are used.

Then, an A in hexadecimal is 10, a B is 11... and so on up to F that is 15. And all goes well, because dividing by 16, I can get a remainder that goes from 0 to 15. 

If I was useful to you, please, consider a
small donation towards server costs