Chapter 3 (Computer Science)
Chapter 3 (Computer Science)
Computer Architecture:
Central processing unit:
The CPU, also known as a microprocessor or processor, is the central component of modern
computer systems, including tablets and smartphones.
It is typically installed as an integrated circuit on a single microchip and is responsible for
processing all instructions and data in a computer application.
It consists of a control unit, arithmetic and logic unit, registers, and buses.
1|Page
Components of the central processing unit (CPU):
The main components of the CPU are the Control Unit (CU), Arithmetic & Logic Unit
(ALU) and system clock.
Arithmetic & Logic Unit (ALU):
The Arithmetic & Logic Unit (ALU) is a computer component that enables the execution of
arithmetic (e.g. +, - and shifting) or logic operations (e.g. AND, OR) during program execution.
It can be equipped with multiple Alu’s for specific functions, such as multiplication and division,
which involve addition, subtraction, and logical shift operations.
Registers:
One of the most fundamental components of the von Neumann system are the registers. Registers
can be general or special purpose.
2|Page
Memory:
The computer memory is made up of a number of partitions. Each partition consists of an address
and its contents. The address will uniquely identify every location in the memory and the contents
will be the binary value stored in each location.
3|Page
It is unidirectional between the CPU and memory, preventing addresses from being carried back to
the CPU.
The width of a bus is crucial, as wider buses can address more memory locations at any given time.
For example, a 16-bit bus can address 216 memory locations, while a 32-bit bus can address
4294967296 simultaneously. However, even wider buses are not large enough for modern
computers.
Data bus:
The data bus is bidirectional, allowing data to be sent from CPU to memory and vice versa, as well
as to input/output devices.
Data can be an address, instruction, or numerical value. The width of the data bus is crucial, as it
affects the word length that can be transported.
Words are groups of bits, with 16-bit, 32-bit, or 64-bit word lengths being the most common. Larger
word lengths can improve a computer's overall performance.
Control bus:
The control bus is also bidirectional. It carries signals from the control unit (CU) to all the other
computer components
. It is usually 8-bits wide. There is no real need for it to be any wider since it only carries control
signals.
Fetch–Decode–Execute cycle:
The CPU fetches data and instructions from memory, stores them in registers using both the address and
data bus, and then decodes each instruction before executing them, known as the Fetch–Decode–Execute
cycle.
Fetch:
The Fetch-Decode-Execute cycle in a computer stores data and instructions in the Memory Data
Register (MDR).
The next instruction is fetched from the MAR memory address and stored in the MDR.
The contents are copied to the Current Instruction Register (CIR), and the PC is incremented so that
next instruction can be processed
Decode:
The instruction is then decoded so that it can be interpreted in the next part of the cycle
Execute:
The CPU passes the decoded instruction as a set of control signals to the appropriate components within the
computer system.
4|Page
This allows each instruction to be carried out in its logical sequence.
Cores, cache and internal clock:
The performance of a CPU is determined by factors such as the system clock, which defines the
clock cycle that synchronizes all computer operations. The control bus transmits timing signals to
ensure full synchronization.
An increase in clock speed increases the computer's processing speed, but it is not necessarily a
guarantee of increased overall performance. A typical current value is 3.5GHz, involving 3.5 billion
clock cycles a second.
5|Page
cores doesn't necessarily increase performance, as the CPU must communicate with each core,
which can reduce overall performance.
Instruction Set:
Instructions are a sequence of operations in a computer system, decoded by the ALU and CU, which
are part of the CPU.
An operation consists of an opcode and an operand, with the opcode indicating the operation to be
performed and the operand representing the data to be acted on.
The instruction set, a limited number of opcodes, is used to understand the operation. All software on
a computer contains instructions that need to be converted into binary.
The Fetch–Decode–Execute cycle is the sequence of steps used by the CPU to process each
instruction.
The X86 CPU standard is a common example of an instruction set, with almost identical instruction
sets across all computer designs.
Don’t confuse it with program as Instruction sets are low-level language instructions that instruct the
CPU to perform an operation, while program code requires interpreters or compilers to convert it into
the computer's understood instruction set. Examples of instruction set operations include ADD, JMP,
and LDA
Embedded Systems:
An embedded system is a combination of hardware and software which is designed to carry out a specific set of
functions. The hardware is electronic, electrical or electro-mechanical. Embedded systems can be based on:
1. Microcontrollers: integrated circuit containing a CPU and memory (RAM or ROM) built in to the same chip
2. Microprocessor: Integrated circuit containing only a CPU on the chip.
RAM, ROM, peripherals need to be added
3.. System on chips: This contains a microcontroller as one of its components along with a secondary storage
on a single chip.
Embedded systems are devices that can be manually inputted or automatically sourced from sensors.
These inputs can be analogue or digital, such as oxygen levels or fuel pressure in a car's engine
management system.
6|Page
The output of the embedded system sends signals to controlled components, such as heating
elements or engine fuel levels.
Depending on the device, embedded systems are either programmable or nonprogrammable, with
nonprogrammable devices requiring software upgrades. Examples include a satellite link and an
oven control panel.
. Programmable devices permit upgrading by two methods:
Programmable devices can be upgraded through two methods: connecting the device to a computer
and downloading updates to the software
or automatic updates via Wi-Fi, satellite, or cellular links. For example, modern cars allow updates to
engine management systems and other components via satellite link.
Embedded systems, which can be connected to the internet, enable remote control using smartphones
or computers.
These systems are designed for specific tasks, allowing engineers to optimize their designs to reduce
physical size and cost.
The range of applications is vast, from a single microcontroller in an MP3 player to a complex array
of multiple units in a medical imaging system.
However, computers are not considered embedded systems as they are multi-functional and can
perform various tasks using different software, making them unsuitable for this category. Hence,
embedded systems are not limited to specific tasks.
Examples of Embedded systems:
Set-top box:
A set-top box uses an embedded system for recording and playing television programmes remotely,
using an internet-enabled device or an interface panel at home.
The embedded system handles functions involving inputs from sources like a Solid-State Device
(SSD) or a satellite signal, allowing for storage and retrieval of programmes and decoding incoming
signals.
7|Page
Security systems:
The system uses RAM for setting security codes and activates or deactivates alarms using a keypad.
Sensor data is sent to a controller, which checks against SSD values for sensitivity adjustments.
Outputs can be flash lights, sound alarms, or send messages to the home owner via mobile phone,
and the home owner can interface with the system remotely if needed.
Lighting systems:
Embedded systems are crucial in modern lighting systems, from simple home use to major
architectural systems. They control lighting based on various factors, such as time of day, room
occupancy, and natural light brightness.
These systems can automatically control lighting using inputs like light sensors and memory data. In
an office environment, the time of day is important as it saves energy by switching to low lighting
levels when unoccupied.
However, if there is movement, correct lighting levels are restored automatically. On bright sunny
days, the system can automatically dim lights and increase output if natural light levels fall below a
set value.
Embedded systems can control internal and external lighting systems, such as fountain lights or light
shows, and can also trigger emergency lighting in aircraft.
Some systems use Bluetooth light bulbs, allowing the system to control each bulb independently.
LED bulbs are widely available and come in various colours to change the mood.
Vending systems:
They usually use microcontrollers to control a number of functions that we all associate with vending machines
The vending machine's core is a microcontroller embedded system, which receives inputs from the
keypad for item selection and sensors for counting coins, machine temperature, and a tilt sensor for
security.
The system outputs include actuators for motors, signals for cooling systems, item descriptions and
changes on an LCD display panel, and data sent back to the vending machine company for remote
sales activity monitoring, including refill instructions, eliminating the need to visit each machine.
8|Page
All of this is controlled by an embedded system which makes the whole operation automatic but also
gives immediate sales analysis which would otherwise be very time consuming.
Washing machines:
White goods, such as refrigerators, washing machines, and microwave ovens, are controlled by
embedded systems with keypads or dials.
These inputs, like temperature, wash cycle, or cooking duration, are used to perform tasks without
human intervention. These devices can also be operated remotely using an internet-enabled
smartphone or computer.
Input devices
Barcodes:
series of dark and light parallel lines of varying thickness
numbers 0 to 9 are each represented by a unique series of lines
different codes for digits appearing on the left and for digits appearing on the right of the barcode
9|Page
All digits have same width and have 2 light bars and 2 dark bars
the left digits have an odd number of dark elements and start with a light bar
the right digits have an even number of dark elements and start with a dark bar.
allowing a barcode to be scanned in any direction.
A barcode reader shines a red laser at the barcode to read the data it represents
The light from the white lines is reflected back
Black lines absorb the light so less is reflected
The different levels of reflection are converted into a binary value which can be processed by a
microprocessor
What happens when the barcode has been scanned?
Barcode number is looked up
When it is found, stock item record looked up
Price and stock details sent to checkout
Stock number (for the item) is reduced by 1 each time barcode scanned
Number of stock items compared to reorder number, if its less than or equal to this value, more stock
items are automatically ordered
The system automatically stops re-ordering when an order for more stock items is generated, and
updates stock levels in the database when new items arrive.
Advantages to customers and managers for using barcodes:
Increased Efficiency: Barcodes automate tasks like product lookup and pricing, saving time and
reducing human error for both managers and cashiers.
Improved Accuracy: Scanning eliminates the need for manual data entry, leading to more accurate
inventory levels, pricing, and checkout transactions.
Enhanced Convenience: Self-checkout options with barcode scanners offer quicker service for
customers, while managers benefit from faster inventory management and checkout processes.
Reduced Costs: Increased efficiency and accuracy translate to lower labor costs and minimized
losses from errors or theft.
10 | P a g e
Disadvantages of QR codes compared to traditional barcodes:
More than one QR format is available
QR codes can be used for attagging malicious codes, with many free apps available. This can lead to
unauthorized access to user data, fake websites, and even the downloading of viruses, as the creator
can easily embed malicious code within the QR code.
New developments:
Frame QR codes, featuring a canvas area for incorporating graphics or images, are increasingly popular due
to their increased ability to include advertising logos.
Digital Cameras:
Digital cameras have replaced traditional film-based cameras, which were expensive to operate due to the
lack of image deletion capabilities. Morden Cameras allow wireless transfer of photographs via Bluetooth or
can transfer using USB (which uses wires). They are controlled by an embedded system which can
automatically adjusts the shutter speed, aperture size and size of the image it also focuses the image,
operates the flash gun to remove Red Eye automatically
Keyboards:
it is the most common method of data entry, it can be either virtual or a touch screen technology.
When a key is pressed it completes a circuit and the CPU determines which key has been pressed then it
refers to an index file ( which contains the ASCII value of the character the key represents).
people with repetitive strain injury (RSI) in the hands and wrists use ergonomic keyboards to overcome this
problem.
Microphones:
a microphone converts sound waves into an electric current which is converted into a digital format so it can
be understood by computer. So basically sound causes air particles to vibrate, in the speaker A copper coil
is wrapped around a cone connected to a diaphragm; the diaphragm captures the vibrations making itself
vibrate which causes the cone to move in and out causing copper wire to move backwards and fowards, this
motion induces a electric current. The electric current can do through ADC to become bits n bytes and be
stored in computer or amplified.
Optical mouse:
An optical mouse is a pointing device that uses tiny cameras to capture 1500 images per second. It can work
on any surface and uses a red LED at its base. A red led is used in the base of the mouse, the red light is
reflected from the surface and captured by a complementary metal oxide semiconductor (CMOS) which
11 | P a g e
generates electric pulses to represent the light, these pulses are sent to a digital signal processor. The
processor calculates the mouse's coordinates based on changing image patterns, allowing the computer to
move the cursor to the mouse's coordinates.
2D scanners:
2 dimensional scanners, they are most common and generally used to input hard copy (paper) documents.
The image is converted into an electronic form that can be stored in a computer
3D scanners:
3 dimensional scanners, which scan x,y,z coordinates of solid objects and produces 3D images. The images
can be used in computer aided design (CAD) or to 3D print the file.
Application of 3D scanners:
Computed tomographic (CT) scanners are used to create a 3D image of a solid object. This is based on
tomography technology, which basically builds up an image of the solid object through a series of very thin
‘slices’. Each of these 2D ‘slices’ make up a representation of the 3D solid object.
Touch screens:
- Allow touch selection of app to launch it
- Allows to carry out same functions as a pointing device (mouse)
- 3 types: capacitive , infrared , resistive
12 | P a g e
Capacitive touch screens:
composed of a protective glass layer, a conductive transparent electrode and a glass substrate. Since human
skin, conducts electricity when you touch the screen it disturbs the electrostatic field of the conductive layer
from which the micro controller can determine the coordinates of the disturbance (point of touching).
Two types of capacitive touch screens, surface and projective ; the have same general structure as shown in
figure 3.32
surface capacitive screens: sensors are placed at the corners as well as small voltage applied at the
corners creating electric field, finger touch will draw current from each corner reducing capacitance at point
of touch. Microcontroller will measure decrease in capacitance and determine the point of decrease ( which
is the point of touch). This method only works with a stylus or touch.
Projective capacitive screens: transparent conductive layer is in a x-y matrix format creating 3D
electrostatic field, finger touch disturbs this field allowing microcontroller to pinpoint coordinates. This
method works well with stylus, touch or cotton gloves, also allows multi touch facility.
Advantages of infrared compared to resistive and Disadvantages of infrared compared to resistive and
capacitive : capacitive:
Allows multi touch Sensitive to moisture or water
Good durability Possible for accidental activation
Operability isn’t effected by scratchs or cracks Sensitive to light interreference
Resistive touch screens: made up of 2 layers of electrically resistive material on which voltage
is applied across them. Upper layer which is the polyethylene layer and lower layer which is the glass layer
both have resistive coating on one side. When the top layer is touched both layers make contact and since
both layers are covered with resistive coating this completes a circuit resulting in flow of electricity. The
point of contact is detected when there is a change in voltage, microcontroller converts voltage into digital
data and sends it to microprocessor.
13 | P a g e
Advantages of resistive compared to capacitative Disadvantages of resistive compared to capacitative
and infrared and infrared
Good resistance to dirt and water Low touch sensitivity
Can be used with finger, glover, stylus Multi touch not supported
Poor visibility in strong light
Vulnerable to scratchs made on screen.
Output Devices
Actuators:
An actuator is a mechanical or electromechanical device such as a relay, solenoid or motor, actuators are
used to help control devices such as open or stop a valve , start/ stop a conveyer belt. Basically
Actuators converts an electric signal into a magnetic field producing linear motion (mechanical movement).
Light projectors:
Projectors, project a computer output on a larger screen.
there are 2 types of projectors
A bright white light passes through a condensing lens which makes the rays go towards the colour filter
which splits the white light into the 3 primary colours, which then passes into the DMD chip; the tilting
states of each micromirror are linked with colours from the filter to produce the coloured image.
14 | P a g e
15 | P a g e