Wednesday, August 11, 2010

Microprocessors and Microcontrollers 11th Aug.

REGISTERS
==========

Two types:
(1)General Purpose Registers
(2)Special Purpose Registers

(1)General Purpose Registers
============================

Names: B,C,D,E,H,L
8 bit Storage Capacity
Possibles pairs: (B,C),(D,E),(H,L)
Pair means which performs logical or arithmetic operations
(Special thanks to Pradipta)

(2)Special Purpose Registers
============================

Used for Special purposes as the name suggests.
(I) Accumulator(A or ACC)
(II) Flag Registers
(III)Program Counter(PC)
(IV) Stack Pointer(SP)

Accumulator
===========
-> any arithmetic or logical operations
-> 8 bit register
-> Result stored in Accumulator itself

Program Counter
===============
-> Holds address of instruction, which will be executed next
-> 16 bit register

Stack Pointer
==============
->First sir told a few examples of Hexadecimal Subtraction

(2000)H - 1 = (1FFF)H
(2FFO)H - 1 = (2FEF)H
(2F00)H - 1 = (2EFF)H

Just follow the two tricks i showed in the first post of Microprocessors and Microcontrollers (6th Aug.)


-> PUSH

In normal conditions we used TOP = TOP + 1

But, now we will do TOP = TOP - 1

The reason why its done can be understood by the diagram


So as address decreases upwards, thats why TOP=TOP-1


Flag Register
=============



Accumulator carry(AC) is crossed or don't cared because SIR SAID SO!!

Now,

A <- B C
C <- D E
--------------------
A <- carry 1 9 A
Here A is the Accumulator. And output data is stored in the Accumulator
Carry 1 cant be stored in the accumulator since it is only a 8bit register as i already told.

So carry 1 will go to the D0 register i.e. CY

Important Point:
----------------

After any arithmetic or Logical operation
If accumulator contains

-> Even Number of 1 ---------Parity P(D2) will be 1 i.e. P=1
-> Odd Number of 1 ---------Parity P(D2) will be 0 i.e. P=0

So, as we got (9A)H in the accumulator
whose binary will be 1001 1010

it has even number of 1s (4 in this case)....So P=1

Z-Zero Flag (in D6)
===================

After any arithmetic or Logical operation
if answer is Zero
Then Zero flag = 1
Else
Zero Flag = 0
Suppose

Subtracting
A <- B C
A <- B C
-----------
A <- 0 0

So, hence zero flag (Z) would have been 1.

But in the example we started with A<-9 A..Z=0

SIGN 'S'(in D7)
================
After any arithmetic or Logical operation

If
D7th bit of the result at the accumulator is 1
then S = 1
ELSE
S = 0


So, the Final Flag register will look something like this.....



Few Very Important points
============================
-> 8085 cannot distinguish between positive and negative numbers
-> while writing in exams, use the sentence :"After any arithmetic or Logical operation"in case of Flag Registers

-> Q. Why 8085 microprocessor is called 8-bit microprocessor?
Answer. Its Because 8085 microprocessor can access 8-bit data simultaneously.

Thats all...Hope u enjoy...

1 comment:

Featured Post 1

notice

Featured Post 2

IETE

Featured Post 6

results

Featured Post 7

WBUT

Featured Post 3

Featured Post 4

Featured Post 5

Featured Post 8