8.4 Character Codes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

8.

4 Character Codes
Back to the real world

Sometimes we need computers to convert numbers and data from


binary form into a format which humans can use.

Sometimes we need to represent more than just numbers.

2
Representing text: ASCII

“American Standard Code for Information Interchange”


• Allows representation of letters, numbers and control codes.
• Only provides (truncated) anglicised Latin alphabet.

• 7 bit representation, with the final bit reserved for parity checking.
• Allows a simple error detection scheme:
• Set to 1 if the sum of the 7 data bits is odd.
• Set to 0 if the sum is even.

3
ASCII

table 2.7 from Computer Organization & Architecture

4
Unicode

A representation for the whole world.


• Allows representation of all alphabets, many symbols and is extendable.
• Capable of encoding 1,112,064 characters
• UTF-8, using one to four bytes per character.
• Allowing backwards compatibility.
• As of March 2020 Unicode 13.0 has143,859 characters:
• 143,696 graphic characters.
• 163 format characters.
• Covers:
• 154 modern and historic scripts.
• Multiple symbol sets.
• Emoji.

5
Sound

We can encode periodic audio signal samples as integers.


40000 samples per second is sufficient for human hearing.

6
Images

Reduce the picture to a grid of ‘picture elements’, or pixels.

Encode pixel values as integers, such as:


• Single bits for black and white.
• 8-value grayscale (3-bit).
• Triplets of 256 value red/green/blue (RGB) colour (24/32-bit).
• …and much higher definitions.

7
Images

Triplets of 256 value red/green/blue (RGB) colour.

8
To conclude

We've seen a sample of data representations that are used in computers.


• And some of the motivation behind them.

Of course there are far more:


• Image files, movie files, sound files and so on.

And there are also compression techniques which can be applied to most of them in software.
• But that's beyond our scope.

Later on we’ll look at how to implement binary representations in hardware, using digital circuits.

9
Reading and References

Outline primarily based upon:


• Chapter 2, Computer Organization & Architecture (3rd Edition), Null & Lobur
Suggested learning activities:
• Find out which control codes were included in ASCII and why.
• Try to figure out how much bigger a typical jpeg picture file would be if it was uncompressed.

10

You might also like