Uploaded by jamilaimanjazelan

cs p1

advertisement
CHAP 1: Data representation
Denary - base 10, 0-9, used by humans
Hexadecimal - base 16, 0-9 and a-f, used by programmers
Binary - base 2, used by computers
To convert hexadecimal to denary;
1) conv to binary
2) conv binary to denary
Uses of hexadecimal system
1)
2)
3)
4)
Error codes
IPV6 address
MAC address
HTML colour codes
Error codes
- Refers to memory location of where error occurred
IPv6 ( internet protocol)
- A 128 bit (32 hex) number broken into 16 bit chunks
- Uses : to separate bits
MAC address (media access control)
- Refers to a number that identifies a device on the internet
- Made of 48 bits
- 6 groups of hexa digits
NN:NN:NN:DD:DD:DD
HTML colour codes (hypertext mark-up language)
- Not a programming language
- Used to develop/ design web pages
#FF 00 00
#00 FF 00
#00 00 FF
#FF FF FF white
#00 00 00 black
Representation of text and sound
-
Character sets: set of characters recognized by a variety of systems
ASCII
UNICODE
Sound representation
-
Analogue signal → digital signal using ADC
ADC is capable of taking multiple samples per second (sample rate)
Sample rate: number of wavelengths samples per second
➔ Determines quality of audio
Bit depth/ sample resolution: number of bits used to store each sample
Advantages of high sampling resolution
➔ Larger dynamic range
➔ Better sound quality
➔ Less sound distortion
Disadvantages
➔ Big file size
➔ Takes longer to download/ transmit
➔ Requires greater processing power
Image representation
-
Image: grid of pixels
Image w matrix of pixels: bitmap image
Each pixel is represented by a binary number
Image resolution: number of pixels in an image
Colour depth: number of bits used to represent each colour
➔ 8 bit colour depth: 256 shades
Advantages of high image resolution
➔ Better image quality
➔ Better colour
Disadvantages
➔ Big file size
➔ Takes longer to download/ transmit
➔ Impacts no. of images that can be stores
Data compression
-
Transmit files using lower bandwidth (transmission capacity of a computer network)
To save storage
Reduce time taken to download/ transmit file/ stream audio file
Reduce cost of cloud storage
Lossy compression
-
Eliminate unnecessary data. Original file cannot be reconstructed
Details will be lost compared to original file
Jpeg (joint photographic expert group)
➔ Reduces colour depth
MP3 / MP4 (motion photographic expert group)
➔ Perceptual music shaping - two overlapping sounds; removes softer sounds
➔ Removes sounds outside of human hearing range
Lossless compression
-
Data can be reconstructed after compression
Used when data loss is disastrous
RLE (run length encoding)
➔ Reduces size of long string of identical data
Data transmission
Data packets
-
Data is broken up into packets and transmitted using different routes
Yay : good when a route is busy
Boo : 1) packets need to be reassembled at destination
2) might get lost during transmission
Packet structure
Header
- Ip address of receiver
and sender
- sequence no. of packet
- size of packet
payload
trailer
- data
- method of identifying end of packet
- CRC error detection
CRC (cycle redundancy check)
1) Sender’s computer will calculate all the number of 1’s in the payload and store it as a
hex value
2) Receiver computer will recalculate and compare with hex number sent
3) If different, packets will be need to resent
Packet switching
-
Packets taking different routes to reach its destination
Routes taken depends on router
When packets arrive, they need to be reassembled using the identification data from the
header and trailer
Trailer is checked w parity (number of 1’s)
Advantages
➔ Possible to overcome busy/ faulty routes
➔ High data transmission
➔ Easy to expand package usage
➔ No need to tie up single communication line
Disadvantages
➔ Might get lost during transmission
➔ Have errors w real time streaming
➔ Delay at destination while being reassembled
-
Packets might get lost during transmission due to bouncing from one router to another,
which might cause the network to freeze
Router hopping is implemented to overcome this
Hop number is placed at header of each packet, everytime it bounces off a router, hop
number reduces by one
If hop number reaches 0, packet will be resent
Transmission methods
Simplex
half duplex
full duplex
Transmission types
Serial
- data transmitted one bit at a time over
a single wire
parallel
- data transmitted multiple bits at a time over
multiple wires
Advantages
- more accurate
- works well over long distance
- data is fully synchronised
Advantage
- fast
- works well over short distance
Disadvantage
- slow
Disadvantage
- data can arrive skewed
- longer wire, higher chances of errors
USB (universal serial bus)
-
Serial data transmission
Most common input/output port on computers
Half duplex/ full duplex
Plugging usb device into comp:
1) Comp automatically detects the device
2) If device recognised, device driver will load up allowing device n comp to communicate
3) If unrecognised, appropriate device driver will be downloaded
Advantages
- automatically detects device
- backwards compatible
- most devices use USB
- easy to add more USB hubs
- supports diff transmission rates
Disadvantage
- max cable length of 5 m
- earlier versions of USB may not be supported
by latest computers
- slow transmission rates (compared to ethernet
connections)
USB-C
-
24 pin symmetrical connecter
Small n thinner compared to USB
20v power connectivity: full sized devices can carry data n charge at 10 gb/s
Expected to be new industry standard
Error detection
Errors occur due to
➔ Interference
➔ Problems during packet switching
➔ Skewing of data
1) parity check
2) checksum
3) echo check
4) ARQ: automatic repeat request
5) check digit
Parity check
-
Parity: number of 1’s in a bit
Can either be odd/even
1) agreement between sender/receiver is made if parity is odd/even
2) when receiver receives data, parity will be calculated; if meets protocol = no errors
Limitations:
➔ Exact location of error cant be detected if only one bit is transmitted
➔ Error cannot be detected if an even number of bits is changed
→ parity blocks used to overcome this
Checksum
-
Data sent in blocks along w an additional value (checksum) at the end of the block
1) checksum value calculated from a block of data b4 transmission
2) calculation is done by an agreed algorithm,
3) checksum value sent w block of data
4) once received, checksum value is recalculated and compared
5) if the value is the same, no errors. Otherwise, request will be sent out to resend data
Echo check
-
Data is sent to another device, copy of same data would be resent to compare
Not reliable. Errors could happen at any stage
ARQ
1) sender sends data w an error checking code at end of data
2) code is used to see if any errors occurred
3) if no errors, acknowledgement will be sent
→ a message to indicate that data is received
→ either pos/ neg (error)
4) a time out is used by sender device
→ a predetermined amount of time to wait for an acknowledgment
5) if no acknowledgment is sent during the time out period, data will automatically be resent until
pos acknowledgment is received
Check digit (data entry error detections)
-
Final digit included in a code. Calculated from all the other digits in a code
Used in ISBN, VIN
Can detect:
→ phonetic errors
→ omitted numbers
→ transposition errors
→ incorrect digit entered
Encryption
-
Representing data using different characters
Used to protect data from hackers
→ doesn't prevent hacking; makes data useless
1) symmetric
- Uses 1 key to encrypt and decrypt
-
Key interception problem
2) asymmetric
- Uses 2 keys. Public and private
1) Receiver makes public key and private key. Keys are mathematically linked but cannot
be derived from one another
2) Receiver sends public key to sender
3) S uses public key to encrypt
4) R uses private key to decrypt
CHAP 3: HARDWARE
COMPUTER ARCHITECTURE
➔
➔
➔
➔
➔
➔
➔
CPU
Von neumann architecture
ALU, CU and registers
Control, address and data bus
Cores, cache and internal clock
Fetch, Decode, Execute cycle
Embedded systems
-
A comp is made of external and internal components
Basic principles across all devices are the same
1) CPU: central processing unit
-
Known as microprocessor
Central to all modern computers
Installed as an integrated circuit on a single microchip
Responsible for all operations in a computer
Cpu consists of:
➔ CU (control unit)
➔ ALU ( arithmetic and logic unit)
➔ Registers and busses
➔ System clock
2) von neumann architecture
➔
➔
➔
➔
To store programs and data in a memory
CPU
Can access memory directly
Comp to store programs n data
Stored programs were made of instructions which could be executed in sequential order
ALU
-
Allows required arithmetics (+ - nd shift) or logic (AND, OR, NOT) operations
Results of these operations is stored in accumulator
CU
-
Reads instruction from memory and writes in memory using buses
Coordinates all operations during executing instructions
REGISTERS
- Fast access memory that holds data and instructions during manipulation
REGISTER
SHORT FORM
USAGE
Current instruction register
CIR
Stores current information
Accumulator
ACC
Stores results of ALU
operations
Memory address register
MAR
Stores address of memory
location currently being
read/written
Memory data register
MDR
Stores data of memory
location currently being
read/written
Program counter
PC
Stores address of next
location
System bus
To connect cpu to memory and input/output address
ADDRESS BUS (unidirectional)
Carries signals relating to addresses between
processor to memory
CONTROL BUS (unidirectional)
Carries control signal (read/write) and
coordinates all activities within a computer.
From processor to memory
DATA BUS (bi-directional)
Sends data between processor, memory and
input/output device
⭐
READ OPERATION
1) Address of location will be in MAR
2) Read signal sent by CU is sent to memory unit via control bus
3) Content of memory location is stored in MDR
⭐
WRITE OPERATION
1) New value stored in MDR
2) Address of location stored in MAR
3) Write signal sent by CU is sent to memory via control bus
3) fetch, execute, decode
-
To carry out instructions, data needs to be fetched and stored in suitable registers
1) CPU fetches instructions from memory and is stored in registers
2) Address bus is used to store location and data bus is used to store instructions
3) Decodes in binary then will be executed
FETCH
1) address of next location will be stored in PC
2) address is copied to MAR
3) instructions from MAR will be copied into MDR
4) instructions from MDR will be stored in CIR
5) PC will increase by 1
6) instructions will be decoded by CU
7) instructions will be executed by ALU
8) results of ALU will be stored in ACC
4) factors of cpu performance
➔ System clock
➔ Cache
➔ Cpu cores
System clock
- Small quartz circuit that generates electrical impulses in CPU
- Controls timing of all computer operations
- Part of system clock is called clock speed, measured by pulses per second
- 1 gigahertz = 1b electrical impulses
- Faster clock, more instructions could be executed
Cache
- Modern CPU chips have built in mini RAM’s called cache memory
- Used where a processor has instructions and data it needs regularly
→ used when fast data access is needed
- When CPU reads memory, it checks cache first then RAM
- The bigger the cache, the less time it takes for a processor to fetch instructions
CPU cores
- CU + ALU + REGISTER = processing core
- More core = more execution of instructions at the same time
- BUT more cores = reduce overall performance → more cores need to communicate w
CPU
Buses width
- Larger bus = more instructions/data carried
Overclocking
- High clock speed = data fetching: faster than original clock speed → cpu unable to
execute instruction before next instruction arrives → crashing, overheating = unreliable
performance
5) instruction sets
-
Set of common instructions
→ set of operations decoded in sequence
-
Instruction is made of OPCODE and OPERAND
OPCODE
OPERAND
→ short for operation code
→ data required for specific job as detailed by
OPCODE
→ informs CPU what to do
→ may be piece of data or address location
within RAM or register
→ stored on hard disk n copied to RAM when
comp is powered on
→ most used OPCODE will be in cache
instead of RAM
6) embedded systems
-
Combination of hardware and software that’s designs to carry out specific set of
functions
→ hardware: electrical/ electro-mechanical/ electronic
MICROCONTROLLERS
MICROPROCESSOR
SoC (system on chip)
CPU,RAM,ROM + other
peripherals embedded onto
one chip to carry out a
specific task
Integrated circuit w cpu
microcontroller (cpu, memory,
input/output ports and
secondary storage on a
single microchip)
Embedded systems are either
➔ Programmable
➔ Can be updated
➔ w wifi (automatic)
➔ Connect to PC and download update to software
➔ Non programmable
➔ Cant be updated
Advantages
- small n easy to carry
- cheap
- consume little power
disadvantages
- any device that can be accessed
over the internet can be hacked
n can get virus
- usually thrown away due to difficulty
in updating
- troubleshooting faults in device
becomes specialty task
INPUT DEVICES
1) Barcode scanners
-
A series of dark and light parallel lines with varying thickness
1)
2)
3)
4)
Barcode is read with red laser
Dark lines absorb light, light lines reflect line
Reflected light is read by sensor (photoelectric cells)
Pattern is generated which is converted into digital data → computer can understand
barcode
5) Barcode will be represented as WBBW (0110)
6) Barcode number searched in database
7) When found, stock item details will be displayed
8) Number of stock will reduce by 1 every time a barcode is scanned
9) When no of stock reaches re-order level, more items will be automatically ordered
10) When new stock items arrive, database will be updated
advantages (for management)
- easier + faster to change prices
- more up to date info abt stock
- allows for auto stock control
advantages (for customers)
- accurate
- itemised receipt made
- short que lines
2) QR (quick response) scanners
-
Matrix of dark squares against light bg
Holds over 7000 digits
Three large squares at corners of code acts as alignment
Remaining small corner is to ensure right size n angle of camera is used when qr is
scanned
➔ Advertise products
➔ Auto access to online websites
➔ Stores boarding passes
Advantages
Disadvantages
Can hold a lot of info
Each tiny square holds data, if one is
scratched, the qr code cannot be read
Fewer errors
Sometimes required to install external app to
read qr
Easy to read
Can be used to transmit malicious code
Easy to transmit/share images
Can be encrypted
3) microphones
-
Built in or external device
When mic picks up sound, a diaphragm produces an electrical current.
Currents gets picked up by sound card which has ADC and converts it into digital values
and stored in a computer
4) mouse
-
To select times
Optical
- used red LED to detect movement
mechanical
- uses a ball at the bottom of the mouse
to detect movement
Optical over mechanical
➔ Lighter
➔ No moving parts
➔ Can work on any surfaces
➔ Isn't affected by dust
Wired over wireless
➔ Cheaper
➔ No signal lost
➔ No need to dispose batteries
5) scanners
-
2d n 3d
Convs hardcopy → hardcopy
2d scanners
Measures width n length
1)
2)
3)
4)
5)
Open cover, place doc, close cover
Bright light illuminates n scans doc
Scan head moves across doc till whole page is scanned
CCD (character couple device) takes scanned image n convs it into softcopy
Editing softcopy uses OCR (optical character recognition). Convs doc into text file format
Uses of 2d scanners
➔ Read passports
➔ OCR used to change text in electrical form
➔ Allows user to input data into existing database
3d scanners
- x, y, z coordinates
- Images scanned can be used in CAD (computerised aided design)
1)
2)
3)
4)
5)
CT (computed tomographic) scanners are used to create 3D images
CT scanners build up image using a series of thin slices
Each slices is built using x-rays, radio frequency or gamma imaging
Each slice is stored as digital image in comp memory
Whole object is represented digitally in comp memory
6) digital cameras
-
Controlled by an embedded system which carries out these tasks
➔ Adjust shutter speed
➔ Focus image automatically
➔ Operate flash automatically
➔ Adjust image size
➔ Remove ‘red eye’ when flash is used
1) Image captured when light passes through lens onto light sensitive cell
2) Cells is made up of millions of tiny sensors called CCD which convs light into electricity
3) Image is the conv to a digital form using ADC
7) keyboards
-
Input device for data entry
Each character on keyboard has an ASCII value
Each character pressed is converted into a digital signal a computer interprets
8) touch screen
-
Capacitive
Resistive
Infra red
capacitive
- Two layers of glass
protective layer, conductive, glass substrate
- Layers acts as a capacitor that creates an electric field between glass plates
- Human skin conductor of electricity → bare finger touches skin → electric field of
conductive layer changes
- Installed microprocessor calculates locations where E.F changed
Surface
Projective
Sensors + voltages placed at corners to
create electric field
Transparent conductive layer in the form of
XY matrix - creates 3d electric field
Finger touching screen will draw current from
each corner
Works w bare fingers, stylus, thin surgical
gloves or cotton gloves
Only works w finger
Allows multi touch facility
YAY!
- good visibility in sunlight
- durable
- Allows multi touch facility (projective)
NAY :(
- expensive
- sensitive to electromagnetic radiation
- surface screen only works w bare fingers
infrared
- Uses glass screen w an array of sensors and infrared transmitters
- Sensors detect infrared radiation
YAY!
- allows multi touch facility
- isnt affected by scratches or cracked screen
- good screen durability
NAY :(
- sensitive to light
- sensitive to moisture
- possible for accidental activation
Resistive
- Made of two layers of electrically resistive material w voltage applied
- Upper layer is made of flexible polyethylene w resistive coating
- Bottom layer is made of glass w resistive coating
YAY!
- durable
- not affected to moisture
NAY :(
- low screen durability
- low touch sensitivity
9) sensor
-
Sensor pick up signal → ADC → microprocessor compares data with stored value →
DAC → signal sent to actuator → action taken
OUTPUT DEVICES
1) light projectors
Dlp: display light projector
- Uses micro mirrors on small DMD chip (digital micromirror device)
- Number and arrangement of DMD determines resolution of projection
- Micro mirrors tilt towards light → on
- Micro mirrors can switch on/off thousands of times per second and create around 1024
shades of grey
1)
2)
3)
4)
5)
Bright light passes through colour filter otw to DMD
White light split into 3 primary colours
Shaping lens mixes colours into secondary colours
DMD will create 1024 shades of each colour
Lens will project produced coloured image
LCD: liquid crystal display
- Old
1) White beam generated from bulb/ LED inside the projector body
2) Beam of light sent to group of monochromatic coated mirrors; reflects light at different
wavelengths (RGB)
3) Three diff colours pass through three LCD screens
4) Three vers of images produced
5) Image recombined to produce full image
6) Image passes through projector lens onto screen
DLP
YAY!
NAY :(
High contrast ratios
Moving image tends to suffer from ‘shadows’
Higher reliability
Do not have grey components in image
Uses single DMD chip
Colour definition is not good as LCD
Quiet
Smaller and lighter
LCD
YAY!
NAY
Sharp images
Bad contrast ratios
Better colour saturation
Limited life
More efficient in energy use
LCD panels degrade
Download