Informatica

Páginas: 107 (26613 palabras) Publicado: 5 de noviembre de 2012
The 8051 Microcontroller and Embedded
Systems
Using Assembly and C
Second Edition

Muhammad Ali Mazidi
Janice Gillispie Mazidi
Rolin D. McKinlay

CONTENTS
Introduction to Computing
The 8051 Microcontrollers
8051 Assembly Language Programming
Branch Instructions
I/O Port Programming
8051 Addressing Modes
Arithmetic & Logic Instructions And Programs
8051 Programming in C
8051Hardware Connection and Hex File
8051 Timer/Counter Programming in Assembly and C
8051 Serial Port Programming in Assembly and C
Interrupts Programming in Assembly and C
8051 Interfacing to External Memory
8051 Real World Interfacing I: LCD,ADC AND
SENSORS
LCD and Keyboard Interfacing
8051 Interfacing with 8255

INTRODUCTION TO
COMPUTING
The 8051 Microcontroller and Embedded
Systems:Using Assembly and C
Mazidi, Mazidi and McKinlay

Chung-Ping Young
楊中平
Home Automation, Networking, and Entertainment Lab

Dept. of Computer Science and Information Engineering
National Cheng Kung University, TAIWAN

OUTLINES

HANEL

Numbering and coding systems
Digital primer
Inside the computer

Department of Computer Science and Information Engineering
National Cheng KungUniversity, TAIWAN

2

NUMBERING
AND CODING
SYSTEMS
Decimal and
Binary Number
Systems

HANEL

Human beings use base 10 (decimal)
arithmetic
There are 10 distinct symbols, 0, 1, 2, …,
9

Computers use base 2 (binary) system
There are only 0 and 1
These two binary digits are commonly
referred to as bits

Department of Computer Science and Information Engineering
National ChengKung University, TAIWAN

3

NUMBERING
AND CODING
SYSTEMS
Converting
from Decimal
to Binary

Divide the decimal number by 2
repeatedly
Keep track of the remainders
Continue this process until the quotient
becomes zero
Write the remainders in reverse order
to obtain the binary number
Ex. Convert 2510 to binary
Quotient
Remainder
25/2 =
12
1
LSB (least significant bit)
12/2 =6
0
6/2 =
3
0
3/2 =
1
1
1/2 =
0
1
MSB (most significant bit)
Therefore 2510 = 110012

HANEL

Department of Computer Science and Information Engineering
National Cheng Kung University, TAIWAN

4

NUMBERING
AND CODING
SYSTEMS

Know the weight of each bit in a binary
number
Add them together to get its decimal
equivalent

Converting
Ex. Convert 110012 to decimalfrom Binary to
Weight:
24
23
22
Decimal
Digits:
1
1
0
Sum:

16 +

8+

0+

21

20

0

1

0+

1 = 2510

Use the concept of weight to convert a
decimal number to a binary directly
Ex. Convert 3910 to binary
32 + 0 + 0 + 4 + 2 + 1 = 39
Therefore, 3910 = 1001112
HANEL

Department of Computer Science and Information Engineering
National Cheng Kung University, TAIWAN5

NUMBERING
AND CODING
SYSTEMS
Hexadecimal
System

Base 16, the

hexadecimal system,
is used as a
convenient
representation of
binary numbers
ex.
It is much easier to
represent a string of 0s
and 1s such as
100010010110 as its
hexadecimal equivalent of
896H

HANEL

Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Binary
0000
0001
0010
0011
01000101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

Hex
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

Department of Computer Science and Information Engineering
National Cheng Kung University, TAIWAN

6

NUMBERING
AND CODING
SYSTEMS

To represent a binary number as its
equivalent hexadecimal number
Start from the right and group 4 bits at a
time, replacing each 4-bitbinary number
with its hex equivalent

Converting
between Binary Ex. Represent binary 100111110101 in hex
1001 1111 0101
and Hex
=

9

F

5

To convert from hex to binary
Each hex digit is replaced with its 4-bit
binary equivalent
Ex. Convert hex 29B to binary
2
=
HANEL

9

B

0010

1001

1011

Department of Computer Science and Information Engineering
National...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Informatica
  • Informatica
  • Informatica
  • Informatica
  • Informatica
  • Informática
  • Informatica
  • Informatica

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS