Professional Documents
Culture Documents
Microprocessor Basic Concepts and 8085 Microprocessor Architecture
Microprocessor Basic Concepts and 8085 Microprocessor Architecture
- Registers
- Programmable
- General purpose (B, C, D, E, H, L Registers)
- Special Purpose (AC, FR, PC, SP)
- Non-Programmable – IR, Temporary Registers
Page 1 of 11 1
TAO1221 Computer Architecture and Organization Tutorial 1
• Display device, through which the computer displays its messages and results
• Clock (a square wave oscillator) which drives the CPU to perform at a certain rate.
Page 2 of 11 2
TAO1221 Computer Architecture and Organization Tutorial 1
The actions performed by the microprocessor can be grouped into four categories:
1. CPU-Memory: Data may be transferred from the CPU to memory or from memory
to CPU.
2. CPU-I/O: Data maybe transferred to or from the outside world by transferring
between the CPU and an I/O module.
3. Data Processing: The CPU may perform some arithmetic or logic operations on
data.
4. Control: An instruction may specify that the sequence of execution be altered (e.g.,
a Jump instruction, which changes the content of the PC (program counter)). For
example, the CPU may fetch an instruction from memory location 149, which
specifies that the next instruction be fetched from location 182. The CPU will
remember this fact by setting the program counter to 182. Thus, on the next fetch
cycle, the instruction will be fetched from location 182 rather than 150.
Page 3 of 11 3
TAO1221 Computer Architecture and Organization Tutorial 1
Microcontroller: A device that includes microprocessor, memory and I/O signal lines
on a single chip of silicon fabricated using VLSI technology.
Page 4 of 11 4
TAO1221 Computer Architecture and Organization Tutorial 1
Compiler: A program that translates English like words of high level language into the
machine language of a computer. A compiler reads a given program, called a source
code, in its entirety and then translates the program into the machine language, which
is called the object code.
Interpreter: same function as compiler (A program that translates English like words of
high level language into the machine language of a computer.). Difference is – it
translates one statement at a time from a source code to an object code.
Monitor Program: A program that interprets the input from a keyboard and converts
the input into its binary equivalent. It is stored in ROM since this does not need
alterations.
User Program: Read/Write memory is used for storing user programs and data. The
information stored in this memory can be easily read and altered.
Manual/Hand Assembly:
For small programs, in order to manually write and execute an assembly language
program on a single-board computer, with a Hex keyboard for input and LEDs for
output, the following steps are necessary.
1. Write the instructions in mnemonics obtained from the instruction set supplied by
the manufacturer.
2. Find the hexadecimal machine code for each instruction by searching through the
set of instructions.
3. Enter (load) the program in the user memory in a sequential order by using the
Hex keyboard as the input device.
Page 5 of 11 5
TAO1221 Computer Architecture and Organization Tutorial 1
4. Execute the program by pressing the Execute key. The answer will be displayed
by the LEDs.
When the user program is entered by the keys, each entry is interpreted and converted
into its binary equivalent by the monitor program, and the machine code is stored as
eight bits in each memory location in a sequence. When the Execute command is
given, the microprocessor fetches each instruction, decodes it, and executes it in a
sequence until the end of the program.
Using cross-assembler:
2. Call a cross-assembler such as X8085 and assemble the source file saved in step1.
The X8085 generates an intermediate binary file called an object file and provides a
list of errors. Go back and repeat step1 to correct errors. Repeat step 2 and
reassemble the program. Repeat steps 1 and 2 until the cross-assembler gives a
message of zero errors.
The cross-assembler also generates a list file that includes memory addresses,
machine codes in Hex, labels, and comments. This file is used for documentation.
3. Call a link program and use the intermediate file to generate Hex file.
4. Download Hex file into Target system (single board microcomputer) and execute
program.
5. If the expected results are not achieved, troubleshoot using single step and /or
breakpoint technique. Once you find an error, you must go back to step 1 and
repeat all the steps.
Page 6 of 11 6
TAO1221 Computer Architecture and Organization Tutorial 1
1. Highlights:
• The 8085 is an 8 bit microprocessor capable of addressing up to 64K bytes of
memory
• It has eight addressable 8 bit registers, six of which can also be used as three pairs
of 16 bit registers. Besides this the accumulator and flag register are special
purpose 8 bit registers. Program counter and Stack pointer are special purpose 16
bit registers.
• The five hardware interrupts, in order of decreasing priority are: TRAP, RST 7.5,
RST 6.5, RST 5.5, and INTR. TRAP is unmaskable
• The 40 pin device, powered by +5V DC, has provisions for generating its own clock
signal. Of the sixteen address lines, the low-order eight lines are multiplexed with
the eight data lines.
• The timing operation is based on seven types of machine cycles: Opcode Fetch,
Memory Read/Write, I/O Read/Write, INTR Acknowledge, and Bus Idle
Page 7 of 11 7
TAO1221 Computer Architecture and Organization Tutorial 1
2. FUNCTIONAL DESCRIPTION:
2.1 REGISTERS
Registers of 8085 microprocessor are classified into programmable and
nonprogrammable registers.
2.1.1 PROGRAMMABLE
The 8085 has six general-purpose registers (B, C, D, E, H and L) to store 8 bit data
during a program execution. They can be used either singly, or as 16 bit register pairs
BC, DE, and HL.
The register pair HL, besides its possible use as two independent 8 bit
registers, functions as a data pointer. It can hold memory addresses that are referred
to in a number of instructions which use ‘Register Indirect Addressing’
8-BIT REGISTERS
Accumulator:
• Used to store 8 bit data (one of the operands) during arithmetic, logic, load and
store operations.
• Used to store the result of an operation
• Used to store 8 bit data during programmed I/O type of data transfer
It is an 8-bit register, in which five of the bits carry significant information in the form
of flags:
S (sign flag), Z (zero flag), AC (auxiliary carry flag), P (parity flag), and CY
carry flag), as given in the following diagram.
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
Page 8 of 11 8
TAO1221 Computer Architecture and Organization Tutorial 1
If the least significant seven out of the eight bits of the Accumulator are used for data
and the bit 7 (the most significant bit) is used for the sign of the data in the
Accumulator, then numbers can be used in the range -128 to + 127, After the execution
of an arithmetic or a logic instruction, the sign flag is set ('0' for positive, '1' for
negative), according to the most significant bit of the accumulator contents.
If the result obtained after executing an instruction is zero, the zero flag is set (that is, it
becomes ‘1 '), When the result is non-zero, the zero flag is cleared (that is, it becomes
'0'), If any result has zero for the byte value and also has a Carry, then both the zero
flag and the carry flag are set.
In arithmetic operations, such as addition and subtraction involving two 8-bit numbers,
there are situations where an addition results in an overflow from the highest order bit
(to a non-existent 9th bit position), or in subtraction, a borrow. In both the examples
shown below, the Carry/borrow flag is set.
Page 9 of 11 9
TAO1221 Computer Architecture and Organization Tutorial 1
This flag is set for an overflow out of bit 3 of the Accumulator in the same way as the
overflow out of bit 7 shown above. This flag is used in BCD (Binary Coded Decimal)
arithmetic.
Parity is defined by the number of 1-bits present in the Accumulator. If the parity is
even, the parity flag is set (to '1 '); if the parity is odd, the parity flag is cleared (it
becomes '0').
The Accumulator, the flag register, along with a few temporary registers (that are
inaccessible to the programmer) constitute the Arithmetic Logic Unit (ALU). The ALU
performs arithmetic, logic, and rotate operations; the results of these operations could
be placed in the Accumulator, or placed elsewhere through the internal data bus.
16-Bit REGISTERS:
Program Counter acts as a pointer to the next instruction to be executed, and always
contains the 16-bit address of the memory location of the next instruction.
The PC is updated by the processor and points to the next instruction after the
processor has fetched an instruction (the exact number by which the processor
updates, depends on the nature of the instruction; for example, for one-byte
instructions it updates the PC by one, for three-byte instructions, it updates the PC by
three).
Stack Pointer register ordinarily holds the address of the last byte written onto the
Stack. This is also called Top of Stack or simply Stack Top. The Stack Pointer is
decremented automatically each time data is pushed onto the Stack and is
incremented automatically when data is popped off the Stack. This decrementing and
incrementing is always by two bytes since all Stack operations involve register pairs.
Page 10 of 11 10
TAO1221 Computer Architecture and Organization Tutorial 1
These functional entities are not accessible to the programmer. After fetching an
instruction from the memory, the processor loads it in the Instruction Register. This
instruction is decoded by the Decoder and the processor then executes the instruction.
The first step in the execution of an instruction by the CPU is fetching the
instruction, byte by byte, from the memory. The instruction can be of 1 to 3 bytes in the
case of 8085A. The first byte contains the Opcode (which specifies the nature of
operation, and indicates whether the overall instruction is of 1, 2, or 3 bytes). The first
byte retrieved from the memory is transferred through the internal bus of the CPU to
the 8-bit Instruction Register; this in turn becomes available to the Decoder which
decodes it, and the output, gated by timing signals, controls the registers, the data and
address buffers, and the ALU. The state and machine cycle timing signals, which
would depend on the nature of the instruction to be executed, are generated by the
outputs of the Instruction Decoder and the internal clock generator.
Reference:
Page 11 of 11 11