Binary, Hexadecimal, and Data Transmission Explained, Study notes of Computer science

A comprehensive overview of how computers use binary and hexadecimal systems to represent and process data. It covers topics such as binary to denary conversion, hexadecimal usage in error codes, mac addresses, ipv6 addresses, and html color codes. Additionally, it explains binary addition, logical binary shifts, two's complement, character sets like ascii and unicode, sound and image representation, data storage measurements, and data compression techniques. The document also delves into data packets, transmission modes, and the universal serial bus (usb) protocol, offering a detailed understanding of data transmission principles and technologies. Useful for high school students.

Typology: Study notes

2024/2025

Available from 06/10/2025

lexxy-mbucho
lexxy-mbucho 🇬🇧

6 documents

1 / 63

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1.1.1 How and why computers use binary
Binary
Anything with only two possible states
The only way that the computer saves data
Data are saved by using transistors
Also called Base 2
Data is processed by logic gates that only have two states (0 and 1)
1.1.2 Binary to denary conversion
Units
1 byte = 8 bits = 2 hex digit
1 nibble = 4 bits = 1 hex digit
1.1.3 How and why is hexadecimal used
Why is hexadecimal used
It is a shorter representation of binary, so it is easier for human to understand
Main uses
Error codes
Refer to the memory location of the error
Generated automatically by the computer
MAC addresses
MAC = media access control
A number uniquely identifies a device on a network, referring to the network interface
card which is part of the device
Made up of 48 bits which are shown as 6 groups of 2 hexadecimal digits
IPv6 addresses
IP = Internet Protocol
Address given to each device connected to a network
Difference between IPv4 and IPv6
IPv4
32 bit written in denary or hexadecimal
Uses decimal point to connect
IPv6
128 bits
Broken down into 16-bit chunks (= 4 hex digits) written in hexadecimal and
uses colons
HTML colour codes
Three primary colours: red, green, blue
8 bits (2 hex digit) and 256 shades of each primary colour
Hexadecimal is used because it uses less digits and is easier to read
1.1.4-5 Binary addition and logical binary shifts
Overflow error
Occurs when 8-bit register addition results in a value larger than 255
All the bits required to represent the value cannot fit in the 8-bit register (a 9th bit is required)
as the number is too big
Logical shifts
Left: × 2
Right: ÷ 2
Rightmost digits might be lost if shifted to the right
1.1 Notes
20221128
18:35
Page 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f

Partial preview of the text

Download Binary, Hexadecimal, and Data Transmission Explained and more Study notes Computer science in PDF only on Docsity!

1.1.1 How and why computers use binary Binary

  • Anything with only two possible states
  • The only way that the computer saves data
  • Data are saved by using transistors
  • Also called Base 2

Why a computer system only process data in binary form

  • Data is processed by logic gates that only have two states (0 and 1)

1.1.2 Binary to denary conversion Units

  • 1 byte = 8 bits = 2 hex digit
  • 1 nibble = 4 bits = 1 hex digit

1.1.3 How and why is hexadecimal used Why is hexadecimal used

  • It is a shorter representation of binary, so it is easier for human to understand

Main uses Error codes ○ Refer to the memory location of the error ○ Generated automatically by the computer

MAC addresses ○ MAC = media access control A number uniquely identifies a device on a network, referring to the network interface card which is part of the device

○ Made up of 48 bits which are shown as 6 groups of 2 hexadecimal digits

IPv6 addresses ○ IP = Internet Protocol ○ Address given to each device connected to a network Difference between IPv4 and IPv IPv □ 32 bit written in denary or hexadecimal □ Uses decimal point to connect

IPv □ 128 bits Broken down into 16-bit chunks (= 4 hex digits) written in hexadecimal and uses colons

HTML colour codes ○ Three primary colours: red, green, blue ○ 8 bits (2 hex digit) and 256 shades of each primary colour ○ Hexadecimal is used because it uses less digits and is easier to read

1.1.4-5 Binary addition and logical binary shifts Overflow error

  • Occurs when 8-bit register addition results in a value larger than 255 All the bits required to represent the value cannot fit in the 8-bit register (a 9th bit is required) as the number is too big

Logical shifts

  • Left: × 2
  • Right: ÷ 2
  • Rightmost digits might be lost if shifted to the right

1.1 Notes

2022 年 11 月 28 日 18:

1.1.6 Two's complement The most significant bit (leftmost digit) is changed to a negative value

  • 1 = negative, 0 = positive
  • Will be indicated clearly when to use in exams
  • One square / circle of one colour
  • The smallest component of an image
  • Represented by binary numbers Colour depth
  • Number of bits used to represent each colour

Image resolution

  • The number of pixels that make up an image

Fuzzy image

  • Pixelated
  • No enough pixels to represent the picture properly

High resolution images drawback

  • Larger file size
  • Less images can be stored on
  • More time to download an image
  • More time to transfer images between devices

1.3.1 Measurement of data storage IEC system

  • International Electrotechnical Commission Kibibyte KiB 210 1024 bytes Mebibyte MiB 220 1 048 576 bytes Gibibyte GiB 230 1 073 741 824 bytes Tebibyte TiB 240 1 099 511 627 776 bytes Pebibyte PiB 250 1 125 899 906 842 624 bytes Exbibyte EiB 260 1 152 921 504 606 846 976 bytes

Converting between measurements

  • Smaller to larger = divide
  • Larger to smaller = multiply

1.3.2 Calculation of file size File size of an image

File size of an audio file

1.3.3/4 Data compression - Lossy and Lossless Reasons for compression

  • Reduce file size
  • Save storage space on devices such as HDD / SSD
  • Increase transmission speed
  • Reduce bandwidth needed for transmission
  • Reduced file size reduces costs in situations such as using cloud services

Lossy file compression

  • Reduces the file size by permanently removing data
  • Eliminates unnecessary data from the file
  • Cannot reconstruct the original file

Lossy compression for different files **Type Type of media Details

  1. MPEG-3 (MP3)** Audio Remove sounds that human ears cannot hear properly Outside human ear range, softer sound when two sounds are played at the same time

2. MPEG-4 (MP4) Multimedia • Retains an acceptable quality of sound and video 3. JPEG Images Humans eyes don't detect differences in colour shades quite as well as they detect differences in image brightness

  • Images can be split into pixel blocks by separating pixel colour from brightness It allows some information to be discarded without causing any real noticeable deterioration in quality

Lossless file compression

  • Reduces the file size without permanent loss of data e.g. RLE
  • A compression algorithm is used
  • Repeated words or symbols are identified
  • Indexed and put into a table (add example)
  • Replaced with their index (add example) Their positions + the number of times the word / pattern appears are stored in the table (add example)
  • No data is removed in the process
  • Takes more space than lossy files, or even more space than the original file

RLE

  • Run-length encoding

1.3 Notes

2022 年 11 月 1 日 19:

2.1.1 Data packets Data packet

  • Data sent over long distances is usually broken up into data packets
  • Quite small, typically 64 KiB
  • Easier to control
  • Each packet can be sent along a different route to its destination
  • Can still transmit data if one route is out of action or very busy
  • Drawback: needs to reassemble data when it reaches its destination

Data packet structure Header ○ IP address of sender ○ IP address of recipient ○ Sequence number ○ Size of data in bytes

Payload ○ Actual binary data

Trailer ○ Method identifying the end of the packet ○ Error check (CRC)

Cyclic redundancy check (CRC)

  • Counts the number of 1s in the data and saves it in the trailer
  • The computer counts the number of 1s in the payload after receiving data
  • Check if it equals to the number of 1s in the CRC
  • If the two values doesn't match the packet is resent

Packet switching

  • Data is broken down into packets
  • Each packet could take a different route
  • A router controls the route a packet takes
  • Packets may arrive out of order
  • Once the last packet has arrived, packets are reordered

Packet switching pros and cons Benefits ○ No need to tie up a single communication line ○ A high data transmission rate is possible

Drawbacks ○ Packets can be lost and needs to be resent ○ A delay at the destination for data to be re-ordered

2.1.2 Data transmission Transmission modes Simplex ○ Data sent one direction only

Half-duplex ○ Data sent in both directions but one direction at a time

Full-duplex ○ Data sent in both directions at the same time

Transmission types Serial ○ Data is sent one bit at a time over a single wire / channel ○ Bits are sent one after another as a single stream Good for longer distances ▪ e.g. USB between printer and computer

2.1 Notes

2022 年 11 月 28 日 18:

▪ e.g. USB between printer and computer ○ Slower ○ Synchronised arrival ○ All 3 transmission modes Parallel Several bits of data usually one byte are sent down several channels / wires all at the same time

○ Each channel / wire transmits one bit Good for shortershort distances ▪ e.g. internal circuits of a computer

○ Faster ○ Risk of unsynchronised / skewed arrival (if over long distance) ○ All 3 transmission modes

Serial advantages

  • Data arrives in the order sent (synchronised)
  • Can transmit over longer distance

Parallel advantages

  • Allow faster transmission / response to request of large amount of data
  • (Disadvantage = opposite to the other's advantage) 2.1.3 Universal Serial Bus Basics - The most common type of input / output port found on computers - Transmission type = serial - Transmission mode = half-duplex / full-duplex - Includes port, cable, connection, device - Device plugged into a port on computer and transmits data using connection

Plugging into the computer

  • It is automatically detected by the computer for its presence when plugged into the USB port
  • The appropriate device driver is automatically loaded up
  • Prompts user to download the appropriate driver if needed

Benefits

  • USB is backward compatible
  • Universal standard
  • Auto configures
  • Can power devices
  • Fast data transfer speed
  • Inexpensive to purchase / manufacture

Drawbacks

  • Slower transfer rate compared to others such as Ethernet connections
  • Standard USB only supports a maximum cable length of 5m Very early USB standards (V1) may not always be supported by the latest computers although USB is backward compatible

Comparing USB to USB-C USB Physical characteristics ▪ 4 wired shielded cable ▪ 2 wires for power ▪ Other 2 for data transmission ▪ Plugged in using USB ports, inserted only one way

○ +5V power available ○ 1.5 Mbps to 5 Gbps ○ Backward compatible

USB-C

Physical characteristics 24 - pin symmetrical connector □ It will fit into a USB-C port either way round

▪ It is much smaller and thinner than older USB connectors

2.2.1 The need to check for errors Risks when transmitting data

  • Corruption: 0 become 1 or 1 becomes 0
  • Loss: bits lost
  • Gain: bits gained

How errors occur Electrical interference ○ All types of wires / cables can suffer from electrical interference ○ Cause data to be corrupted or lost

Problems during packet switching ○ This can lead to data loss or even data gain.

Skewing of data ○ Bits arrive out of sync ○ Occurs during parallel data transmission and can cause data corruption

2.2.2 Parity checks, checksum and echo checks Parity check An agreement is made between the sender and the receiver regarding even or odd parity being used

  • Usually the most significant bit of a byte is reserved for a parity digit
  • The parity digit is set to meet the parity
  • Parity doesn't match = error has occurred
  • Failsafe: two or more bits change Parity blocks ○ A block of data is sent and a parity check is done both horizontally and vertically ○ A parity byte consisting vertical parity checks is also sent during the transmission Not only identifies the error but also indicates where it is ▪ Intersection of byte + column with error = where the error is

○ Can detect even number of changes in bits

Checksum

  • A number is calculated from the data according to an agreed algorithm.
  • This checksum number is sent along with the original data.
  • When the data arrives at its destination the same calculation is carried out on the data. The result is compared to the transmitted checksum, if they are the same then the data has been transmitted correctly.

Echo checks

  • A copy of the data received is sent back to the sender
  • The returned data is compared with the original data by the sender’s computer
  • If the two sets of data are different, then an error occurred
  • Resent if error occurred
  • Cannot find where the error occurred

2.2.3 Check digits Check digit

  • The final digit in a code
  • Calculated from all the other digits in the code using a specific algorithm
  • Used to identify errors in data entry caused by mis-typing or mis scanning a barcode
  • Check digit match check digit calculated = error free

Uses Barcodes on products ○ International Standard Book Numbers (ISBN) Vehicle Identification Numbers (VIN)

2.2 Notes

2022 年 11 月 28 日 18:

○ Vehicle Identification Numbers (VIN) Errors they can detect

  • An incorrect digit entered
  • Transposition errors where two or more digits have changed order
  • Omitted or extra digits
  • Phonetic errors

2.2.4 Automatic repeat request or query (ARQs) Positive acknowledgement

  • The sender transmits the first data packet, the receiving device checks it for errors Once the receiving device knows it has received the data error free, it sends a positive acknowledgement back to the sending device

When the sending device receives this positive acknowledgement, it knows the data packet was received error free and sends the next data packet.

If the sending device does not receive a positive acknowledgement within a set timeframe, a timeout occurs and the sending device will resend the data packet

It will keep doing this when a timeout occurs, until it receives a positive acknowledgement, or sometimes a limit is set and when this limit is reached it will stop resending the data.

Negative acknowledgement

  • The sender transmits the first data, the receiving device checks it for errors
  • If the receiving device detects no errors, no further action is taken If the receiving device detect errors, it will send a negative acknowledgement back to the sender

If the sender receives a negative acknowledgement, it knows this means the data was received incorrectly, so it can resend the data packet

  • A timeout is set by the sending device when it sends the data The sending device knows that if it doesn't receive a negative acknowledgement back within that set time period, it doesn't need to be still be waiting for it and can send the next data packet.

3.1.1 The CPU CPU

  • Central processing unit
  • Aka microprocessor / processor
  • Often installed as an integrated circuit on a single microchip Processes instructions and data that are input into the computer so that the result can be output

Consist of: ○ Control unit (CU) ○ Arithmetic and logic unit (ALU) ○ Registers and buses

Microprocessor

  • A type of integrated circuit on a single chip

3.1.2a Von Neumann architecture Main components Control Unit (CU) ○ Decodes instructions using an instruction set ○ Sends control signals that manage the transfer of data and instructions within the CPU

Arithmetic and Logic Unit (ALU) ○ Used to carry out calculations on data and logical operations ○ It holds temporary values during calculations in a register called the accumulator (ACC)

System Clock ○ A tiny oscillating crystal ○ Controls the rate at which calculations are performed by the CPU

Registers Program counter (PC) ○ Stores the address of the next instruction to be processed

Memory address register (MAR) ○ Stores address of next instruction/data to be fetched // where data is to be written to

Memory data register (MDR) ○ Stores the data that is in use from the address in the MAR

Current instruction register (CIR) ○ Stores the instruction that is currently being processed

Accumulator (ACC) ○ Built in to the ALU, temporarily stores data being used in a calculation

Buses Data bus ○ Carries data between the CPU, memory and input/output devices

Control bus ○ Carries signals from the control unit (CU) to all the other computer components

Address bus ○ Carries addresses throughout the computer system e.g. MAR to RAM

3.1.2b Fetch-Decode-Execute cycle Fetch

  • PC starts at 0000 The address in the PC is copied to the MAR using an address bus so the CPU knows where to look in RAM
  • The address is sent from the MAR through the address bus to RAM
  • The data stored at the address in RAM is read and sent through the data bus to the MDR
  • If the data is an instruction it is copied to the CIR

3.1 Computer architecture

2022 年 11 月 28 日 18:

  • If the data is an instruction it is copied to the CIR
  • The PC is incremented by 1 Decode
  • Instruction sent to the CU by data bus from CIR to be decoded Split into opcode and operand ○ Opcode: the command that the computer will carry out ○ Operand: an address in RAM where data will be read from or written to
  • Opcode is translated into instructions by the CU using the instruction set

Execute

  • CU send signal (via the control bus) to other components of the computer
  • Operand copied to the MAR
  • Data at address is then fetched from RAM and passed up the data bus to the MDR
  • Passed to accumulator within ALU for calculations to be carried out Results of the calculation can be passed back to the MDR and then stored in a specified location in RAM

3.1.3 Cores, caches and internal clock - CPU performance Factors affecting performance Clock Speed Definition: The maximum number of FDE cycles/instructions a CPU can perform in a second

○ The clock speed of a CPU determines how fast it can process instructions A faster clock speed improves the performance Tasks can be performed faster because more FDE cycles / instructions can be processed in a second

○ Typical speed of CPU clock = 3.5GHz Overclocking ▪ Using a clock speed higher than the computer was designed ▪ Can lead to seriously unsynchronised operations ▪ The computer would frequently crash and become unstable ▪ Lead to serious overheating of CPU, causing unreliable performance

Cache size ○ Very fast volatile memory within the CPU ○ It is inside the CPU so it has faster data access time then the RAM ○ Stores frequently used instructions and data that needs to be accessed faster ○ Larger cache = better performance

Number of cores ○ A core is made up of an ALU, a CI and the registers ○ Usually 2,4 or 8 cores ○ It processes instructions and carries out a FDE cycle Multiple cores can process instructions simultaneously and increase the performance of a computer

Doubling the amount of cores doesn't necessarily exactly double performance as extra communication between cores is required

3.1.4 Instruction set Opcodes

  • Binary numbers because computers only understand binary Instructions written in binary are called Machine Code as it is directly understood by a machine, opcodes are therefore written in machine code

Instruction set

  • A list of all the commands that can be processed by a CPU
  • The commands are machine code Specific to the CPU and different manufacturers can have different instruction sets for their CPUs

3.1.5 Embedded systems

  • Definition

3.2.1 Input devices Definition

  • Allow data to be entered into the computer system

Input Device Detail Used for Barcode scanner It uses a red laser to scan a barcode so that the data stored in the barcode can be obtained. Light from the lines in the barcode is reflected back to the scanner. It is used in a supermarket to get the price of a product and as part of a stock control system Digital camera It captures light through a lens and converts it into binary. It is built into a mobile phone to allow the user to photograph items or people. Keyboard It allows the user to press keys that have a designated ASCII/Unicode value that is converted to binary. Using keyboards regularly can lead to repetitive strain injury (RSI) It is one of the main methods of input that allows a user to type data into a personal computer. Microphone It captures soundwaves and converts them to binary. It is built into a mobile phone to capture the user’s voice so that it can be heard by the other users. It can also be used as a sensor to detect sound. Optical mouse It captures the light that is bounced back from a laser that is shone from the mouse to the surface underneath, to track the mouse’s movements. It is one of the main methods of input that allows a user to select icons and menu options whilst using a personal computer.

3.2 Input and output devices

2023 年 3 月 7 日 23:

It captures the light that is bounced back from a laser that is shone from the mouse to the surface underneath, to track the mouse’s movements. It is one of the main methods of input that allows a user to select icons and menu options whilst using a personal computer. QR code scanner It uses a sensor or a camera to capture light reflected from a QR code and converts it to binary. QR codes can usually be read using the camera on a smartphone. It can be an application that is downloaded onto a mobile phone and used to SCAN QR codes that store information, e.g. a website link. Resistive touch screen Made up of two layers. A voltage is applied across the two surfaces. When the top layer is touched it makes contact with the bottom layer completing a circuit. The point of contact is detected where the change in voltage occurred. Had good resistance to dust and water so can be used by engineers or roadside mechanics exposed to the elements. Can be used with bare fingers, stylus and gloved hand. Capacitive touch screen An electrostatic field is created on the screen. As human skin is conductor of electricity, when the screen is touched the electrostatic field is changed and the point of contact can be determined. Capacitive touch screens are very durable, have high scratch resistance and allow multi-touch. Infra-red touch screen Infrared sensors and transmitters form a grid of infrared beams. If any of the beams are broken the point of contact can be determined. Infrared screens have good durability and can work if the screen is scratched or cracked. They allow multi-touch. 2D scanner 2D scanners (or flatbed scanners) are usually used to scan documents. The document is converted into a digital format that can be stored on a computer. 2D scanners can be used at airports to read passports which enable automatic border controls. 3D scanner 3D scanners scan solid objects to produce 3D digital images. They make use of lasers and a turntable which rotates the solid The images can be used in computer- aided design (CAD) software. They can also be used in medical

This is a device that squirts liquid ink from nozzles to output a document or image It can be used in a house to print photographs Laser printer This is a device that uses a rotating drum and powdered toner to output a document It can be used in an office to print letters. Light emitting diode (LED) screen This is a screen that uses LEDs as a backlight to output an image This screen can be built into a mobile phone Liquid crystal display (LCD) screen This is a screen that shines light through crystals to output an image. This can be built into a television screen Speaker This is a device that outputs sound. This can be built into a mobile phone so one user can hear another user’s voice

This can be built into a mobile phone so one user can hear another user’s voice 3D printer This is a device that builds layers of material to output a 3D object This can be used in medicine to create prosthetic limbs 3.2.3 Sensors Definition

  • Input devices which read or measure physical properties from their surroundings

ADC

  • Converts the analogue physical quantities into discrete digital values

Types of sensors Temperature ○ Measures temperature of the surroundings by sending signals ○ These signals will change as the temperature changes

Moisture ○ Measures water levels in, for example, soil ○ It is based on the electrical resistance of the sample being monitored

Humidity ○ Slightly different to moisture ○ This measures the amount of water vapour in, for example, a sample of air Based on the fact that the conductivity of air will change depending on the amount of water present

Light These use photoelectric cells that produce an output in the form of an electric current depending on the brightness of the light

Infrared (active) ○ Use an invisible beam of infrared radiation picked up by a detector If the beam is broken, then there will be a change in the amount of infrared radiation reaching the detector (sensor)

Infrared (passive) ○ These sensors measure the heat radiation given off by an object

Pressure A transducer and generates different electric currents depending on the pressure applied

Gas Most common ones are oxygen or carbon dioxide sensors