Microprocessor 02

You might also like

You are on page 1of 20

Microprocessors

CSE - 357
Course Teacher: Prof. Dr. Israt Jahan
Microprocessor Data type
The data type (typical) used by the
microprocessor are,

•Signed & unsigned binary integers


•Binary Coded Decimal (BCD)
•American Standard Code for information
interchange (ASCII) &
•Floating point numbers (real numbers)
Unsigned & Signed Binary Integers

An unsigned binary integer has no arithmetic sign.

Unsigned binary nos. is always positive number.

An 8 bit unsigned binary integers represent all nos.


from 0016 through FF16 (010-25510)

A signed binary integer, on the on the otherhand, include


both positive and negative numbers.

It is represented in true form for a positive no. and in


two’s complement form for a negative number.
BCD (Binary Coded Decimal) Numbers

•A BCD digit consists of four bits with a value ranging


from 00002 to 10012 (0 - 9).

•A BCD digit greater than 910 can be represented as


two or more BCD digits.

•Microprocessor store BCD numbers in two forms -


Packed &Unpacked

•The unpacked BCD number represents each BCD digit


as a byte, while the packed BCD number represent two
BCD digits in a byte.
•Microprocessor normally input data from a keypad in
unpacked BCD form.
•This is converted to packed BCD form for arithmetic
operations or for storing in memory .
•After processing, again converted to unpacked form
for displays.

ASCII
•ASCII is a code that represents alphanumeric
(alpha charecters & numbers) in a microprocessor’s
memory.
•ASCII also represents special symbols such as #
and %. It is a 7 bit code.

•Also, note that the hex nos. 3016 - 3916 are ASCII
codes representing the decimal nos. 0 thugh 9.

Microcomputer hardware
The simplified block diagram of a microcomputer
System Bus

Memory
Microprocessor I/O
(ROM/RAM)
The System Bus
System bus contains 3 buses
•Address Bus
•Data Bus
•Control Bus
❖These buses connect the microprocessor to each of
the memory & I/O elements so that information transfer
between the microprocessor and any of the other
elements can take place.
•On Address Bus information transfer nomally takes
place only in one direction (microprocessor to
memory & I/O elements)
•The No. of unique addresses that the
microprocessor can generate on this bus depends
on the width of this bus.
•For 16 bit address bus, microprocessor can
generate 216 = 65,536 possible address.
•A different memory location or an I/O elements can
be represented by each one of these addresses.
•The data bus is bidirectional, i.e, information can
flow in both direction, to or from the microprocessor.
This bus is normally 8, 16, or 32 bit wide.
•The control bus is used to transmit signals that are
used to synchronize the operation of the individual
microcomputer elements.
•Typical control signals are read, write & reset.
•Interrupt is unidirectional, others (reset) are
bidirectional

The microprocessor
•Commercial microprocessor fabricated using MOS
technology is contained on a single chip.
•Microprocessor is comprised of a register section, one
or more ALUs & a control unit.
Depending on the register section, microprocessor
can be classified as
•Accumulator based
•General-purpose register based
In accumulator based microprocessor. (In 8085 &
Mot 6809),
•one of the operands is assured in a special
register “accumulator”.

• All arithmetic & logic operations are performed using


this register as one of the data sources.

•The result after the operation is stored in the accumulator.


• 8 bit Microprocessor are usually accumulator based.
•The general purpose microprocessor is usually
Popular with 16 and 32 bit microprocessor (Intel 8086/
80386/80486 & Motorola 68000/68020/30/40)

•It is called general purpose, since its registers can be


used to hold,
❖Data,
❖Memory address, &
❖The results of arithmetic of logic operations

• The no. size and types of register vary from one


Microprocessor to another.

•Most registers are general purpose registers, while


some are provided with dedicated functions.
•Typical dedicated registers are PC, IR, SP & Index
registers.
•PC contains the address of the next instruction to be
executed.
• In order to execute the Instruction,the microprocessor
Normally places the PC contents on the address bus &
reads (fetch) the first instruction for the external memory.

• The PC are then automatically incretmented by the ALU.


•The IR Contains the instruction to be executed.
•After fetching an instruction from memory, the
microprocessor places it in the IR for translation.
•The status register contains individual bit having a
special meaning.

•The bits in the status register are called flags.

• Each flag is usually set or reset by an ALU operation.

•The flags are used by the conditional branch Instruction.

•Typical flags include


❖Carry
❖Sign
❖Zero
❖Overflow.
•Carry (C) flag reflects whether or not an arithmetic
operation such as ADD generates a carry.

•The Carry is used to borrow flag for subtraction.

•The Zero (Z) flag is used to indicate whether the result


of an arithmetic or logic opposition is zero, Z=1
for Zero result and Z=0 for a non – zero result.

•The Sign flag indicates whether a no. is +ve or –ve


S = 1 → -ve no, if most significant is 1;
S = 0 → +ve no, if most significant is 0;
•The Overflow (V) flag is let to “1” if the result of an
arithmetic operation or “signed nos” is too large for
the microprocessor’s maximum word size (the C flag
is overflow for unsigned numbers).

•SP register address the stack.


•A stack is LIFO read / Write memory in the sense that
items go in last will come out first.
•The Stack is addressed by a register called stack
pointer (SP).
Two instructions, PUSH (write stack) and POP (stack
read), can usually be performed by the programmed to
manipulate the stack.
•Typical microprocessor access the stack from the top.
•Depending on the microprocessor, an 8 bit, 16bit or
32 bit register can be pushed onto or popped from the
stack.
•The value by which the sp is incremented or
decremented after pop or push operation depends on
register size.

•Values 1 8 bit register


2 16 bit register
4 32 bit register
16 bit register Before push stack
to be pushed

08 A1
A1 5007

5008 Sp 08 5008

Sp before Push 01 5009 after 01 5009

05 500A Push 05 500A

5009 F2 500B 5007 F2 500B

•Stack Push via Top Top of the Stack


▪Stack pop via top

16 bit register Before Pop 16 bit register in which


in which stack stack data to be pop
stack data to into
be pop into

07 21

02 F1
F1 5008

Sp before F1 5008 02 5009


Pop
02 5009 61 500A

5008 61 500A 500A 26 500B

26 500B

Top of Stack
•After PUSH , SP is decremented by 2
After POP ,SP is incremented by 2
[5008 &5009 are assured to be empty.]

•An index register is typically used as a counter for an


instruction or general storage function.
• The index register is useful with instructions where
tables or arrays of data are accessed.

You might also like