Chapter3 - Hardware
3.01 Computer architecture
冯诺依曼体系架构

Von Neumann architecture
Von Neumann introduced the idea of the stored program computer, which has been the basis of many computers for a number of years.
main novel features:
- The concept of a central processing unit (CPU or processor).
- The processor was able to access the memory directly.
- Computer memories could store programs as well as data.
- Stored programs were made up of instructions which could be executed in sequential order.
CPU 架构



通俗理解: 计算单元主要执行算术运算、移位等操作以及地址运算和转换;存储单元主要用于保存运算中产生的数据以及指令等;控制单元则对指令译码,并且发出为完成每条指令所要执行的各个操作的控制信号。
- Control Unit(CU):控制单元,协调管理;
- Arithmetic Logic Unit(ALU):数学逻辑单元,接受控制单元CU的命令,负责进行加减乘、与或非运算。
- Register:ALU是负责计算逻辑,具体计算的数据是存放在寄存器(Register,几KB大小)中,寄存器以极高的速度(<1纳秒)与CU和ALU交互。寄存器中的数据是临时寄存的,这些数据和指令会被ALU和CU拿来立即进行计算,如果寄存器中没有CPU想要的数据,CPU会去内存或硬盘中读取。
- BUS:总线,如果寄存器中没有CPU需要的数据,CPU会去内存或硬盘中读取,这个读取内存或其他设备数据的过程,是通过Bus(总线)来实现,计算机中有多条总线。
The central processing unit
The central processing unit (CPU) has the responsibility for execution and processing of all instructions and data in a computer.
It consists of:
- control unit (CU)
- arithmetic and logic unit (ALU)
- registers and buses.
A microprocessor is an integrated circuit (microchip) – also referred to as a processor or CPU.
difference between CPU and microprocessor:
- CPU refers to the central processing unit of a computer
- microprocessor is a single integrated circuit that contains the entire CPU and additional peripherals.
- The microprocessor is a physical implementation of a CPU
- the CPU is a broader concept referring to the core processing unit of a computer system.
Components of a typical CPU

CPU 指令流程

步骤:
- Fetch - CPU通过地址总线获取必要的指令并将他们存储到内部存储位置(IAS中)
- Decode - CPU通过对指令解码理解刚刚获取的指令
- Execute - CPU执行指令
- Store - 将执行的结果在存储到内部存储IAS中去
CPU的具体过程:
- 控制单元CU先取指令(Fetch);
- 指令译码(Decode)解析出要执行什么指令;
- 确认指令是对哪些数据(操作数Operand)进行操作;
- 将操作数从主存加载到寄存器中;
- ALU执行指令(Execute);
- 结果写回Store;
Register寄存器


存储器的基本组成:
- 存储单元 - 存放一串二进制代码
- 存储字 - 存储单元中二进制代码的组合
- 存储字长- 存储单元中二进制代码的位数每个存储单元赋予一个地址号
- MAR(Memory Address Register) - 存储器地址寄存器,反映存储单元的个数 2**n。内存中用来存放欲访问存储单元地址的寄存器
- MDR(Memory Data Register) - 存储器数据寄存器,反映存储字长 n。主存中用来存放从某单元读出、或写入某存储单元数据的寄存器;
运算器基本组成:
- ACC(Accumulator) - 累加器,运算器中运算前存放操作数、运算后存放运算结果的寄存器;
- MQ(Multiplier-Quotient Register) - 乘商寄存器,乘法运算时存放乘数、除法时存放商的寄存器。
- X - 此字母没有专指的缩写含义,可以用作任一部件名,在此表示操作数寄存器,即运算器中工作寄存器之一,用来存放操作数;
控制器的基本组成:
PC(Program Counter) - 程序计数器,存放当前欲执行指令的地址,并可自动计数形成下一条指令地址的计数器;
IR(Instruction Register) - 指令寄存器,存放当前正在执行的指令的寄存器;
CU(Control Unit) - 控制单元(部件),控制器中产生微操作命令序列的部件,为控制器的核心部件;
程序首地址PC:
取指令:PC->MAR->存储体M-MDR->IR
分析指令:IR->CU
执行指令:IR->MAR->M->MDR->ACC
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) allows the required arithmetic (e.g. +, - and shifting) or logic (e.g. AND, OR) operations to be carried out while a program is being run;
Computers can have more than one ALU.
The ALU allows multiplication and division using shifting operators.
Control Unit (CU)
The control unit reads instructions from memory. The address of the location where the instruction can be found is stored in the Program Counter (PC). This instruction is then interpreted using the Fetch–Decode–Execute cycle (see later in this section).
A system clock is used to produce timing signals on the control bus to ensure this vital synchronisation takes place – without the clock the computer would simply crash!
The RAM holds all the data and programs needed to be accessed by the CPU. The RAM is often referred to as the Immediate Access Store (IAS). The CPU takes data and programs held in backing store (e.g. a hard disk drive) and puts them into RAM temporarily.
Registers
Registers can be general or special purpose. We will only consider the special purpose registers.

System buses and memory

Buses transfer data and control signals throughout a computer.
- address bus (unidirectional) carries addresses throughout the system
- data bus (bidirectional) allows data to be carried to/from CPU/memory and to/from input–output
- control bus (bidirectional) carries signals from the control unit to all computer components.
The width of the data bus and address bus determines the word length/size and the performance of the computer.
The stored-program concept
A stored-program computer is a computer that stores programs and instructions in digital memory.
A modern stored-program computer is one that keeps its programmed instructions, as well as its data, in read-write, random-access memory(RAM).
The fetch-execute cycle


step 1 - Fetching the instruction
The CPU fetches the necessary data and instructions and stores them in its own internal memory locations (the IAS). To fetch the instruction the CPU uses the address bus.
The PC contains the address of the memory location of the next instruction to be of fetched from memory (MAR).
The address is copied from the PC to the MAR using the address bus.
The contents of the memory location contained in the MAR are then copied into the MDR.
The contents of the MDR are then copied to CIR and the PC is incremented by one so the next instruction can be processed.
step 2 - Decoding the instruction
The instruction is now decoded so that it can be interpreted in the next part of the cycle.
step 3 - Executing the instruction
The CPU passes the decoded instructions as a set of control signals to appropriate computer components.
This allows each instruction to be carried out in a logical sequence.
Cores, cache and internal clock
The system clock defines the clock cycle used to synchronise all computer operations.
Timing signals are transmitted via the control bus.
How to speed up the cpu performance?
- increasing the clock speed increases the processing speed of the CPU (since it can carry out more processes per second).
- The width of the address bus and data bus increases the processing speed of the CPU.
- The larger the cache memory size the better the CPU performance.
- Using a different number of cores can also improve CPU performance.
Overclocking, caused by changing the clock speed in the Basic Input/ Output System (BIOS), can lead to overheating and to non-synchronised instructions which can cause the computer to crash.
Caches
Caches, which store frequently used instructions and data, can speed up CPU
Instruction set
opcode and operand
Instructions are a set of operations that need to be decoded in sequence; each operation is made up of an opcode and an operand.
A number of allowed opcodes exist and these are referred to as the instruction set.
The Fetch-Decode-Execute cycle controls the sequence of steps to process each instruction in sequence.
Instruction sets are low level language instructions that instruct the CPU how to carry out an operation.
Embedded Systems

the general make-up of an embedded system

An embedded system is a combination of hardware and software designed to carry out a specific task.
Hardware can be electronic, electrical or electro-mechanical.
Embedded systems can be based on a microcontroller, microprocessor or system on a chip (SoC).
Embedded systems can be programmable or non-programmable.
Benefits:
- They are small in size and therefore easy to fit into devices.
- Compared to other systems, they are relatively low cost to make.
- They are usually dedicated to one task making for simple interfaces and often no requirement for an operating system.
- They consume very little power.
- They can be controlled remotely using a mobile phone, for example.
- Very fast reaction to changing input (operate in real time and are feedback orientated); with mass production comes reliability.
Drawbacks:
- It can be difficult to upgrade some devices to take advantage of new technology.
- Troubleshooting faults in the device is a specialist task.
- Although the interface can appear to be simple (such as a single knob) in reality it can be more confusing (for example, changing the time on a cooker clock can require several steps).
- Any device that can be accessed over the internet is also open to hackers viruses and so on.
- Due to the difficulty in upgrading and fault finding, devices are often just thrown away rather than being repaired (very wasteful).
- Can lead to environmental issues created by an increase in the ‘throw away’ society if devices are discarded just because they have become out of date.
Examples of the use of embedded systems include:
- security systems (use sensors, such as temperature, acoustic and pressure, to monitor for intruders and sound an alarm if necessary)
- set-top box to record and play back television programmes (allow aerial, cable, satellite or Wi-Fi inputs and can be controlled remotely)
- lighting applications (to control lighting depending on time of day, whether a room is occupied and brightness of ambient light; makes use of sensors and actuators to monitor and control lighting levels)
- vending machines (monitor selection, money entered, tilting of machine and delivery of items using actuators and motors; uses sensors to detect tilting, temperature and to count money entered)
- washing machines (selection is via keypad which allows wash program to be selected)
- motor vehicles (fuel injection system, Global Positioning System (GPS) navigation, in-car entertainment, anti-lock braking system (ABS), and so on).
3.03 Input Devices
I/O Device (Input/Output Device)

input and output devices at a checkout:
- keypad - to key in the number of same items bought; to key in a weight, to key in the number under the barcode if it cannot be read by the barcode reader/scanner
- screen/monitor - to show the cost of an item and other information
- speaker - to make a beeping sound every time a barcode is read correctly; but also to make another sound if there is an error when reading the barcode
- printer - to print out a receipt/itemised list
- card reader/chip and PIN - to read the customer’s credit/debit card (either using PIN or contactless)
- touchscreen - to select items by touching an icon (such as fresh fruit which may be sold loose without packaging)
Barcode scanners(readers)
A barcode is a series of dark and light parallel lines of varying thickness. The numbers 0 to 9 are each represented by a unique series of lines.
Note there are different patterns for digits on the left-hand side and for digits on the right-hand side.


Each digit is made up of 2 dark lines and two light lines. The width representing each digit is the same.
Advantages to the management of using barcodes :
- much easier and faster to change prices on stock items (更容易改变商品库存信息和价格)
- much better, more up-to-date sales information/sales trends (更容易实时查看商品销售信息和趋势)
- no need to price every stock item on the shelves (this reduces time and cost to the management) (不需要给货架上的每一个商品都标记价格,只需要给编码标记价格就可以了)
- allows for automatic stock control (可以自动记录库存)
- possible to check customer buying habits more easily by linking barcodes to, for example, customer loyalty cards. (方便检查客户购物清单)
Advantages to the customers of using barcodes :
- faster checkout queues (staff don’t need to remember/look up prices of items) (更快的收费)
- errors in charging customers is reduced(减少收费错误)
- the customer is given an itemised bill (方便显示购物清单)
- cost savings can be passed on to the customer (节省的成本可以转嫁给客户)
- better track of ‘sell by dates’ so food should be fresher. (更好跟踪销售日期)
usages:
- Commodity barcode (商品条形码)
- Library book barcode - barcodes can be utilised in libraries where they are used in books and on the borrower’s library card. (图书馆书籍条形码)
Quick response (QR) codes
QR Code is made up of a matrix of filled-in dark squares on a light background.

- A QR code consists of a block of small squares (light and dark) known as pixels.It can presently hold up to 4296 characters (or up to 7089 digits) and also allows internet addresses to be encoded within the QR code. This compares to the 30 digits that is the maximum for a barcode. However, as more and more data is added, the structure of the QR code becomes more complex.
- The three large squares at the corners of the code function as a form of alignment; the remaining small corner square is used to ensure the correct size and correct angle of the camera shot when the QR code is read.
QR Code Uses
- advertising products (产品广告)
- giving automatic access to a website or contact telephone number (访问网站和联系电话)
- storing boarding passes electronically at airports and train stations. (电子登机牌)
Advantages
- They can hold much more information (能够保存更多的信息)
- There will be fewer errors; the higher capacity of the QR code allows the use of built-in error-checking systems – normal barcodes contain almost no data redundancy (data which is duplicated) therefore it isn’t possible to guard against badly printed or damaged barcodes (错误更少)
- QR codes are easier to read; they don’t need expensive laser or LED (light emitting diode) scanners like barcodes – they can be read by the cameras on smartphones or tablets (更易阅读)
- It is easy to transmit QR codes either as text messages or images (容易将二维码作为文本消息或者图像进行传输)
- It is also possible to encrypt QR codes which gives them greater protection than traditional barcodes. (可以对二维码进行加密)
Disadvantages
- More than one QR format is available (QR Code 种类较多,需要选择)
- QR codes can be used to transmit malicious codes – known as attagging. Since there are a large number of free apps available to a user for generating QR codes, that means anyone can do this. It is relatively easy to write malicious code and embed this within the QR code. When the code is scanned, it is possible the creator of the malicious code could gain access to everything on the user’s phone (for example, photographs, address book, stored passwords, and so on). The user could also be sent to a fake website or it is even possible for a virus to be downloaded. (二维码可能被用于传输恶意代码,本扫码攻击)
Input Devices

Digital Cameras
Modern digital cameras simply link to a computer system via a USB port or by using Bluetooth (which enables wireless transfer of photographic files).

What happens when a photograph is taken?
- the image is captured when light passes through the lens onto a light-sensitive cell; this cell is made up of millions of tiny sensors which are acting as photodiodes (i.e. charge couple devices (CCD) which convert light into electricity) (光线通过镜头进入感光元器件)
- each of the sensors are often referred to as pixels (picture elements) since they are tiny components that make up the image (每个传感器被称为像素)
- the image is converted into tiny electric charges which are then passed through an analogue to digital converter (ADC) to form a digital image array (图像被转换成微小电荷,通过ADC转换成图像)
- the ADC converts the electric charges from each pixel into levels of brightness (now in a digital format); for example, an 8-bit ADC gives 2 8 (256) possible brightness levels per pixel (for example, brightness level 01110011) (ADC将像素的电荷转换为亮度级别)
- apart from brightness, the sensors also measure colour which produces another binary pattern; most cameras use a 24-bit RGB system (each pixel has 8 bits representing each of the 3 primary colours), which means each pixel has a red value (0 to 255 in denary), a green value (0 to 255) and a blue value (0 to 255); for example, a shade of orange could be 215 (red), 165 (green) and 40 (blue) giving a binary pattern of 1101 0111 1010 0101 0010 1000 (or D7A528 written in hex) (传感器测量颜色,产生二进制图案)
- the number of pixels determines the size of the file used to store the photograph
- the quality of the image depends on the recording device (how good the camera lens is and how good the sensor array is), the number of pixels used (the more pixels used, the better the image), the levels of light and how the image is stored (JPEG, raw file, and so on). (图像质量取决于记录设备(镜头质量,传感器阵列),像素个数,光线水平和图像存储格式)
Digital cameras (after 2023)
Digital images taken by cameras can easily be transferred to a computer (or other device) via USB port, Bluetooth (wireless transfer) or memory card reader.
Microprocessors in the camera automatically control many camera functions, such as shutter speed, focus, aperture size, flash, ‘red eye’ removal and so on.
Keyboards
Keyboards are by far the most common method used for data entry.They are used as the input devices on computers, tablets, mobile phones and many other electronic items.
The keyboard is connected to the computer either by using a USB connection or by wireless connection. In the case of tablets and mobile phones, the keyboard is often virtual or a type of touch screen technology.
each character on a keyboard has an ASCII value. Each character pressed is converted into a digital signal, which the computer interprets.

how the computer recognises a letter pressed on the keyboard?
- There is a membrane or circuit board at the base of the keys
- the ‘H’ key is pressed and this completes a circuit as shown
- The CPU in the computer can then determine which key has been pressed
- The CPU refers to an index file to identify which character the key press represents (CPU引用一个索引文件来识别按键代表哪个字符)
- Each character on a keyboard has a corresponding ASCII value.
Keyboards (after 2023)
Physical keyboards (connected via USB or Bluetooth) or virtual keyboards (for example, on a smartphone or keyboard using the touchscreen features).
Each character on a keyboard has an ASCII value. The computer is able to detect which key is pressed, which allows it to determine the character that was selected.
Entry of data via a keyboard is a slow process which is also prone to error and can lead to injuries such as repetitive strain injury (RSI).
Microphones


Microphones are either built into the computer or are external devices connected through the USB port or using Bluetooth connectivity.
- When sound is created, it causes the air to vibrate.
- When a diaphragm in the microphone picks up the air vibrations, the diaphragm also begins to vibrate. (麦克风中的振膜通过空气的振动带动振动)
- A copper coil is wrapped around the cone which is connected to the diaphragm. As the diaphragm vibrates, the cone moves in and out causing the copper coil to move backwards and forwards. (一个铜线圈缠绕在与振膜相连的锥体上。 当隔膜振动时,锥体进出导致铜线圈前后移动)
- This forwards and backwards motion causes the coil to cut through the magnetic field around the permanent magnet, inducing an electric current. (前后运动会导致线圈切断永磁体周围的磁场,从而产生电流。)
- The electric current is then either amplified or sent to a recording device. The electric current is analogue in nature. (电流被放大然后发送到记录设备,电流是一个模拟信号)
Microphones (after 2023)
Microphones have a number of applications, for example, as a sensor (to detect sound in an intruder detection system), to input text into a computer (of particular benefit to a disabled person who cannot use a keyboard) or for doing voiceovers on presentation slides and so on.
Microphones convert sound into electric currents of varying amplitude. A diaphragm in the microphone vibrates and a copper coil and cone attached to the diaphragm create an electric current as the coil vibrates back and forth. The electric current can be converted into digital data and then stored in a computer memory.
Optical mouse (after 2023)
A mouse is used to move an on-screen cursor which allows the user to take actions
The optical mouse is an example of a pointing device. It uses tiny cameras and a red LED light source to allow the exact position of the mouse to be calculated.
Advantages of an optical mouse compared to a mechanical mouse
- There are no moving parts, therefore it is more reliable. (没有活动部件,更可靠)
- Dirt can’t get trapped in any of the mechanical components. (没有活动部件,所以不会有污垢残留在机械部件中)
- There is no need to have any special surfaces. (不依赖于特殊的表面)
Advantages of a wired mouse (using USB) compared to a wireless mouse
- Unlike Bluetooth, wired connections have no signal loss.
- Cheaper to use (no need for batteries).
- Fewer environmental issues (for example, disposal of batteries).
2D and 3D scanners
2D scanners - These types of scanner are the most common form and are generally used to input hard copy (paper) documents. The image is converted into an electronic form that can be stored in a computer.
Computers equipped with optical character recognition (OCR) software allow the scanned text from the document to be converted into a text file format. If the original document was a photograph or image, then the scanned image forms an image file such as JPEG.
3D scanners - 3D scanners scan solid objects and produce a three-dimensional image. Since solid objects have x, y and z coordinates, these scanners take images at several points along these three coordinates. A digital image which represents the solid object is formed.
usages:
- 2D scanners are used at airports to read passports. They make use of OCR technology to produce digital images which represent the passport pages. (2D可以用于机场扫描护照,通过OCR识别护照信息)
- Application of 3D scanning – computed tomographic (CT) scanners. Computed tomographic (CT) scanners are used to create a 3D image of a solid object. (3D 扫描用于CT扫描)
Touch Screens
Touch screens are now a very common form of input device. They allow simple touch selection from a menu to launch an application (app).
Capacitive touch screens
Capacitive touch screens are composed of a layer of glass (protective layer), a transparent electrode (conductive) layer and a glass substrate. Since human skin is a conductor of electricity, when bare fingers (or a special stylus) touch the screen, the electrostatic field of the conductive layer is changed.

There are presently two main types of capacitive touch screens - surface and projective
3.04 Output Devices
Output Devices

Actuators

An actuator is a mechanical or electromechanical device such as a relay, solenoid or motor.
Light projectors
two common types of light projector:
- digital light projector (DLP)
- liquid crystal display (LCD) projector.
Projectors are used to project computer output onto larger screens or even onto interactive whiteboards.
Digital light projectors (DLP)

The use of millions of micro mirrors on a small digital micromirror device (DMD chip) is the key to how these devices work.
Works in principle:
- A bright white light source (for example, from a xenon bulb) passes through a colour filter on its way to the DMD chip. (白光源通过滤色器传输到DMD芯片)
- The white light is split into the primary colours: red, green and blue – the DLP projector can create over 16 million different colours.
- The ON and OFF states of each micro mirror are linked with colours from the filter to produce the coloured image. (每个micro mirror 通过ON和OFF状态的颜色过滤器来产生彩色图像)
The DMD chip is a microoptoelectromechanical system (MOEMS) that contains several thousand microscopic mirrors (made out of polished aluminium metal) arranged on the chip surface. They are each about 16 µm (16 × 10 -6 metres) in size and each corresponds to a pixel in the displayed screen image.
Liquid crystal display (LCD) projector

These are older technology than DLP. Essentially a high-intensity beam of light passes through an LCD display and then onto a screen.
works in principle:
- a powerful beam of white light is generated from a bulb or LED inside the projector body
- this beam of light is then sent to a group of chromatic-coated mirrors (known as dichromic mirrors); these reflect the light back at different wavelengths
- when the white light hits these mirrors, the reflected light has wavelengths corresponding to red, green and blue light components
- these three different coloured light components pass through three LCD screens (each screen is composed of thousands of tiny pixels which can either block light or let it through; this produces a monochromatic image)... (三种不同颜色的光通过三个LCD屏幕产生单色图像)
- ... consequently, three different versions of the same image are now produced – one is the whole image in different shades of red, one is the whole image in different shades of green and one is the whole image in different shades of blue (形成了统一个图像的三个颜色分量的三个版本)
- these images are then re-combined using a special prism to produce a full colour image (重新组合成全彩色图像)
- finally, the image passes through the projector lens onto a screen. 图像通过投影镜投射到屏幕上

DLP:高对比度(contrast ratio)、高可靠性(relaability)、寿命更长(longevity)、速度更快(quick running)、机器更小
LCD:高锯齿(sharper image)、高饱和度(colour saturation)、发热量小
Inkjet printers

Inkjet printers are essentially made up of:
- a print head, which consists of nozzles that spray droplets of ink onto the paper to form characters
- an ink cartridge or cartridges; either one cartridge for each colour (blue, yellow and magenta) and a black cartridge or one single cartridge containing all three colours + black (Note: some systems use six colours)
- a stepper motor and belt, which moves the print head assembly across the page from side to side
- a paper feed, which automatically feeds the printer with pages as they are required.
steps:
- the data from the document is sent to a printer driver
- the printer driver ensures that the data is in a format that the chosen printer can understand
- a check is made by the printer driver to ensure that the chosen printer is available to print (e.g. is it busy, is it off- line, is it out of ink, and so on)
- the data is then sent to the printer and it is stored in a temporary memory known as a printer buffer (数据发送到打印机缓冲区)
- a sheet of paper is then fed into the main body of the printer; a sensor detects whether paper is available in the paper feed tray – if it is out of paper (or the paper is jammed) then an error message is sent back to the computer
- as the sheet of paper is fed through the printer, the print head moves from side to side across the paper printing the text or image; the four ink colours are sprayed in their exact amounts to produce the desired final colour (打印头在纸张左右移动,四色墨水喷涂)
- at the end of each full pass of the print head, the paper is advanced very slightly to allow the next line to be printed; this continues until the whole page has been printed (逐行打印)
- if there is more data in the printer buffer, then the whole process from stage 5 is repeated until the buffer is finally empty (重复以上过程打印缓冲区数据)
- once the printer buffer is empty, the printer sends an interrupt to the CPU in the computer; this is a request for more data to be sent to the printer; the whole process continues until the whole of the document has been printed
Laser printers
Laser printers use dry powder ink rather than liquid ink and make use of the properties of static electricity to produce the text and images. Unlike inkjet printers, laser printers print the whole page in one go. Colour laser printers use 4 toner cartridges – blue, cyan, magenta and black.
steps:
- the data from the document is sent to a printer driver
- the printer driver ensures that the data is in a format that the chosen printer can understand
- a check is made by the printer driver to ensure that the chosen printer is available to print (e.g. is it busy, is it off-line, is it out of ink, and so on)
- the data is then sent to the printer and it is stored in a temporary memory known as a printer buffer
- the start of the printing process involves a printing drum being given a positive charge; as this drum rotates, a laser beam is scanned across it removing the positive charge in certain areas; this leaves negatively charged areas that exactly match the text/images of the page to be printed
- the drum is then coated with positively charged toner (powdered ink); since the toner is positively charged, it only sticks to the negatively charged parts of the drum
- a negatively charged sheet of paper is then rolled over the drum
- the toner on the drum now sticks to the paper to produce an exact copy of the page sent to the printer
- to prevent the paper sticking to the drum, the electric charge on the paper is removed after one rotation of the drum
- the paper finally goes through a fuser which is a set of heated rollers; the heat melts the ink so that it fixes permanently to the paper
- at the very end, a discharge lamp removes all the electric charge from the drum making it ready to print the next page
Application of inkjet and laser printers
Inkjet printer – inkjet printers are often used for printing one-off photos or where only a few pages of good quality, colour printing is needed; the small ink cartridges or small paper trays would not be an issue with such applications.
Laser printer – these devices produce high quality printouts and are very fast when making multiple copies of a document; any application that needs high volume printing (in colour or monochrome) would choose the laser printer (for example, producing a large number of high-quality flyers or posters for advertising). Laser printers have two advantages: they have large toner cartridges and large paper trays (often holding more than a ream of paper).
Inkjet Printer: 少量打印,打印照片
Laser Printer: 大量打印,快速打印
3D printers
3D printers are used to produce solid objects that actually work. They are primarily based on inkjet and laser printer technology.
How to create a solid object using 3D printers
- A design is made using computer aided design (CAD) software
- The finalised drawing is imported into some special software that prepares it in a format that is understood by the 3D printer
- The 3D printer is first set up to allow the solid object to be made
- The solid object is built up layer by layer (often only 0.1 mm thick); this can take several hours depending on the thickness of the layers, the material used and the size of the final object
- The object is removed from the printer and is then prepared; for example, some use a jelly-like support that needs to be washed away by immersion in water, some require the removal of excess plastic powder and others require the cutting away of unused material; in many cases, the object has to be left to ‘cure’ for a few hours.
uses of 3D printing
- the covering of prosthetic limbs can be made to exactly fit the limb (假肢)
- making items to allow precision reconstructive surgery (e.g. facial reconstruction following an accident); the parts made by this technique are more precise in their design since they can be made from exact scanning of the skull (精准的重建手术,对骨头精准扫描)
- in aerospace, manufacturers are looking at making wings and other parts using 3D technology; the bonus will be lightweight precision parts (航空航天轻量级精密零件)
- fashion and art – 3D printing allows new creative ideas to be developed
- making parts for items no longer in production e.g. suspension parts for a vintage car. (不在批量生产的汽车零部件)
LED screens
An LED screen is made up of tiny light emitting diodes (LEDs). Each LED is either red, green or blue in colour. By varying the electric current sent to each LED, its brightness can be controlled, producing a vast range of colours.
Recent advancements in LED technology have led to the introduction of OLED (organic LED) screens (see later).
LCD Screens
LCD screens are made up of tiny liquid crystals. These tiny crystals make up an array of pixels that are affected by changes in applied electric fields.
Because LCD’s don’t produce any light, LCD screens are back-lit using light emitting diode (LED) technology and must not be confused with pure LED screens.
Organic light emitting diodes (OLED)
Newer LED technology is making use of organic light emitting diodes (OLEDs). These use organic materials (made up of carbon compounds) to create semiconductors that are very flexible.

Advantages of using OLED compared to existing LEDs and LCDs:
- The plastic, organic layers of an OLED are thinner, lighter and more flexible than the crystal structures used in LEDs or LCDs. (OLED更薄,更轻,更灵活)
- The light-emitting layers of an OLED are lighter; OLED layers can be made from plastic rather than the glass as used in LED and LCD screens. (OLED 层可以使用塑料制成)
- OLEDs give a brighter light than LEDs. (OLED比LED更亮)
- OLEDs do not require backlighting like LCD screens – OLEDs generate their own light. (OLED不需要背光)
- Since OLEDs require no backlighting, they use much less power than LCD screens (most of the LCD power is used to do the backlighting); this is very important in battery-operated devices such as mobile phones. (OLED 比 LCD节电)
- Since OLEDs are essentially plastics, they can be made into large, thin sheets (this means they could be used on large advertising boards in airports, subways, and so on).
- OLEDs have a very large field of view, about 170 degrees, which makes them ideal for use in television sets and for advertising screens. (OLED可视范围更大)
Loud Speakers

Loudspeakers are output devices that produce sound.
principle :
- The digital data is first passed through a digital to analogue converter (DAC) where it is changed into an electric current.
- This is then passed through an amplifier (since the current generated by the DAC will be very small); this creates a current large enough to drive a loudspeaker. (通过放大器产生足够大的电流来驱动扬声器)
- This electric current is then fed to a loudspeaker where it is converted into sound. (通过扬声器转换为声音)
Sensors
Sensors are input devices which read or measure physical properties from their surroundings.
Sensors constantly send signals to a microprocessor (or computer); they usually pass through an analogue to digital converter (ADC) first since computers can only understand binary (digital) data.

3.03 Data storage
存储
存储金字塔

各级缓存分别对应哪些位置?
Memory and Storage
All computers require some form of memory and storage.
Memory is usually referred to as the internal devices used to store data that the computer can access directly.This memory can be the user’s workspace, temporary data or data that is key to running the computer.
Storage devices allow users to store applications, data and files. The user’s data is stored permanently and they can change it or read it as they wish.


主存储器

存储体由许多的存储单元组成,每个存储单元里面又包含了若干个存储原件,每个存储元件可以存储一位二进制数 0/1。
一个存储单元可以存储一连串的二进制代码,这串二进制代码被称为一个存储字,代码的位数为存储字长
在存储体中,存储单元是有编号的,这些编号称为存储单元的地址号。
MAR叫做存储地址寄存器,保存的是存储单元的地址,其位数反映了存储单元的个数
MDR表示存储数据寄存器,其位数反映存储字长。MDR存放的是从存储原件读出,或者要写入某存储原件的数据。
~ CPU读写主存储器的流程?
Primary memory
Primary memory is the part of the computer memory which can be accessed directly from the CPU; this includes random access memory (RAM) and read-only memory (ROM) memory chips.

Random access memory (RAM)
These memory devices are not really random; this refers to the fact that any memory location in RAM can be accessed independent of which memory location was last used.
feature:
- can be written to or read from, and the data can be changed by the user or the computer (i.e. it is a temporary memory)
- used to store data, files, part of an application or part of the operating system currently in use
- it is volatile (易失性), which means memory contents are lost when powering off the computer.
Dynamic RAM (DRAM)

Each DRAM chip consists of transistors(晶体管) and capacitors(电容). Each of these parts is tiny since a single RAM chip will contain millions of transistors and capacitors.
- capacitor – this holds the bits of information (0 or 1)
- transistor – this acts like a switch; it allows the chip control circuitry to read the capacitor or change the capacitor’s value.
This type of RAM needs to be constantly refreshed (that is, the capacitor needs to be re-charged every 15 microseconds otherwise it would lose its value). If it wasn’t refreshed, the capacitor’s charge would leak away very quickly leaving every capacitor with the value 0.
DRAM advantages:
- they are much less expensive to manufacture than SRAM
- they consume less power than SRAM
- they have a higher memory capacity than SRAM.
Static RAM (SRAM)
A major difference between SRAM and DRAM is that SRAM doesn’t need to be constantly refreshed.
SRAM is much faster than DRAM when it comes to data access (typically, access time for SRAM is 25 nanoseconds and for DRAM is 60 nanoseconds).
SRAM & DRAM
SRAM主要用于二级缓存(Level2 Cache。与DRAM相比,SRAM的速度快,但是在相同面积中SRAM的容量要比其他类型的内存小
DRAM主要用于主存,内存条中。


Read-only memory (ROM)
Another form of primary memory is read-only memory (ROM). This is similar to RAM in that it shares some of its properties, but the main difference is that it cannot be changed or written to.
features:
- they are non-volatile (非易失性)(the contents are not lost after powering off the computer)
- they are permanent memories (the contents cannot be changed or written to by the user, the computer or any application/program)
- the contents can **only be read **
- they are often used to store data that the computer needs to access when powering up for the first time (the basic input/output system (BIOS)); these are known as the start-up instructions (or bootstrap)
RAM & ROM

Secondary and off-line storage
Secondary (and off-line) storage includes storage devices that are not directly addressable by the CPU.
They are non-volatile devices that allow data to be stored as long as required by the user.
This type of storage can store more data than primary memory, but data access time is considerably longer than with RAM or ROM.
Magnetic, optical and solid-state storage
Magnetic storage (磁存储器)


Hard disk drives (HDD) are still one of the most common methods used to store data on a computer.
- Data is stored in a digital format on the magnetic surfaces of the disks (or platters, as they are frequently called). 数据存储在磁盘片上
- The hard disk drive will have a number of platters that can spin at about 7000 times a second. 硬盘有很多盘片并且保持同时每秒约7000转的转速
- Read-write heads consist of electromagnets that are used to read data from or write data to the platters. 读写头从盘片上读或者写数据
- A number of read-write heads can access all of the surfaces of the platters in the disk drive. 每个硬盘会有多个读写头,分别访问每个盘片
- Data is stored on the surface in sectors and tracks. 数据存储在扇区和磁道上
- A sector on a given track will contain a fixed number of bytes.
- hard disk drives have very slow data access when compared to, for example, RAM.
- The effects of latency then become very significant. Latency is defined as the time it takes for a specific block of data on a data track to rotate around to the read-write head.
Removable hard disk drives(移动硬盘) are essentially HDDs external to the computer that can be connected to the computer using one of the USB ports.
Solid state drives (SSD)
Latency is an issue in HDDs as described earlier. Solid state drives (SSD) remove this issue considerably since they have no moving parts and all data is retrieved at the same rate.
SSDs operate by controlling the movement of electrons within NAND or NOR chips. The data is stored as 0s or 1s in millions of tiny transistors.
Memory sticks, flash memories, SD cards and SSDs all use solid-state technology.
The main benefits of this newer solid state technology over hard disk drives are:
- they are more reliable (no moving parts to go wrong) 更可靠
- they are considerably lighter (which makes them suitable for laptops) 相当轻
- they don’t have to ‘get up to speed’ before they work properly 不需要启动速度
- they have a lower power consumption 节点
- they run much cooler than HDDs (both these points again make them very suitable for laptop computers) 温度低
- because of no moving parts, they are very thin 轻便
- data access is considerably faster than HDD. 数据访问快
Memory sticks/flash memories

Memory sticks/flash memories (also known as pen drives) use solid state technology.
They usually connect to the computer through the USB port. Their main advantage is that they are very small, lightweight devices, which make them very suitable as a method for transferring files between computers.
Complex or expensive software, such as financial planning software, often uses memory sticks as a dongle(加密狗).
Optical media
CD/DVD disks
CDs and DVDs are described as optical storage devices. Laser light is used to read and write data to and from the surface of the disk.
Blu-ray discs
Blu-ray discs are another example of optical storage media. However, they are fundamentally different to DVDs in their construction and in the way they carry out read-write operations.
The main differences between DVD and Blu-ray are:
- a blue laser, rather than a red laser, is used to carry out read and write operations; the wavelength of blue light is only 405 nanometres (compared to 650 nm for red light)
- using blue laser light means that the ‘pits’ and ‘lands’ can be much smaller; consequently, Blu-ray can store up to five times more data than normal DVD
- single-layer Blu-ray discs use a 1.2 mm thick polycarbonate disk; however, duallayer Blu-ray and normal DVDs both use a sandwich of two 0.6 mm thick disks (i.e. 1.2 mm thick)
- Blu-ray disks automatically come with a secure encryption system that helps to prevent piracy and copyright infringement
- the data transfer rate for a DVD is 10 Mbps and for a Blu-ray disc it is 36 Mbps (this equates to 1.5 hours to transfer 25 GiB of data).

Virtual memory
One of the problems associated with memory management is the case when processes run out of RAM. If the amount of available RAM is exceeded due to multiple programs running, it is likely to cause a system crash. This can be solved by utilising the hard disk drive (or SSD) if we need more memory. This is the basis behind virtual memory. Essentially RAM is the physical memory, while virtual memory is RAM + swap space on the hard disk or SSD.
Benefits of virtual memory
- With virtual memory, programs can be larger than physical RAM and still be executed.
- Virtual memory reduces the need to buy and install extra RAM (which is expensive).
Cloud storage
Cloud storage is the storing of vast quantities of data on remote physical servers.
There are three types of cloud storage
- Public cloud – the client and cloud storage provider are different companies.
- Private cloud – a dedicated system behind a firewall where the client and storage provider operate as a single entity.
- Hybrid cloud – a combination of public and private cloud provider where the most sensitive data is stored on the private cloud.
When using cloud storage, the same data is stored on more than one server in case of maintenance/repair – this is called data redundancy.
Benefits of cloud storage
- Customer/client files stored on the cloud can be accessed at any time from any device anywhere in the world provided internet access is available.
- There is no need for a customer/client to carry an external storage device with them, or even use the same computer to store and retrieve information.
- The cloud provides the user with remote back-up of data with obvious benefits to alleviate data loss/ disaster recovery.
- If a customer/client has a failure of their hard disk or back-up device, cloud storage will allow recovery of their data.
- The cloud system offers almost unlimited storage capacity.
Drawbacks of cloud storage
- If the customer/client has a slow or unstable internet connection, they would have many problems accessing or downloading their data/files.
- Costs can be high if large storage capacity is required; it can also be expensive to pay for high download/ upload data transfer limits with the customer/client internet service provider (ISP).
- The potential failure of the cloud storage company is always possible – this poses a risk of loss of all back-up data.
- Data security issues – how safely stored and protected is the data from hacking, natural disasters and malware?
3.04 Network hardware
Network interface card
A network interface card (NIC) is needed to allow a device to connect to a network (for example, the internet). The NIC contains the Media Access Control (MAC) address, generated at the manufacturing stage. Wireless NICs (WNICs) can also be used; these plug into the USB port or can be part of an internal integrated circuit.
Media Access Control addresses
MAC addresses identify a device connected to a network. They are made up of 48 bits written in groups of six hex digits.

MAC addresses can be Universally Administered MAC addresses (UAAs) set at the manufacturing stage, or they can be altered by the user as Locally Administered MAC Addresses (LAAs) – these can be reset by the user if all devices on a network need a certain MAC format.
Internet Protocol addresses
When a device connects to a network, a router assigns the device an Internet Protocol (IP) address, via a Dynamic Host Configuration Protocol (DHCP) server, which is unique to that network.
- IPv4 (32-bit address with the format A.B.C.D where A, B, C and D can take the values 1 to 255; for example, 215.180.1.80)
- IPv6 (128-bit address with the format eight groups of four hex digits; for example, A8FB:7A88:FFF0:0FFF:3D21:2085:66FB:F0FA).
IP addresses can be static or dynamic.
the difference between dynamic and static ip address

the differences between a MAC address and an IP address

Routers
Routers enable data packets to be routed between different networks, for example a local area network (LAN) to a wide area network (WAN).
Routers take data transmitted in one format (protocol) from network ‘A’ and convert the data to another format (protocol) that network ‘B’ understands.
Routers inspect data packets sent to it from another device or network. Every device on the same network has the same part of an IP address (for example, 215.164.10.XX) so the router can send data packets to an appropriate switch. The switch then directs the data packet to the correct device on the network.