0% found this document useful (0 votes)
2 views

Computer Hardware and Text Representation

The document provides an introduction to the Central Processing Unit (CPU) and microprocessors, detailing their functions, types, and the significance of bits and bytes in computing. It explains the architecture of microprocessors, including registers and their roles in data processing, as well as the principles of various numbering systems like binary, octal, and hexadecimal. Additionally, it discusses concepts such as CPU speed, Moore's Law, and methods for converting between different number systems.

Uploaded by

awetbrhanu122119
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Computer Hardware and Text Representation

The document provides an introduction to the Central Processing Unit (CPU) and microprocessors, detailing their functions, types, and the significance of bits and bytes in computing. It explains the architecture of microprocessors, including registers and their roles in data processing, as well as the principles of various numbering systems like binary, octal, and hexadecimal. Additionally, it discusses concepts such as CPU speed, Moore's Law, and methods for converting between different number systems.

Uploaded by

awetbrhanu122119
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

Principles of Computing

CSE 101

By Dawit Zenebe
Mekelle Institute of Technology
2014/2015
By Dawit Zenebe
Chapter 3
Introduction to CPU
CPU
Central processing unit etched on silicon chip
called microprocessor.
A microprocessor incorporates the functions of

By Dawit Zenebe
a computer's central processing unit (CPU) on a
single integrated circuit (IC).
The microprocessor is
multipurpose, programmable device that
accepts digital data as input, processes it according
to instructions stored in its memory, and provides 2
results as output.
Microprocessors operate on numbers and symbols
represented in the binary numeral system.
 It is an example of sequential digital logic, as it has
internal memory. Microprocessors operate on
numbers and symbols represented in the binary
numeral system.

By Dawit Zenebe
Before microprocessors, small computers had
been implemented using racks of circuit boards
with many medium- and small-scale integrated
circuits.
Microprocessors integrated this into one or a
few large-scale ICs. 3
Types of Processors
The most common type of processors are
common desktop processors, such as Intel's
Pentium or AMD's Athlon.
Less common are the extremely powerful

By Dawit Zenebe
processors used in high-end servers, such as
Sun's SPARC, IBM's Power, or Intel's Itanium.
microprocessors have come in "standard sizes"
of 8 bits, 16 bits, 32 bits, and 64 bits.
The number of bits represent how much
4
physical memory can be directly addressed by
the CPU.
Continued--
 It also represents the amount of bits that can be
read by one read/write operation.
8 bit processors can read/write 1 byte at a time and
can directly address 256 bytes
16 bit processors can read/write 2 bytes at a time,

By Dawit Zenebe
and can address 65,536 bytes (64 Kilobytes)
32 bit processors can read/write 4 bytes at a time,
and can address 4,294,967,295 bytes (4 Gigabytes)
64 bit processors can read/write 8 bytes at a time,
and can address 18,446,744,073,709,551,616 bytes
5
(16 Exabytes)
Bits and Bytes
What is a "bit"?
A bit is the smallest possible piece of information.
If you have heard someone say that "everything in
the computer is all one's and zero's," they are
actually referring to bits.

By Dawit Zenebe
A bit can have only two possible states: 1 or 0.
As humans, we may find it useful to think of this in
terms of "yes or no," "true or false," "on or off,"
and so on.
They all mean the same thing. The key is that
6
there are only two possibilities, and nothing in
between.
What is a "byte"?
Although a single bit can have only one of two
possible values, by gathering groups of bits
together, we can make much more complicated
(and interesting) information.
A byte is simply a group of 8 bits. How many
different possible values can a byte have? There

By Dawit Zenebe
turns out to be a simple way of calculating this:
1 bit --> 2^1 = 2 different possible values
2 bits --> 2^2 (2x2) = 4 different possible values
3 bits --> 2^3 (2x2x2) = 8 different possible
values
8 bits (one byte) --> 2^8 (2x2x2x2x2x2x2x2) 7
= 256 possibilities
CPU Registers
A processor register is a very fast computer
memory used to speed the execution of computer
programs by providing quick access to commonly
used values-typically, the values being in the midst

By Dawit Zenebe
of a calculation at a given point in time.
These registers are the top of the memory
hierarchy, and are the fastest way for the system to
manipulate data.

8
By Dawit Zenebe
9
Types of registers:
(a) Accumulator: It is most frequently used register
used to store data taken from memory. Its number
varies from microprocessor to microprocessor.
(b) General Purpose registers: General purpose
registers are used to store data and intermediate

By Dawit Zenebe
results during program execution. Its contents can be
accessed through assembly programming.
(c) Special purpose Registers: Users do not access
these registers. These are used by computer system
at the time of program execution. :
10
Some types of special purpose registers
1. Memory Address Register (MAR): It stores address
of data or instructions to be fetched from memory.
2. Memory Buffer Register (MBR): It stores
instruction and data received from the memory and

By Dawit Zenebe
sent from the memory.
3. Instruction Register (IR): Instructions are stored in
instruction register. When one instruction is
completed, next instruction is fetched in memory for
processing.
4. Program Counter (PC): It counts instructions. 11
The instruction cycle is completed into two phases:
(a) Fetch Cycle and (b) Execute Cycle.

Fetch cycle CPU:


• Fetches an instruction from primary storage
• Increments a pointer to location of next instruction
• Separates instruction into components (instruction code
and data inputs)
• Stores each component in a separate register
Execution ALU:
cycle • Retrieves instruction code from a register
• Retrieves data inputs from registers
• Passes data inputs through internal circuits to perform
data transformation
• Stores results in a register
Question?

1. What is the difference b/n

By Dawit Zenebe
Registers and Cache memory?

13
Answer
The registers are the places where the
values that the CPU is actually working on
are located.
The CPU design is such that it is only able to
actually modify or otherwise act on a value

By Dawit Zenebe
when it is in a register. So registers can work
logic, whereas Cache memory can only hold
values the CPU reads from and writes to.

14
Example: how register logic works.
Let's imagine we have four registers named R1..R4. If you
compile a statement that looks like this:

X = Y + Z * 3;
The compiler would output machine code that looks something
like this:

BDawit Zenebe
1. LOAD R1, ADDRESS_Z // move the value of z into register 1
2. MUL R1, 3 // multiply the value of register 1 by 3
3. LOAD R2, ADDRESS_Y // move the value of y into register 2
4. ADD R1, R2 // adds the value in R2 to the value in R1
5. STORE R1, ADDRESS_X // move the value of register 1 into
x
15
Microprocessor Speeds
Measure of system clock speed
• How many electronic pulses the clock produces per
second
• Usually expressed in gigahertz (GHz)

By Dawit Zenebe
• Billions of machine cycles per second
• Some old PCs measured in megahertz (MHz)
Comparison of clock speed only meaningful
between identical microprocessors
CPU cycle time – inverse of clock rate
16
Clock Rates
Microprocessors are typically discussed in terms of
their clock speed.
The clock speed is measured in hertz (or
megahertz, or gigahertz).
A hertz is a "cycle per second".

By Dawit Zenebe
Each cycle, a microprocessor will perform certain
tasks, although the amount of work performed in a
single cycle will be different for different types of
processors.
The amount of work that a processor can complete
17
in a single cycle is measured in "cycles per
instruction".
The clock rate is equated as such:

This means that the amount of time for a cycle is


inversely proportional to the clock rate.

By Dawit Zenebe
A computer with a 1MHz clock rate will have a
clock time of 1 microsecond.
A modern desktop computer with a 3.2 GHz
processor will have a clock time of approximately
3× 10-10 seconds, or 300 picoseconds.
300 picoseconds is an incredibly small amount of 18
time, and there is a lot that needs to happen inside
the processor in each clock cycle.
Current Technology Capabilities
and Limitations
• Moore’s Law
• Rate of increase in transistor density on
microchips doubles every 18-24 months with

By Dawit Zenebe
no increase in unit cost
• Rock’s Law
• Cost of fabrication facilities for chip generation
doubles every four years
19
Introduction to Numbering Systems

A set of values used to represent different


quantities is known as Number System.
The digital computer represents all kinds of
data and information in binary numbers.
It includes audio, graphics, video, text and
numbers.
The total number of digits used in a number
system is called its base or radix.
• We are all familiar with the decimal number
system (Base 10). Some other number systems
that we will work with are:

– Binary  Base 2
– Octal  Base 8
– Hexadecimal  Base 16
Significant Digits
Binary: 11101101

Most significant digit Least significant digit

Hexadecimal: 1D63A7A

Most significant digit Least significant digit


Binary Number System
• Also called the “Base 2 system”
• The binary number system is used to model the
series of electrical signals computers use to
represent information
• 0 represents the no voltage or an off state
• 1 represents the presence of voltage or an
on state
Binary Numbering Scale
Base 2 Base 10 Positional
Power
Number Equivalent Value

000 0 20 1
001 1 21 2
010 2 22 4
011 3 23 8
100 4 24 16
101 5 25 32
110 6 26 64
111 7 27 128
Binary Addition
4 Possible Binary Addition Combinations:
(1) 0 (2) 0
+0 +1 Note that leading
zeroes are frequently
Carry 00 Sum 01 dropped.

(3) 1 (4) 1
+0 +1
01 10
Decimal to Binary Conversion
• The easiest way to convert a decimal number to its
binary equivalent is to use the Division Algorithm
• This method repeatedly divides a decimal number
by 2 and records the quotient and remainder
– The remainder digits (a sequence of zeros and ones)
form the binary equivalent in least significant to most
significant digit sequence
Division Algorithm
Convert 67 to its binary equivalent:
6710 = x2
Step 1: 67 / 2 = 33 R 1 Divide 67 by 2. Record quotient in next row

Step 2: 33 / 2 = 16 R 1 Again divide by 2; record quotient in next row

Step 3: 16 / 2 = 8 R 0 Repeat again

Step 4: 8 / 2 = 4 R 0 Repeat again

Step 5: 4 / 2 = 2 R 0 Repeat again

Step 6: 2 / 2 = 1 R 0 Repeat again

Step 7: 1 / 2 = 0 R 1 STOP when quotient equals 0

1 0 0 0 0 1 12
Binary to Decimal Conversion
• The easiest method for converting a binary
number to its decimal equivalent is to use
the Multiplication Algorithm
• Multiply the binary digits by increasing
powers of two, starting from the right
• Then, to find the decimal number
equivalent, sum those products
Multiplication Algorithm
Convert (10101101)2 to its decimal equivalent:

Binary 1 0 1 0 1 1 0 1
x x x x x x x x
Positional Values 27 26 25 24 23 22 21 20
Products 128 + 32 + 8 + 4 + 1

17310
Octal Number System
• Also known as the Base 8 System
• Uses digits 0 - 7
• Readily converts to binary
• Groups of three (binary) digits can be used
to represent each octal digit
• Also uses multiplication and division
algorithms for conversion to and from base
10
Decimal to Octal Conversion
Convert 42710 to its octal equivalent:

427 / 8 = 53 R3 Divide by 8; R is LSD


53 / 8 = 6 R5 Divide Q by 8; R is next digit
6 / 8 = 0 R6 Repeat until Q = 0

6538
Octal to Decimal Conversion
Convert 6538 to its decimal equivalent:

Octal Digits 6 5 3
x x x
Positional Values
82 81 80
Products 384 + 40 + 3

42710
Octal to Binary Conversion
Each octal number converts to 3 binary digits

To convert 6538 to binary, just


substitute code:

6 5 3

110 101 011


Hexadecimal Number System
• Base 16 system
• Uses digits 0-9 &
letters A,B,C,D,E,F
• Groups of four bits
represent each
base 16 digit
Decimal to Hexadecimal Conversion
Convert 83010 to its hexadecimal equivalent:

830 / 16 = 51 R14 = E in Hex


51 / 16 = 3 R3
3 / 16 = 0 R3

33E16
Hexadecimal to Decimal Conversion
Convert 3B4F16 to its decimal equivalent:

Hex Digits 3 B 4 F
x x x x
Positional Values
163 162 161 160
Products 12288 +2816 + 64 +15

15,18310
Binary to Hexadecimal Conversion
• The easiest method for converting binary to
hexadecimal is to use a substitution code
• Each hex number converts to 4 binary digits
Substitution Code
Convert 0101011010101110011010102 to hex using
the 4-bit substitution code :

5 6 A E 6 A

0101 0110 1010 1110 0110 1010

56AE6A16
Substitution Code
Substitution code can also be used to convert binary to
octal by using 3-bit groupings:

2 5 5 2 7 1 5 2
010 101 101 010 111 001 101 010

255271528
Complementary Arithmetic
• 1’s complement
– Switch all 0’s to 1’s and 1’s to 0’s

Binary # 10110011
1’s complement 01001100
Complementary Arithmetic
• 2’s complement
– Step 1: Find 1’s complement of the number
Binary # 11000110
1’s complement 00111001
– Step 2: Add 1 to the 1’s complement
00111001
+ 00000001
00111010
Signed Magnitude Numbers

110010.. …00101110010101

Sign bit 31 bits for magnitude

0 = positive
1 = negative This is your basic
Integer format
Floating Point Numbers
• Real numbers must be normalized using
scientific notation:

0.1…× 2n where n is an integer

• Note that the whole number part is always 0


and the most significant digit of the fraction
is a 1 – ALWAYS!
Floating Point Operations
• Before two floating point numbers can be
added, the exponents for both numbers must
be made equal – hence the term “floating
point”
• NIST Standard Format (32-bit word)
± 8-bit
23-bit fraction field
exponent
Bias Notation
• The exponent field (8 bits) can be used to
represent integers from 0-255
• Because of the need for negative exponents
to be represented as well, the range is offset
or biased from – 128 to + 127
• In this way, both very large and very small
numbers can be represented
Double Precision
• Double word format that increases both the
length of the fraction (precision) but also
the size of the bias (magnitude)

• NIST Standard format (64 bits)


± 10-bit
53-bit fraction field
exponent
Error Considerations
• The “Hole at Zero” Problem
– Regardless of how large an exponent field is,
there are still smaller positive and negative
numbers about zero that cannot be represented
– In bias notation, +2-129 and - 2-129 are beyond
the acceptable range
– The “Hole at Zero” defines the range of values
near zero that cannot be stored
Computational Errors
• When converting base 10 fractions to binary,
only those fractions whose values can be
expressed as a sum of base 2 fractions will
convert evenly
• All other base 10 fractions feature a least
significant bit that is either rounded or
truncated – an approximation
• When two such numbers are multiplied, the
rounding error is compounded
Unsigned Integers
• Represents positive integers only
• Not necessary to indicate a sign, so all bits
can be used for the magnitude:
– 1 byte = 8 bits = 28 = 256 (0 to 255)
• 255 decimal = 1111 1111 binary
– 2 bytes = 16 bits = 216 = 65,536 (0 to 65,535)
– 4 bytes = 32 bits = 232
= 4,294,967,296 (0 to 4,294,967,295)
Signed Integers
• Represents positive and negative integers
• MSB (Most Significant Bit – leftmost bit) used to
indicate sign
– 0 = positive, 1 = negative
• One less bit is used for the magnitude, with one
extra negative value
– 1 byte = 8-1 bits = 27 (-128 to +127)
• -128 decimal = 1000 0000 binary
• -1 decimal = 1111 1111 binary
• 127 decimal = 0111 1111 binary
– 2 bytes = 16-1 bits = 215 (-32,768 to +32,767)
– 4 bytes = 32-1 bits = 231 (-2,147,483,648 to
+2,147,483,647 )
1’s & 2’s Complement
• 1’s complement form
– Formed by reversing (complementing) each bit
• 2’s complement form
– Formed by adding 1 to 1's complement
– Negative numbers are stored this way
– Additive inverse of a number
– Computer never has to subtract
• A – B = A + (-B)
Binary to Decimal Conversion
• Unsigned Integers
– Convert binary directly to decimal form
• Signed Integers
– If MSB = 0, convert directly to decimal
– If MSB = 1, convert to 2's complement form
(reverse the bits & add 1), then to decimal form
Signed Integers (8-bit)
• Example: -9 • Convert to decimal
1. 0000 1001b = +9 1. 1111 0111b = -9
2. 1111 0110b 2. 0000 1000b
+1b +1b
1111 0111b = -9 0000 1001b = +9

• Example: -32 • Convert to decimal


1. 0010 0000b = +32 1. 1110 0000b = -32
2. 1101 1111b 2. 0001 1111b
+1b +1b
1110 0000b = -32 0010 0000b = +32
Class Exercise
• Convert the following negative decimal
numbers to 8 bit binary using the 2’s
complement
– -1, -3, -8, -127
Class Exercise
• Evaluate 32 + (- 5) in 8 bit binary
– Convert 32 to binary
– Convert -5 to 2’s complement
– Add together
– Check your answer by converting back to
decimal
Character Representation
• ASCII (See link to ASCII Codes)
– American Standard Code for Information Interchange
– Standard encoding scheme used to represent
characters in binary format on computers
– 7-bit encoding, so 128 characters can be represented
– 0 to 31 (& 127) are "control characters" (cannot print)
• Ctrl-A or ^A is 1, ^B is 2, etc.
• Used for screen formatting & data communication
– 32 to 126 are printable
Binary Data
• Decimal, hex & character representations are
easier for humans to understand; however…
• All the data in the computer is binary
• An int is typically 32 binary digits
– int y = 5; (y = 0x00000005;)
• In computer y = 00000000 00000000 00000000 00000101
– int z = -5; (y = 0xFFFFFFFB;)
• In computer, z = 11111111 11111111 11111111 11111011
Binary Data
• A char is typically 8 binary digits
– char x = '5'; (or char x = 53, or char x = 0x35)
• In computer, x = 00110101
– char x = 5; (or char x = 0x05;)
• In computer, x = 00000101
• Note that the ASCII character 5 has a different
binary value than the numeral 5
• Also note that 1 ASCII character = 2 hex
numbers
Introduction- Data Formats
• Examples
Real World Computer
Data Input device Data

Dear Mom: Keyboard 10110010…

Digital
10110010…
camera
Examples of Standards
Type of Data Standards
Alphanumeric ASCII, EBCDIC, Unicode

Image JPEG, GIF, PCX, TIFF

Motion picture MPEG-2, Quick Time

Sound Sound Blaster, WAV, AU

Outline graphics/fonts PostScript, TrueType, PDF


Why Standards?
• Standard are “arbitrary”
• They exist because they are
– Convenient
– Efficient
– Flexible
– Appropriate
– Etc.
Alphanumeric Data
• Problem: Distinguishing between the number 123
(one hundred and twenty-three) and the characters
“123” (one, two, three)
• Four standards for representing letters (alpha) and
numbers
– BCD – Binary-coded decimal
– ASCII – American standard code for information
interchange
– EBCDIC – Extended binary-coded decimal interchange
code
– Unicode
Binary-Coded Decimal (BCD)
Digit Bit pattern
0 0000
• Four bits per digit 1 0001
Note: the following 2 0010
bit patterns are not 3 0011
used: 4 0100
5 0101
1010
1011 6 0110
1100 7 0111
1101 8 1000
1110 9 1001
1111
Example
• 709310 = ? (in BCD)
7 0 9 3

0111 0000 1001 0011


The Problem
• Representing text strings, such as
“Hello, world”, in a computer
• Solution: Codes and characters
– Each character is coded as a byte
– Most coding system is ASCII(American
National Standard Code for Information
Interchange)
– It is a 7-bit code 8th bit is unused( or used for a
parity bit)
– The following is the ASCII chart
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 Most$significant
4 bit D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC
Least significant bit + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
e.g., ‘a’ = 1100001

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
95 Graphic codes
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
33 Control codes
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Alphabetic codes

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Numeric codes

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Punctuation, etc.

000 001 010 011 100 101 110 111


0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
“Hello, world” Example
Binary Hexadecimal Decimal
H = 01001000 = 48 = 72
e = 01100101 = 65 = 101
l = 01101100 = 6C = 108
l = 01101100 = 6C = 108
o = 01101111 = 6F = 111
, = 00101100 = 2C = 44
= 00100000 = 20 = 32
w = 01110111 = 77 = 119
o = 01100111 = 67 = 103
r = 01110010 = 72 = 114
l = 01101100 = 6C = 108
d = 01100100 = 64 = 100
Common Control Codes
• CR 0D carriage return
• LF 0A line feed
• HT 09 horizontal tab
• DEL 7F delete
• NULL 00 null
Hexadecimal code
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
Terminology
• Learn the names of the special symbols
– [] brackets
– {} braces
– () parentheses
– @ commercial ‘at’ sign
– & ampersand
– ~ tilde
000 001 010 011 100 101 110 111
0000 NULL DLE 0 @ P ` p
0001 SOH DC1 ! 1 A Q a q
0010 STX DC2 " 2 B R b r
0011 ETX DC3 # 3 C S c s
0100 EDT DC4 $ 4 D T d t
0101 ENQ NAK % 5 E U e u
0110 ACK SYN & 6 F V f v
0111 BEL ETB ' 7 G W g w
1000 BS CAN ( 8 H X h x
1001 HT EM ) 9 I Y i y
1010 LF SUB * : J Z j z
1011 VT ESC + ; K [ k {
1100 FF FS , < L \ l |
1101 CR GS - = M ] m }
1110 SO RS . > N ^ n ~
1111 SI US / ? O _ o DEL
EBCDIC
• Extended BCD Interchange Code
(pronounced ebb’-se-dick)
• 8-bit code
• Developed by IBM
• Rarely used today
• IBM mainframes only
Unicode
• 16-bit standard
• Developed by a consortia
• Intended to supercede older 7- and 8-bit
codes
Unicode Version 2.1
• 1998
• Improves on version 2.0
• Includes the Euro sign (20AC16 = )
• From the standard:
…contains 38,887 distinct coded characters derived
from the supported scripts. These characters cover the
principal written languages of the Americas, Europe,
the Middle East, Africa, India, Asia, and Pacifica.
http://www.unicode.org
Keyboard Input
• Key (“scan”) codes are converted to ASCII
• ASCII code sent to host computer
• Received by the host as a “stream” of data
• Stored in buffer
• Processed
• Etc.

You might also like