Вы находитесь на странице: 1из 13

USMAN INSTITUTE OF TECHNOLOGY

HAMDARD UNIVERSITY
DEPARTMENT OF ELECTRICAL ENGINEERING

(EL-314) MICROPROCESSOR BASED SYSTEMS


SPRING 2014 (DS LAB)

Engr. Zia Uddin


Engr. Asad Hussain
Engr. Hammad Munammi

EXPERIMENT NO.1
OBJECTIVES: Introduction to INTEL 8085, 8085 Simulator (Sim8085).
Name of Student & Roll No.

:___________________________________

Group

:___________________________________

Date of Experiment

:___________________________________

Report Submitted on

:___________________________________

Marks Obtained

:___________________________________

Remarks if any

:___________________________________

Signature

:___________________________________

INTRODUCTION TO 8085:
A 40-pin IC
Six groups of signals
o Address Bus
o Data Bus
o Control and Status pins
o Power Supply & frequency signals
o Externally initiated Signals
o Serial I/O ports

U7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

X1
X2
RST-OT
SOD
SID
TRAP
RST 7.5
RST 6.5
RST 5.5
INTR
INTA
AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
VSS

VCC
HOLD
HLDA
CLKO
RST-IN
READY
IO/M
S1
RD
WR
ALE
S0
A15
A14
A13
A12
A11
A10
A9
A8

8085

U8
1
2
40
20
5
4
6
9
8
7
10
39
35
36
11
38
3
37

X1
X2
VCC
VSS
SID
SOD
TRAP
RST 5.5
RST 6.5
RST 7.5
INTR
HOLD
READY
RST-IN
INTA
HLDA
RST-OT
CLKO
8085

AD0
AD1
AD2
AD3
AD4
AD5
AD6
AD7
A8
A9
A10
A11
A12
A13
A14
A15
ALE
WR
RD
IO/M
S0
S1

12
13
14
15
16
17
18
19
21
22
23
24
25
26
27
28
30
31
32
34
29
33

40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21

8085 OPERATIONS:
Microprocessor initiated operation:

Memory Read
Memory Write
I/O Read
I/O Write

Internal operation:

Store 8-bit data


Perform Arithmetic and Logic Operations
Test for conditions
Sequence the execution of instructions
Store/Retrieve data from stack during execution

Peripheral/Externally Initiated Operations:

Reset
Interrupt
Ready
Hold

Architecture of 8085:

Power Supply a +5V DC power supply


Maximum clock frequency of 3MHz
8-bit general purpose microprocessor
16-bit Address Bus
o Capable of addressing 64K of memory
Arithmetic Logic Unit (ALU)
8085 has 8-bit ALU
Performs arithmetic & Logic operations on data
Timing & Control Unit
Generates timing and control signals
General Purpose Registers
8-bit registers (B,C,D,E,H,L)
16-bit register pairs (BC, DE, HL,PSW)
Program Status Word (PSW)
Accumulator and Flag Register can be combined as a register pair called PSW
Instruction Register and Decoder
Instruction fetched from memory is stored in Instruction register (8-bit register)
Decoder decodes the instruction and directs the Timing & Control Unit accordingly
Interrupt Control
8085 has 5 interrupt signals
o INTR general purpose interrupt
o RST 5.5
Restart Interrupts
o RST 6.5
o RST 7.5
o TRAP non-maskable interrupt
The interrupts listed above are in increasing order of priority
Serial I/O Control
8085 has two signals for serial communication
SID Serial Input Data
SOD Serial Output Data
Address Bus
Used to address memory & I/O devices
8085 has a 16-bit address bus

Data Bus
Used to transfer instructions and data
8085 has a 8-bit data bus
The 8085 Programming Model:
The 8085 programming model includes six registers, one accumulator, and one flag register, as
shown in Figure. In addition, it has two 16-bit registers: the stack pointer and the program
counter. They are described briefly as follows.

Six general-purpose registers


B, C, D, E, H, L
Can be combined as register pairs to perform 16-bit operations (BC, DE, HL)
Accumulator identified by name A
This register is a part of ALU
8-bit data storage
Performs arithmetic and logical operations
Result of an operation is stored in accumulator
Flag Register
This is also a part of ALU
8085 has five flags named

o Zero flag (Z)


o Carry flag (CY)
o Sign flag (S)
o Parity flag (P)
o Auxiliary Carry flag (AC)
These flags are five flip-flops in flag register
Execution of an arithmetic/logic operation can set or reset these flags
Condition of flags (set or reset) can be tested through software instructions
8085 uses these flags in decision-making process
Program Counter (PC)
A 16-bit memory pointer register
Used to sequence execution of program instructions
Stores address of a memory location
where next instruction byte is to be fetched by the 8085
when 8085 gets busy to fetch current instruction from memory
PC is incremented by one
PC is now pointing to the address of next instruction
Stack Pointer Register
a 16-bit memory pointer register
Points to a location in Stack memory
Beginning of the stack is defined by loading a 16-bit address in stack pointer register

The 8085 Addressing Modes:


The instructions MOV B, A or MVI A, 82H are to copy data from a source into a destination.
In these instructions the source can be a register, an input port, or an 8-bit number (00H to
FFH). Similarly, a destination can be a register or an output port. The sources and destination
are operands. The various formats for specifying operands are called the ADDRESSING
MODES. For 8085, they are:
Immediate addressing.
Register addressing.
Direct addressing.
Indirect addressing.

Immediate addressing
Data is present in the instruction. Load the immediate data to the destination provided.
Example: MVI R,data

Register addressing
Data is provided through the registers.
Example: MOV Rd, Rs

Direct addressing
Used to accept data from outside devices to store in the accumulator or send the data stored in the
accumulator to the outside device. Accept the data from the port 00H and store them into the
accumulator or Send the data from the accumulator to the port 01H.
Example: IN 00H or OUT 01H

Indirect Addressing
This means that the Effective Address is calculated by the processor. And the contents of the address
(and the one following) is used to form a second address. The second address is where the data is
stored. Note that this requires several memory accesses; two accesses to retrieve the 16-bit address and
a further access (or accesses) to retrieve the data which is to be loaded into the register.

Interfacing I/O devices with 8085:


Memory-mapped I/O
Peripheral-mapped I/O
Memory-mapped I/O
8085 uses its 16-bit address bus to identify a memory location
Memory address space: 0000H to FFFFH
8085 needs to identify I/O devices also
I/O devices can be interfaced using addresses from memory space
8085 treats such an I/O device as a memory location
This is called Memory-mapped I/O
Peripheral-mapped I/O
8085 has a separate 8-bit addressing scheme for I/O devices
I/O address space: 00H to FFH
This is called Peripheral-mapped I/O or I/O-mapped I/O
8085 Communication with I/O devices
Involves the following three steps
o Identify the I/O device (with address)
o Generate Timing & Control signals
o Data transfer takes place
8085 communicates with a I/O device only if there is a Program Instruction to do so

Instruction Set Classification


An instruction is a binary pattern designed inside a microprocessor to perform a specific
function. The entire group of instructions, called the instruction set, determines what functions
the microprocessor can perform. These instructions can be classified into the following five
functional categories:
Data transfer (copy) operations.
Arithmetic operations.
Logical operations.
Branching operations
Machine-control operations.

Data Transfer (Copy) Operations


This group of instructions copy data from a location called a source to another location called a
destination, without modifying the contents of the source. In technical manuals, the term data
transfer is used for this copying function. However, the term transfer is misleading; it creates
the impression that the contents of the source are destroyed when, in fact, the contents are
retained without any modification.

Arithmetic Operations
These instructions perform arithmetic operations such as addition, subtraction, increment, and
decrement.

Logical Operations
These instructions perform various logical operations with the contents of the accumulator.
AND, OR Exclusive-OR
Rotate
Compare
Complement

Branching Operations
This group of instructions alters the sequence of program execution either conditionally or
unconditionally.
Jump
Call, Return, and Restart

Machine Control Operations


These instructions control machine functions such as Halt, Interrupt, or do nothing. The
microprocessor operations related to data manipulation can be summarized in four functions:
Copying data
Performing arithmetic operations
Performing logical operations
Testing for a given condition and alerting the program sequence

Instruction Format
An instruction is a command to the microprocessor to perform a given task on a specified data.
Each instruction has two parts: one is task to be performed, called the operation code (opcode),
and the second is the data to be operated on, called the operand. The operand (or data) can be
specified in various ways. It may include 8-bit (or 16-bit ) data, an internal register, a memory
location, or 8-bit (or 16-bit) address. In some instructions, the operand is implicit.
Instruction word size
The 8085 instruction set is classified into the following three groups according to word size:
One-word or 1-byte instructions
Two-word or 2-byte instructions
Three-word or 3-byte instructions

INTRODUCTION TO Sim8085:
This simulator helps to understand of the instruction execution and memory management of
8-bit Intel 8085 microprocessor. For this purpose, a program, which is run on Intel 80386 based
CPUs and under Win32 operating system, is written using a high level visual programming
language. With this program, namely Sim8085, one can write a 8085 microprocessor assembly
language code in text format and then simulate it line by line just as it runs on the original CPU.
While the assembly codes are executed (simulated), the register, memory (code, stack or data)
and port contents can be viewed instantly. There can be also made some modifications to these
values at run-time, if needed. With the Sim8085, all the work is done in very user-friendly
environment.

The figure illustrates the window of Sim8085. Further details are discussed in details below.
This simulator is divided into two parts:
i) Editor part.
ii) Debugger part.

i) Editor part:
The Sim8085 has a very user-friendly text editor. There can be opened up to ten different files
at a time. Default file extension for opening and saving files is 85. There is an adjustable
undo-buffer. There are some information-based tags: Cursor position, editor buffer
modification, editor cursor mode, file read-only info, and context sensitive help are shown
instantly at the Status Bar. The editor and file commands in the Sim8085 are: New,
Open, ReOpen, Save, Save As, Save All, Close, Print, Undo, ReDo, Cut,
Copy, Paste, Select All, Find, Replace.

The editor part has a built-in compiler that checks the written assembly code for syntax errors.
After all the lines are checked, the erroneous line is shown with respective error message and
line number, if there is any mistake; otherwise, the user is informed with a message including
the compiled code size. Screen snapshots are shown below.

The list and object files can be generated automatically every time the source code is compiled
or manual by the user, depending on the settings. Screen snapshots of these text-based files are
shown below.

There are some pre-assigned words, which are called as Pseudo-Directives. These directives
make the writing of programs and/or algorithms easy. The meaning and usage syntax of each
pseudo-directive is shown below:
FillByte count,byte:
Fills the memory starting from the current memory address with the given byte at a given
count.
Org address:
Tells to the compiler to place the machine codes starting from the given address.
KickOff address:
Tells to the compiler that where the entry point (starting address) of the written assembly code
is.
Db string of bytes/characters:
This directive makes the entry of any string, character or byte is easy. The all characters in a
string are individually follows each other in the memory. An example of usage is, Db
13,10,This is a sample text,13,00001010b,24h.

ii) Debugger Part:


After the source code is compiled successfully, meaning there is no any syntax error, debugger
mode can be begun. Debugger screen consists of a code pane, a register pane, a flag pane, a
stack pane and a data pane. The screen layout is shown below.

In fact, code, stack and data panes show the memory content according to their duties;
however, the memory location they point can be different. Code pane interprets the bytes in
virtual memory as 8085-p machine codes; whereas data pane interprets the bytes in virtual
memory as pure characters, but also showing the hexadecimal equivalents. Both the code and
stack panes show their content with the respective offset address in a tabular form. Stack pane
shows the memory location as two bytes (word), indicated by the stack pointer register, SP,
with a range of 5 words. Register pane shows the all 8085-p register contents and also the
memory byte location indexed by HL register pair. Likewise, flag pane shows the flag register
and the individual bits of it. To make the following easy, the changed registers and flag bits are
drawn with a separate color while tracing. The current line or location in each pane is shown by
a highlighted bar. The user can be cycle through the panes with keyboard or even a mouse
click. Contents of the ports can be viewed and even changed bit by bit within the Ports Form.
Port numbers are pre-assigned and can be changed from the Options Menu. Values are shown
in decimal, hexadecimal and octal, too. Snapshot is show below.

Answer the following questions:


1) What are the various registers in 8085?

2) Give an example of one address microprocessor?

3) List the allowed register pairs of 8085.

4) What is an Opcode?

5) What is an Operand?

6) What is assembler?

7) What do you understand by editor and debugger?

8) What are the steps involve in communication of 8085 with I/O devices?

9) What is PSW?

10) List the two pins that are used to control the serial I/O operations in 8085?

Вам также может понравиться