- Coding with symbols.
- Digital information is just information represented using digits.
- Usual meaning of “digits” is the symbols 0-9.
- In fact, any symbols could be used: 601 925 3815, or ^)! (@% #*!%
- Use of digits can actually be misleading: a phone number is not a
quantity.
- Combinations.
- Digits (or letters, or shapes, or whatever) are basic symbols.
- To name a large number of things, you need to make groups of them,
called strings or words.
- If you have p symbols, there are pn
strings of length n.
- Six faces on a die, two dice, give 62 = 36 pairs.
- Ten digits, 103 = 1000 3-digit numbers (000 through 999).
- If strings are constructed using five capital letters, there are
265 = 11,881,376 possibilities.
- Ordering.
- Symbols made of digits are easily ordered for searching.
- We can do this with any symbols if we agree on the collating
sequence.
- Alphabetical order is a collating sequence.
- Binary
- To record or transmit digital information, symbols must be recorded using
some physical phenomenon.
- Shapes using ink on a paper page.
- Shapes pressed into clay (which is then hardened).
- Puffs of smoke.
- Flashes of light.
- Computer engineers find it easiest to use physical phenomena classified
into two states. Present and Absent; PandA.
- On or off.
- Charged or discharged.
- Magnetized or not.
- Pit or land (non-pit).
- Divide disks into areas.
- Hexadecimal
- A more compact representation for strings of bits.
- Use 16 symbols, 0–9, A–F: hex “digits”.
- Each hex digit is four bits:
0 | 0000 | 1 | 0001 | 2 | 0010 | 3 | 0011 |
4 | 0100 | 5 | 0101 | 6 | 0110 | 7 | 0111 |
8 | 1000 | 9 | 1001 | A | 1010 | B | 1011 |
C | 1100 | D | 1101 | E | 1110 | F | 1111 |
- Group starting at right; pad with zeros on the left.
- 101000001010110011 is 282B3
- 37D1 is 0011011111010001.
- Have you seen this before?
- The humble byte.
- A byte is simply a string of 8 bits.
- Spelled “byte” instead of “bite” because
a single typo can't change
“byte” to “bit”.
- Representing text.
- Early and still widely used: ASCII
(American Standard Code for
Information Interchange).
- Originally, 7 bits, 0000000–1111111 (00–7F). That's
128 characters.
- PC memory is divided in bytes, making it convenient to
use 8-bit characters, so they doubled the number of assignments to 256.
- Second bank, 10000000–11111111 is not well-standardized.
- Tom is 010101000110111101101101, or 546F6D
- Unicode.
- ASCII for US English.
- The second bank adds characters for other European languages.
- For the rest of the world, esp. middle-eastern and oriental languages,
we're going to need more than 8 bits.
- Unicode defines a vast number of codes for pretty much everyone.
- Use 16 bits (65,536 codes) for the most common characters.
- Use 32 bits (4,294,967,296 codes) if you need them all.
- UTF-8
- The most commonly-used format for web pages.
- Codes vary in length.
- Characters from 7-bit ASCII are represented by their ASCII code,
using one byte.
- Other characters use two or more bytes.
- Designed to allow coding of world alphabets without breaking old
software.
- Where have you seen UTF-8 before in this class?
- Encoding with Redundancy. Detects or avoids errors.
- NATO radio code. Listener can identify the letters over noise.
- Bar Codes.
- Bit are recorded by the presence or absence of a bar.
- Decimal digits are coded in binary.
- The UPC has a manufacturer and a product code.
- Each digit is assigned two codes, one for the manufacturer side,
another for the product code side.
- Codes are chosen so that the reverse of any code is not a legal
code.
Can tell when the code was read up side down.
- To create enough codes,
each decimal digit requires seven bits. (What's the least number of
bits needed to code all ten digits?)
- Parity bit.
- Append an extra bit to your data so that the total count of 1's is
always an even number. (Or an odd number, just so long as everyone
agrees ahead of time.)
- The reader or receiver can detect when a single bit was read
incorrectly. (How is that?)
- Does UPC use parity?
- Error-Correcting codes.
- With these, the reader can actually correct damaged data, if the damage
is not too severe.
- Used with computer memories and storage devices, and in space
communications.