Anda di halaman 1dari 26

S O R I N G

E S F A C
R O C E R
O P I N T
R
I C G AN 2 D
63 M
C 2 M IN t ur e
ES GRAM Lec
PR O

12-01-2011 ES C263 Microprocessor Programming 1


and Interfacing
Last Lecture
 Evolution of Computers and Microprocessors
 Moore's Law

12-01-2011 ES C263 Microprocessor Programming 2


and Interfacing
Today's Lecture
 Instruction Set Architecture
 Overview of a Microprocessor
 Design Example

12-01-2011 ES C263 Microprocessor Programming 3


and Interfacing
The Personal Computer
Speaker

Processor
Timer (8086 Coprocessor
logic through (8087 through System 640KB
(8253) Pentium 80387 ROM DRAM

System bus (data, address & control signals)

Keyboard DMA Expansion Interrupt


logic (8253) Controller logic logic (8259)
(8237)
Video card
Disk controller
Serial port
12-01-2011
Keyboard ES C263 Microprocessor
... Programming 4
and Interfacing
Extension slots
Instruction Set
Architecture (ISA)
 ISA refers to the actual set of programmer visible
instruction set.
 Serves as a boundary between the hardware and
software.

Seven dimensions of ISA
 Class of ISA: general purpose register
architectures, where operands are either
memory or register locations.

12-01-2011 ES C263 Microprocessor Programming 5


and Interfacing
• Memory Addressing: Byte addressing to access
memory locations.
• Addressing Modes: specify the address of
register, constant operands and memory
objects-- register, immediate, displacement.

12-01-2011 ES C263 Microprocessor Programming 6


and Interfacing
• Types and sizes of operands: supports operand sizes of 8
bit, 16 bit, 32 bit.
• Operations: data transfer, arithmetic, logic, control.
• Control flow instructions: support conditonal branches,
unconditional jumps, procedure calls and returns.
• Encoding an ISA: fixed length or variable length.

12-01-2011 ES C263 Microprocessor Programming 7


and Interfacing
12-01-2011 ES C263 Microprocessor Programming 8
and Interfacing
Memory Overview

12-01-2011 ES C263 Microprocessor Programming 9


and Interfacing
RAM

12-01-2011 ES C263 Microprocessor Programming 10


and Interfacing
011111110100010101001100010001100000000100000010000000010000000000
Evolution of 000000000000000000000000000000000000000000000000000000000000000000
000000000010000000000000010000000000000000000000000000000010000000
000000000000000000000000000000000000000000000000000000000000000000
programming: 000000000000010100001000000000000000000000000000000000000000000001
101000000000000000000000000000000000000000000001010000000000000001
machine language 000000000000000000100000000001011100111001101101000011100110111010
001110010011101000110000101100010000000000010111001110100011001010
111100001110100000000000010111001110010011011110110010001100001011
101000110000100000000001011100111001101111001011011010111010001100
001011000100000000000101110011100110111010001110010011101000110000
101100010000000000010111001110010011001010110110001100001001011100
111010001100101011110000111010000000000001011100110001101101111011
011010110110101100101011011100111010000000000000000000000000000000
000100111011110001110111111100100000001001100000000000000000000000
late 40’s / early 50’s: 010010000000100100110000000000000000101010000000000000000000000001
001001000010010101000000000000001000000000000000000000000000000000
programmers coded directly 000010000000000000000000000001010000000010000000000000000100010010
000000100000000000000010000000101010000000000000000000000001001001
000010010101000000000000001000000000000000000000000000000000000010
in machine language 000000000000000000000001011000000010000000000000001000010000000000
000000000001000000001000000000000000000000000100000011100011111100
000000010001000000111101000000000000000000000000000000000000000000
000000000010010000110010101101100011011000110111101110111011011110
111001001101100011001000010000100000000000000000000000000000000000
000000000000000000000000000010000000000000000000000000000000000000
 each machine had its 000000000000000000000000000000001000000000011111111111100010000000
000000000000000000000000100000000000000000000000000000000000000000
own set of instructions 000000000000000000000000000010000000000111111111111000100000000000
000000000000000000000000000000000000000000000000000000000000000000
(sequences of 0's & 1's) 000000000000000000000000011000000000000000000000011000000000000000
000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000100000000000000000000000000000
corresponding to its 000000000000000000000000000000000000000000000000000000000000000000
000000001100000000000000000000001000000000000000000000000000011010
underlying hardware 000000000000000000000000000000000000000000000000000000000000000000
010000000000000000000000000000000000000000000000000000001000100000
000000000000000000000000000000000000000000000000000000000000000100
000000000000000000000000000000000000000000000000000100011000000000
000000000000000000000000000000000000000000000000000000000001000000
000000000000000000000000000000000000000000000001011000000000000000
 extremely tedious, 000000000000000000000000000000000000000000000000000000010000000000
000000000000000000000000000000000000000000011010010000000000000000
error-prone 000000000000000000000000000000000000000001001000000100100000000000

12-01-2011 ES C263 Microprocessor Programming 11


and Interfacing
Microprocessor
-Fetches Instruction

-Executes Instruction

12-01-2011 ES C263 Microprocessor Programming 12


and Interfacing
Computer Hardware Organization
Example: 3 Instructions of a program
• Input Value from port 05
• Add 7 to this value
• Output the result to port 02

Control
unit common bus

Arithmetic
logic
unit

memory
output input
Registers program data
storage storage unit unit

12-01-2011 ES C263 Microprocessor Programming 13


and Interfacing
Add
Bus

Data
CPU Bus

Control
signals

12-01-2011 ES C263 Microprocessor Programming 14


and Interfacing
Add Bus

Data Bus
Memory

Read

Write

Memory – Registers to hold bits


12-01-2011 ES C263 Microprocessor Programming 15
and Interfacing
Ex :
4 bits

8 Registers

Add lines : 3 (Unidirectional)


Data lines : 4 ES
12-01-2011 (Bidirectional)
and
C263 Microprocessor Programming
Interfacing
16
Design Example

12-01-2011 ES C263 Microprocessor Programming 17


and Interfacing
Design a microprocessor based system to
control pH of a solution in a reactor tank.

– User enters desired pH (0-14) and controller


gain
– Reactor tank provided with three pH
sensors, to compute the average pH.
– Reactor tank has three inputs.
• (acid, base flow controlled by valves,
effluent discharged from factory)

12-01-2011 ES C263 Microprocessor Programming 18


and Interfacing
Valve Control

-Controlled by stepper motors


-1 step is by 1.8 degrees rotation

Valve opening = kP * error

Where error = desired pH – measured pH.

Error positive- close fully acid valve and open


base valve accordingly

Error negative- close fully base valve and open acid valve
accordingly.
12-01-2011 ES C263 Microprocessor Programming 19
0 – 360 degrees correspond to 0 to 200 steps.
and Interfacing
Parallel Serial
I/O I/O

CPU Memory I/O


Interface
Data

Address

Control

12-01-2011 ES C263 Microprocessor Programming 20


and Interfacing
Stepper Motor sequence:

A B C D

1 0 1 0
0 1 1 0
0 1 0 1
1 0 0 1
1 0 1 0
CW ACW

Use a 4- bit port + driver (nearly 1 A current)


12-01-2011 ES C263 Microprocessor Programming 21
and Interfacing
pH sensor
Vout

0 pH
7 14

Voltage output 60mV/pH


-420mV - +420mV

12-01-2011 ES C263 Microprocessor Programming 22


and Interfacing
Interfacing Analog to Digital Converter

8-bit ADC
I0
D0
I7
D7
Start
A
EOC
B
C OE
ALE
ADC 0809
12-01-2011 ES C263 Microprocessor Programming 23
and Interfacing
Input Keys

- Numeric keys 0 – 9

- Function keys
pH, kP, enter

Matrix Keypad interfacing!!

- 2 four bit ports.


12-01-2011 ES C263 Microprocessor Programming 24
and Interfacing
Two digit Display
Two seven segment display
devices to display pH

Memory Interfacing
ROM (4K) - FF000H – FFFFFH

- SRAM (4K) - 00000H – 00FFFH

12-01-2011 ES C263 Microprocessor Programming 25


and Interfacing
Method of Approach

Identify input and output devices


Memory requirements
Suitable memory and I/O interfacing
ALP
-Assumptions made
-ALP

12-01-2011 ES C263 Microprocessor Programming 26


and Interfacing

Anda mungkin juga menyukai