You are on page 1of 12

23:12:08

Chapter 1
Introduction
23:12:08
Chapter outline

• Embedded microcomputer system.


• Binary digital system.
• Binary arithmetic.
• Hexadecimal notation.
• BCD numbers.
• Fixed point numbers.
• Floating point numbers.
• ASCII characters.

Microcomputer principles and applications


23:12:08
1.1 Embedded microcomputer system

• Embedded = hidden inside so one can’t see it.


• The software is programmed or fixed into ROM and is not
accessible to the user of the device.
• Typically perform a single function.
• Typically very specific performance parameters within which the
system must operate.
• Many embedded systems must operate in real time.
• Small memory requirements.

Microcomputer principles and applications


23:12:08
1.1 Embedded microcomputer system

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

Decimal numbers
• Ten digits to use: 0 - 9.
• Value representation

35410 = 3 ∗ 102 + 5 ∗ 101 + 4 ∗ 100

• A positive number is represented by prefixing "+", a negative by


"-".
More generally, in a system with radix b (b > 1), a string of digits
dn−1 . . . d0 denotes the decimal number

dn−1 bn−1 + dn−2 bn−2 + · · · + d0 b0

where 0 ≤ di < b, 0 ≤ i ≤ n − 1.

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

Binary numbers
• Two digits to use: 0 - 1.
• Value representation:

11012 = 1 ∗ 23 + 1 ∗ 22 + 0 ∗ 21 + 1 ∗ 20 = 1310

• Each digit in a binary number is called a bit.


• 8 bit = 1 byte.
• 16 bit = 2 byte = 1 word.
• The bit farthest to the left is called the Most Significant Bit
(MSB).
• The bit farthest to the right is called the Least Significant Bit
(LSB).

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

Unsigned binary numbers


• For an n-bit unsigned binary number, all of the n bits denotes
the magnitude of the number.
n
X
A= dn−i 2n−i
i=1

Unsigned binary arithmetic


• Addition of binary numbers

1011
1001
0100
Microcomputer principles and applications
23:12:08
1.2 Binary digital system

Unsigned binary arithmetic


• Shifting a number to the left by 1 bit multiplies the number by 2.

0010 = 210 , (0010 << 1) = 0100 = 410

• Shifting a number to the right by 1 bit divides the number by 2.

1000 = 810 , (0010 >> 1) = 0100 = 410

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

Signed binary numbers


• Signed magnitude representation.
• One’s complement representation.
• Two’s complement representation.

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

Signed-magnitude representation
• For an n-bit signed binary number, the MSB is the sign bit and
the remaining (n − 1) bits denote the magnitude of the number.
• the sign bit is 0 for a positive number and 1 for a negative
number.  n
X
n−i
d 2 if dn−1 = 0

n−i



i=2
A= X n
dn−i 2n−i if dn−1 = 1

 −


i=2

For example:
0011 = +310 , 1011 = −310
• Disadvantage: There are two representations of 0: 0000 (+0)
and 1000 (-0).

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

One’s complement representation


• Applying the bitwise NOT to a binary number ⇒ form the ones’
complement of the binary number.
For example:

0001 = +110
1110 = −110
• Disadvantage: There are two representations of 0: 0000 (+0)
and 1111 (-0).

Microcomputer principles and applications


23:12:08
1.2 Binary digital system

Two’s complement representation


• Applying the bitwise NOT to a binary number and then adding 1
to that result. For example:

0001 → 1110, 1110 + 1 = 1111

• An n-bit binary number can be represented as

−dn−1 bn−1 + dn−2 bn−2 + · · · + d0 b0

(the most significant digit has a negative weight).


n
X
⇒ A = −2n−1 dn−1 + dn−i 2n−i
i=2

• There is only one zero, represented as 0000.

Microcomputer principles and applications

You might also like