|
CompTIA
Bits and Bytes
Binary system uses Base 2, which means 2 placeholders, 0 and 1. Computers count in bits (0 = off and 1=on): 10001110101011110000111010001000..... etc. However, it is not easy for humans to remember all these 1s and 0s, so we divide the bits in octets (8) and count from the right to the left: Remember that 0 is a real number when dealing with binary, i.e., from 0 to 255 there are 256 bits.
1 0 0 0 1 1 1 0 .
|
1 0 1 0 1 1 1 1 .
|
0 0 0 0 1 1 1 0 .
|
1 0 0 0 1 0 0 0.
|
7 6 5 4 3 2 1 0
|
7 6 5 4 3 2 1 0
|
7 6 5 4 3 2 1 0
|
7 6 5 4 3 2 1 0
|
Table 1
Possible patterns of 0s and 1s
3 bits
|
2 bits
|
1bit
|
0 0 0
|
0 0
|
0
|
0 0 1
|
0 1
|
1
|
0 1 0
|
1 0
|
 |
0 1 1
|
1 1
|
 |
1 0 0
|
 |
 |
1 0 1
|
 |
 |
1 1 0
|
 |
 |
1 1 1
|
 |
 |
Total: 8 (2^3)
|
Total: 4 (2^2)
|
Total: 2 (2^1)
|
Table 2
Question: What's the total patterns of 0s and 1s with 4bits; 5bits; 6bits; 7bits; 8 bits; n bits?
Answer: 2^4=16; 2^5=32; 2^6=64; 2^7=128; 2^8=256; 2^n.
Converting binary into decimal numbers:
To make our life easy, in each octet we replace the bits that are turned on (bit 1) with the value of the total number of posible patterns. Adding the position value of each bit that is turned on (1) gives us a decimal number that represents the entire octet :
Bits
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
Position Power
|
7
|
6
|
5
|
4
|
3
|
2
|
1
|
0
|
2
|
2
|
2
|
2
|
2
|
2
|
2
|
2
|
Position Value
|
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
Table 3
Therefore, the octet with all 1s is represented by the decimal 255 (128+64+32+16+8+4+2+1)
Example: Let's convert binary to decimal for Table1:
In the first octet of Table 1 we have: 2^7 = 128; 2^3 = 8; 2^2 = 4; 2^1 = 2. We add these values up: 128+8+4+2=142 and the total will represent the entire octet. Do the same for the other octets:
1 0 0 0 1 1 1 0 .
|
1 0 1 0 1 1 1 1 .
|
0 0 0 0 1 1 1 0 .
|
1 0 0 0 1 0 0 0.
|
7 6 5 4 3 2 1 0
|
7 6 5 4 3 2 1 0
|
7 6 5 4 3 2 1 0
|
7 6 5 4 3 2 1 0
|
142.
|
 |
 |
 |
Practice the following table:
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
 |
128
|
64
|
32
|
16
|
8
|
4
|
2
|
1
|
 |
Computers
|
Humans
|
Computers
|
Humans
|
1
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
128
|
0
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
127
|
1
|
1
|
0
|
0
|
0
|
0
|
0
|
0
|
192
|
0
|
0
|
1
|
1
|
1
|
1
|
1
|
1
|
63
|
1
|
1
|
1
|
0
|
0
|
0
|
0
|
0
|
224
|
0
|
0
|
0
|
1
|
1
|
1
|
1
|
1
|
31
|
1
|
1
|
1
|
1
|
0
|
0
|
0
|
0
|
240
|
0
|
0
|
0
|
0
|
1
|
1
|
1
|
1
|
15
|
1
|
1
|
1
|
1
|
1
|
0
|
0
|
0
|
248
|
0
|
0
|
0
|
0
|
0
|
1
|
1
|
1
|
7
|
1
|
1
|
1
|
1
|
1
|
1
|
0
|
0
|
252
|
0
|
0
|
0
|
0
|
0
|
0
|
1
|
1
|
3
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
0
|
254
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
1
|
255
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
0
|
Table 4
Practice without using the table:
What's the decimal number for 01111111; 11111110; 00111111; 11111100; 00011111; 11111000; 00001111; 11110000; 00000111; 11100000; 00000011; 11000000?
Exercise: Convert from Decimal system into the Binary system and vice-versa:
? = 96; ? = 48; ? = 24; ? = 80; ? = 100; 01010101= ?; 10101010 = ?; 11100010 = ?; 10100010 = ?
AND -ing bits: 1+1=1, everything else is 0:
10101010
11100010
10100010
To AND two decimal numbers, we convert them to binary, AND the binaries and convert the result back to decimal.
Example: AND 248 with 76
11111000 (248)
01001100 ( 76 )
01001000 ( 72 )
Answer: 248 AND 76 = 72
Exercise: AND 192 with 63; 224 with 31; 240 with 15; 248 with 7; 252 with 3.
Hexadecimal (Hexa = 6, Decimal = 10) system uses Base 16 (16 place holders: 0 to 9 and A to F)
8
|
4
|
2
|
1
|
 |
8
|
4
|
2
|
1
|
 |
Computer
|
Human
|
Computer
|
Human
|
0
|
0
|
0
|
0
|
0
|
1
|
0
|
0
|
0
|
8
|
0
|
0
|
0
|
1
|
1
|
1
|
0
|
0
|
1
|
9
|
0
|
0
|
1
|
0
|
2
|
1
|
0
|
1
|
0
|
A
|
0
|
0
|
1
|
1
|
3
|
1
|
0
|
1
|
1
|
B
|
0
|
1
|
0
|
0
|
4
|
1
|
1
|
0
|
0
|
C
|
0
|
1
|
0
|
1
|
5
|
1
|
1
|
0
|
1
|
D
|
0
|
1
|
1
|
0
|
6
|
1
|
1
|
1
|
0
|
E
|
0
|
1
|
1
|
1
|
7
|
1
|
1
|
1
|
1
|
F
|
Note: Convert from Hexadecimal to binary and then to Decimal.
Features of checksum
 It's more powerful than parity
 If two bits in exactly the same place in two separate data units are damaged, the error will go undetected
 If some data is damaged, the whole block is descarded
 Burst errors may cancel each other out, rendering the checksum useless
The CRC process
 Each data unit received in a transmission is examined.
 A sequence of 0s is appended to the data unit.
 A predetermined binary divisor is used to divide the new data unit and produce a CRC
 The resulting CRC is appended to the original data unit and the data is transmitted
 The CRC checker of the receiver treats the CRC and data as one data unit and divides it by using the divisor
 If the result of the division is a nonzero remainder, a retransmission is requested. If the remainder is zero, the data unit passes.
Synchronous transmission
 Iddle data sequences are sent to create transmission gaps
 Transmitted data can be sent with a timing signal
 DCE for synchronous modems is expensive
 The user can send more data in less time
 Data is encoded by using framing protocols
Asynchronous transmission
 Gaps in the data streams make the transmission slow
 It's a form of a serial transmission
 Each byte sent has three overheads
 It uses start and stop bits to coordinate transmission
 It's not very cost effective
Features of a framing protocol
 It's a set of rules that the DCE follows to organize data into frames
 It encodes control signals into messages
 There are two types, bit-oriented and byte-oriented
 A bit-oriented framing protocol is more efficient than a byte-oriented framing protocol
|