1. 3.1.3 Embedded Systems
1.1. An embedded system is a **small** computer designed to **perform one specific function**
1.2. Many operate in real time: **react immediately** to an external event/request.
1.2.1. At the heart of an embedded system is a **microcontroller** consisting of a CPU, memory, **input/output ports** and circuitry - all on one chip
1.2.1.1. Firstly, **input devices** supply an embedded system with **external information.** Data received from an input device such as a sensor is stored temporarily in the Microcontroller's RAM.
1.2.1.2. The CPU interprets and **acts based on data** stored in flash memory (permanant).
1.2.1.3. Sometimes may trigger an actuator: converts output from microcontroller into **mechanical action**
2. A - level Computer Science
2.1. Section 1: Components of a computer
2.1.1. Chapter 5: Output Devices
2.1.1.1. Printers
2.1.1.1.1. Laser Printers: they offer high-quality, high-speed printing. It's similiar to that of a photocopier, using powdered ink called toner. Coloured Laser Printers contain 4 cartridges (Cyan, Magenta, Yellow, Black - CMYK). Paper comes from the paper tray, and a print drum is rolled upon it: a laser unit reflects off a mirror onto the print drum that is connected to a toner hopper. Then the paper passes through the heated fuser (does 4 times for CMYK) and exits the printer.
2.1.1.1.2. Inkjet Printers: they work by spraying tiny dots of ink onto paper to create an image. Dependent of the resolution (dots per inch) of the model, the number of colour cartridges used and the quality of paper. With this they can produce excellent, photo-realistic images
2.1.1.1.3. Dot Matrix Printers: these are known as impact printers. The print head has a matrix of pins which strike the surface of the paper through an inked ribbon to form letters.
2.1.1.1.4. 3D Printers: have been used to create car and aeroplane parts, medical equipment, prosthetic limbs, fashion accessories etc. Controversially used for firearms. It exposes a photosensitive liquid resin to a UV-laser beam, the resin hardens in the desired pattern and built up layer by layer
2.1.2. Chapter 4: Input Devices
2.1.2.1. Barcodes
2.1.2.1.1. Started appearing on grocery items in the 70s and is used to identify many different things. There are linear barcodes and 2D barcodes (e.g Quick Response - QR used in plane tickets etc) which can hold a lot more. There are 4 types....
2.1.2.1.2. Check digit: an appended digit on the end of barcodes (equal to the sum of the previous lines of barcode). To check if it's valid, the check digit should equal the sum of the lines of barcodes before it.
2.1.2.2. Radio Frequency Identification (RFID)
2.1.2.2.1. Uses both input and output: an input device to read the signal from an RFID chip, and output to transmit a signal from an active tag. There can also be a transmittion of data between the two. These are used to identify and track different products and can be read without a line of sight up to 300 metres away.
2.1.2.3. Optical Character Recognition (OCR)
2.1.2.3.1. OCR converts printed media into editable text documents after they have been scanned.
2.1.2.4. Optical Mark Recognition (OMR)
2.1.2.5. Magnetic Ink Character Recognition
2.1.2.5.1. MICR is a technology used to read characters printed with a special magnetic ink. It is commonly used in the finance industry such as processing checks or other financial documents
2.1.2.6. Touch Screen (Resistive and Capacitive)
2.1.2.7. Concept Keyboard
2.1.3. 1.1.3 Secondary Storage
2.1.3.1. **Magnetic Storage:** Magnetic storage uses the fact that magnets have **north and south poles.** By magnetising something, the north and south poles can **represent the 1s and 0s of your data.** An example is a hard disk drive and a floppy disc
2.1.3.1.1. Inside a hard drive is a **stack of disks called platters.** The surface of each platter has thin magnetic coating and is **divided into billions of areas,** each can be individually magnetised.
2.1.3.2. **Optical Storage:** Examples, a CD, DVD and BluRay disk. It uses **differences in light reflected** off the **surface of a disk** to represent 1s and 0s of your data The player uses **two** lasers: one to write onto and one to read the disk.
2.1.3.2.1. Write: **laser heats** recording material, which **changes its form** to become **more or less reflective.** Reflective areas are lands **(flat areas)** that represent **1.** Less reflective areas **(pits)** represent **0.** Read: laser beam shone onto the surface and a light sensor **detects the amount of light reflected** and then **translated** to 0s and 1s.
2.1.3.3. **Solid-state storage:** no moving parts and very energy efficient. Uses chips called **NAND flash,** comprised of special kinds of **transistors that can trap electrons** in a 'pool.' **Full pools** represent **0s,** **empty** represents **1s.** Billions can be fitted onto a single chip.
2.1.3.3.1. Written with **very precise electrical charges that cause electrons to move between 2 pools.** A higher voltage pulls more electrons which block current flow. This is 0 and flow is 1. To read, **control signals identify which bit to read.** Empty electron pool -> Transistor on -> 1 is read out. Full electron pool -> Transistor off -> 0 is read out. Overtime causes damage to hard drive and **limits life** of it.
2.1.3.4. Flash memory uses these and used in microcontrollers (3.1.3)
3. Internet of Things
3.1. A network of **physical objects** that use technology such as Wi-Fi and bluetooth to **collect and exchange data** with minimal or no human interaction.
4. 3.2 Software
4.1. Software is the set of programs that run on a computer system. There are 3 types...
4.1.1. Operating system - a program that controls/manages the hardware and all other software on a computer which provides an interface for liveware (users of computer systems).
4.1.1.1. The OS is responsible for organising and keeping track of files stored on a computer's secondary storage which are then loaded onto main memory.
4.1.1.2. **Managements**
4.1.1.2.1. Process Management: A **process** is a **program** that is **loaded into main memory and is being executed.** Usually, there are many processes occuring **concurrently** (at the same time) therefore the OS allocates each of them a **share** of the CPU (multitasking), uses a **scheduling algorithm.**
4.1.1.2.2. Peripharal management: each **peripheral device (e.g printers, keyboards and headphones)** is attached to its own **device driver** (software that **relays info** between peripheral and OS). Also used in process management and the device driver is used to **communicate.**
4.1.1.2.3. User Management: the OS also runs the **user interface** (the way in which the user **interacts** with the computer system) e.g GUI (graphical user interface - windows) or CLI (command - line text interface). It's responsible for **access control and authentication**
4.1.2. Application software - programs or apps designed for end users.
4.1.3. Utility software - programs that add functionality to a computer system or improve its performance (e.g anti-malware or compression)
4.1.3.1. File repair tool: scans the damaged file (e.g from malware or device malfunction), extracts as much data from it as possible and stores it in a new usable file
4.1.3.2. Backup tool: it can be configured to automatically backup data stored on a computer's hard drive to another location
4.1.3.3. Data compression: like lossy and lossless compression
4.1.3.4. Disk fragmentation: over time, a disk becomes fragmented (blank spaces due to adding/deleting). This takes longer for the mechanical parts to get above the specific area that has data so DF removes blank spaces. Doing it to an SSD likely shortens it's lifespan as it has no moving parts so unecessary.
4.1.3.5. Anti malware software: i.e signatures and heuristics
4.2. Making better code
4.2.1. Robust Software: capable of making code that can handle the unexpected without crashing, generating an incorrect output or revealing sensitive data.
4.2.1.1. Code vulnrebality: a flaw in a program that compromises security (languages have these). For example C and C++ language can access memory directly (useful) but hackers can use this as a back door
4.2.2. Bad programming practice: 1. writing unstructured code without comments/directions instead of seperating into subprograms - structured is much easier to understand. 2. not sticking to agreed coding practices and standards.
4.2.3. Code reviews: designed to spot instances of poor programming practice or vulnrebalities
4.2.3.1. Review by a programmer: someone with more experience and can check for lots of improper stuff. However, time-consuming and fairly labour intensive
4.2.3.2. Review by an automated system: a software overlooks the code and can spot most common methods. However, may not be bespoke.
4.2.4. Audit trials: keeps track of who and when things were changed - reduces errors and improves accountability + recovery available
5. What is a computer?
5.1. A computer is a machine that takes some sort of input from its surroundings and then processes it to produce an output.
6. 3.3 Programming Languages
6.1. Levels
6.1.1. Assembly Language is a **low-level** **language - lowest level of detail.** Assembly uses **mnemoics** - codes that represent strings of binary. Used from instruction set, all the possible commands a particular CPU can do. The language **translator** (assembler) replaces each mnemonic with appropriate binary code.
6.1.1.1. Why low level is harder: 1. very **limited range of instructions available** so every task has to be built up by the smallest of steps. 2. Debugging can be more difficult. 3. There are no strings or real numbers, just binary - you have to decide and manage where stored, very tedious!
6.1.2. High level languages have to **also be translated into machine code** in order for computer to execute it. Such as Python, Visual Basic or Java
6.2. Compiled vs Interpreted
6.2.1. A translator that translates the whole program in one go is called a **compiler,**(C and C++) and one that translates and runs the program one line at a time is called an **interpretor.** (Python and JavaScript)
6.2.1.1. Therefore Compiler code such and C and C++ are **quicker** and more **efficient.** Original source code is **unseen** by user because only an **executable file** is given to the user however **harder** to use as hard to spot mistakes as **reported in batch.**
6.2.1.2. Therefore Interpreted code such as python is **slower.** The original source code is **visible** to the user as it needs to be given in order to run however **easier** to use as **mistakes are easy to recognise.**
6.2.2. Compiled languages are more low-level than interpreted