Chaos, Communication and Consciousness Module PH19510 Lecture 9 Codes
Jan 16, 2016
Chaos, Communication and ConsciousnessModule PH19510
Lecture 9Codes
Overview of Lecture
What is a code ? Analogue & Digital Information Information Pioneers - Boole & Shannon The bit and binary signals Baudot & ASCII codes PCM Encoding Error Detection & Correction
Codes
Represent information into form for: transmission storage processing
Alphabet Numbers
Braille
Semaphore
Morse
A=1000001, F=1000110, K=1001011B=1000010, G=1000111, L=1001100C=1000011, H=1001000, M=1001101D=1000100, I=1001001, N=1001110E=1000101, J=1001010, O=1001111
ASCII
Evolution of Alphabets
Ideographs 1 symbol / idea
Hieroglyphs 1 symbol / syllable
Alphabet Syllables encoded in
alphabet abcdefghijlkmnopqrstuvwxyzABCDEFGHIJLKMNOPQRSTUVWXYZ
Evolution of Numbers
Tally Marks
Mesopotamian Sexagesimal
Roman numerals
Arabic numerals
I II III IV V VIVII VIII IX X
0 1 2 3 4 5 6 7 8 9
Nature’s Code
Genetic information is stored in a code based on 4 units - adenine (A), thymine (T), guanine (G) and cytosine (C)
4-character code is stored on DNA, whose structure was discovered by Crick and Watson in 1953
Bacterium 600,000 pairs Human 3 x 109 pairs
Analogue & Digital Information
Analogue InformationAny value between limitsMost ‘real world’ quantities are analogueTemperature, pressure, light intensity etc
Digital InformationOnly discrete values possibleNumbers, Letters, other abstractions
Noise Margin
Why Binary ?
Noise is endemic in circuits Freedom from noise process information faithfully
0
1Output Device
0
1
Input Device
George Boole (1815 – 1864)
Mathematician Symbolic Methods 1847 “Mathematical analysis of Logic”
Analogy between algebra & logicSymbolic operations on logical propositionsEquations in logic
Boolean algebra
Claude Shannon (1916-2001)
1937 “A Symbolic Analysis of Relay and Switching Circuits” Applied Boolean algebra to relay circuits Relays can solve problems in Boolean algebra
1948 “A Mathematical Theory of Communication” Best way to encode information for transmission Maximise transmission in presence of noise
The Bit
Binary Digit Fundamental unit of
information System has N different
states (equally likely) requires n bits to transmit
information on state If states are not equally
likely, less information
)2ln(
)ln(Nn
Binary Counting
0 - 0 1 - 1 2 - 10 3 - 11 4 - 100 5 - 101 6 - 110 7 - 111 8 – 1000 …
4210 = 101010B=1x32+0x16+1x8+0x4+1x2+0x1
Streams of 1s and 0s cumbersome Break into groups of 4 bits 4 bits = 0 – 15 ==
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Hexadecimal 4210 = 2A Hex
Powers of 2
Group bits for convenience 4 bits = nibble 8 bits = byte 16 bits = word 32 bits = double word 64 bits = quad word
Kilobyte kB 1024 = 210 bytes
Megabyte MB 1,048,576 = 220 bytes
Gigabyte GB 1,073,741,824 =230 bytes
Terabyte TB 1,099,511,627,776 =240 bytes
Gray code
Re-arrange binary counting
Only 1 bit changes at a time
Rotary encoders
Position Code
0 0000
1 0001
2 0011
3 0010
4 0110
5 0111
6 0101
7 0100
8 1100
9 1101
10 1111
11 1110
12 1010
13 1011
14 1001
15 1000
Rotary Shaft Encoder
Jean-Maurice-Émile Baudot
1874 Multiplexing printing telegraph system
Up to 4 telegraph channels on single wire
Time Division Multiplexing
5 bit code
Baudot codeBin Hex Dec LTRS FIGS Bin Hex Dec LTRS FIGS
00011 03 3 A - 10111 17 23 Q 1
11001 19 25 B ? 01010 0A 10 R 4
01110 0E 14 C : 00101 05 5 S '
01001 09 9 D $ 10000 10 16 T 5
00001 01 1 E 3 00111 07 7 U 7
01101 0D 13 F ! 11110 1E 30 V ;
11010 1A 26 G & 10011 13 19 W 2
10100 14 20 H # 11101 1D 29 X /
00110 06 6 I 8 10101 15 21 Y 6
01011 0B 11 J <BELL> 10001 11 17 Z "
01111 0F 15 K ( 01000 08 8 <CR> <CR>
10010 12 18 L ) 00010 02 2 <LF> <LF>
11100 1C 28 M . 00100 04 4 <SP> <SP>
01100 0C 12 N , 11111 1F 31 <LTRS> <LTRS>
11000 18 24 O 9 11011 1B 27 <FIGS> <FIGS>
10110 16 22 P 0 00000 00 0 [..unused..]
ASCIIAmerican Standard Code for Information Interchange
Published 1967 7-bit code 128 characters 95 Printable characters 33 Non-Printing controls
STX,ETX,EOT,BEL,NUL…
8-bit extensions Code page upper 128
Pulse code Modulation (PCM)
Sample analogue signal
n-bits 2n levels Quantisation
Noise
Quantisation Noise
Sampling Frequency and Aliasing Distortion Need to sample signal
‘often’ enough Example signal: Sample 1
Frequency high enough
Sample 2 Sampling just high enough
Sample 3 Sampling to slow Aliasing Distortion
0 0.2 0.4 0.6 0.8
1
0
1
Signal
0 0.2 0.4 0.6 0.8
1
0
1
SignalSampled
0 0.2 0.4 0.6 0.8
1
0
1
SignalSampled
0 0.2 0.4 0.6 0.8
1
0
1
SignalSampled
Nyquist Criterion
Sampling Frequency must be at least twice the highest frequency in the signal
fSample 2 x fSignal
Filter signal to remove high frequencies
Wagon wheel (temporal) Patterned clothing on TV (spatial) Photocopying/scanning banknotes
PCM Audio Sampling
Rate and number of levels dependent on quality
fsample = 2 x fsignal Speech 8-bit (256 levels) 8kHz CD quality 16-bit (65,536 levels) 44kHz
Redundant Information
English text has redundant information Wasteful of space but… Allows recovery from errors If yu cn rd ths yu cn gt a gd jb prgrmmng cmptrs
Error Detecting Codes (EDC) Error correcting codes (ECC)
Error Detecting Codes
Add redundant information to detect errors Parity
Add extra bit to each ‘byte’ of information Calculate bit so always odd number of bits Can detect single bit errors
Checksums (CRC – Cyclic Redundancy check) Complex polynomial based on all bits of message Can detect errors & transpositions Information storage & transmission Credit Cards DVLA Driver numbers
Error Correcting Codes
Put extra information in data stream to detect and correct errors
Hamming Codes Reed-Solomon
Review of Lecture
What is a code ? Analogue & Digital Information Information Pioneers - Boole & Shannon The bit and binary signals Baudot & ASCII codes PCM Encoding Error Detection & Correction