Oct 30, 2019

# Overview of this chapter

### Maintenance History

Next page: 2.1 Categories of data transmission

## 2.1 Categories of Data transmission

### 2.1.1 Classification by direction

• Simplex: One direction 　　　　　　　　 　 (Radio stations)
• Half-duplex: Two directions, not simultaneously (Walkie-talkie)
• Full-duplex: Two directions, simultaneously 　(Phone line)

### 2.1.2 Classification by transmission

• Serial: Single line, one bit at a time.
``````　　　Computer
A　　　　　B
A0------------>B0
``````
• Parallel: Multiple bits transfer simultaneously on separate lines.
``````　　　Computer
A　　　　　B
A0------------>B0
A1------------>B1
A2------------>B2
A3------------>B3
A4------------>B4
A5------------>B5
A6------------>B6
A7------------>B7
#Alan-------->Blan#
``````

### 2.1.3 Classification by synchronization

Next page: 2.2 Error detection

## 2.2 Error detection

### 2.2.1 Parity Check

#### Types of parity check

• Odd parity — there should be ODD numbers of “1”.
• Even parity — there should be EVEN numbers of “1”.

THE PARITY BIT MAKES SURE THAT IN TOTAL, THERE ARE EVEN / ODD NUMBER OF “1” BITS.

For example: The original data is `1 0 0 0 0 1 0`.
To prepare the data for odd parity, a separate parity bit is appended.
`1 0 0 0 0 1 0 [ ]`

##### Example: Determine which — “1” OR “0” — as parity bit:
1. There are currently 2 “1”s. 2 is an even number.
2. As a whole bit, there should be odd number of “1”s.
Therefore, the parity bit is set to 1.
3. So the data becomes `1 0 0 0 0 1 0 [1]`.
Now, there are 3 (odd) number of 1s. The bit is now ready for transmission.
``````                              [parity bit]
/                                  V
Odd parity:  1, 0, 0, 0, 0, 1, 0, [1]   # Total 3 (odd)  "1"s
Even parity: 1, 0, 0, 0, 0, 1, 0, [0]   # Total 2 (even) "1"s
/
``````
##### Function: Checks data integrity

The receiver checks whether the data matches odd parity.
(i.e. checks whether there is odd number of `1` s in the data.)

A correct transmission should lead to `1 0 0 0 0 1 0 [1]`. There are currently 3 `1` s in the data, meaning it is correct.

However, if a bit is corroded, say, the third bit:
`1 0 1 0 0 1 0 [1]`
There are currently 4 (even) of `1` s in the data — meaning an error had occurred.

If there is an error…

a) use the parity byte (shown below) to determine where the error occurred, or:
b) ask the sender to resend the data.

A parity bit could also be added every 8 lines, so the final product will be

``````# Assume it's even parity -- each line should end up with even "1" bits:
Byte 1   :1  0  1  0  0  1  0  [1]
Byte 2   :0  0  0  1  0  1  1  [1]
Byte 3   :0  1  0  0  1  1  0  [1]
Byte 4   :1  0  1  0  1  0  0  [1]
Byte 5   :0  0  0  1  1  1  0  [1]
Byte 6   :1  1  1  1  1  0  1  [0]
Byte 7   :0  0  0  0  1  1  1  [1]
Byte 8   :1  1  0  0  0  0  1  [1]
Parity  :[0][1][1][1][1][1][0] [1]
# Each row, with parity byte, should end up with even "1" bits.
``````

### 2.2.2 Checksum

It isn’t actually checking the sum. The algorithm is the follows:

1. Using a special algorithm, the computer generates a `checksum` number from the data.
2. The `Checksum` number is sent to the user along with the data.
3. The user uses the same algorithm, from the data he received, to calculate the `Checksum`.
4. If the user’s `Checksum` is the same as what the server sent, the data is correct.

### 2.2.3 ARQ

Short for Auto Repeat reQuest — just as its name suggests,

1. Server sends information to user
2. Server waits if the user has acknowledged the receive of information
3. After a period of time, if no acknowledgment is received, the protocol enters a Timeout.
So, the server automatically resends the information.

In the summer 2018 CIE exams, two marks came from keywords “Acknowledgement” and “Timeout”.

### 2.2.4 Echo check

Just as the name suggests.

1. Server sends information to user
2. User sends the information back to the server.
3. If the information sent back is the same, the data has been transferred correctly.

Next page: 2.3 USB

# 2.3Universal Serial Bus (USB)

(For Old versions — e.g. USB 2.0):

• Asynchronous, Serial full-duplex transmission.
• 2 wires for power; 2 wires for data

#### Process of plugging in USB

1. Computer automatically detects a device is plugged in.

• Idiot-proof — connection only fits one way
• Universal industry standards