Pages

Showing posts with label Microprocessor. Show all posts
Showing posts with label Microprocessor. Show all posts

Saturday, 29 June 2013

Introduction to 8085 Architecture and Programming

Introduction to 8085 Architecture and Programming

Contents

1. Internal architecture of 8085 microprocessor
2. 8085 system bus
3. 8085 pin description.
4. 8085 functional description.
5. Programming model of 8085 microprocessor
6. Addressing modes.
7. Instruction set classification.
8. Instruction format.
9. Sample programs.



Control Unit


        Generates signals within uP to carry out the instruction, which has been decoded. In
reality causes certain connections between blocks of the uP to be opened or closed, so
that data goes where it is required, and so that ALU operations occur.
Arithmetic Logic Unit
       The ALU performs the actual numerical and logic operation such as ‘add’, ‘subtract’,
‘AND’, ‘OR’, etc. Uses data from memory and from Accumulator to perform
arithmetic. Always stores result of operation in Accumulator.
Registers
       The 8085/8080A-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.
The 8085/8080A has six general-purpose registers to store 8-bit data; these are
identified as B,C,D,E,H, and L as shown in the figure. They can be combined as
register pairs - BC, DE, and HL - to perform some 16-bit operations. The
programmer can use these registers to store or copy data into the registers by using
data copy instructions.

Accumulator

          The accumulator is an 8-bit register that is a part of arithmetic/logic unit (ALU). This
register is used to store 8-bit data and to perform arithmetic and logical operations.
The result of an operation is stored in the accumulator. The accumulator is also
identified as register A.

Flags

     The ALU includes five flip-flops, which are set or reset after an operation according
to data conditions of the result in the accumulator and other registers. They are called
  1. Zero(Z)
  2. Carry (CY)
  3.  Sign (S)
  4.  Parity (P)
  5.  Auxiliary Carry (AC) flags
they are listed in the Table and their bit positions in the flag register are shown in the Figure
below. The most commonly used flags are Zero, Carry, and Sign. The microprocessor
uses these flags to test data conditions.
          For example, after an addition of two numbers, if the sum in the accumulator id larger
than eight bits, the flip-flop uses to indicate a carry -- called the Carry flag (CY) -- is
set to one. When an arithmetic operation results in zero, the flip-flop called the
Zero(Z) flag is set to one. The first Figure shows an 8-bit register, called the flag
register, adjacent to the accumulator. However, it is not used as a register; five bit
positions out of eight are used to store the outputs of the five flip-flops. The flags are
stored in the 8-bit register so that the programmer can examine these flags (data
conditions) by accessing the register through an instruction microprocessor.
The conditions (set or reset) of the flags are tested through the software
instructions. For example, the instruction JC (Jump on Carry) is implemented to
change the sequence of a program when CY flag is set. The thorough understanding
of flag is essential in writing assembly language programs.

Program Counter (PC)

         This 16-bit register deals with sequencing the execution of instructions. This register
is a memory pointer. Memory locations have 16-bit addresses, and that is why this is a
16-bit register.
The microprocessor uses this register to sequence the execution of the instructions.
The function of the program counter is to point to the memory address from which the
next byte is to be fetched. When a byte (machine code) is being fetched, the program
counter is incremented by one to point to the next memory location

Stack Pointer (SP)

        The stack pointer is also a 16-bit register used as a memory pointer. It points to a
memory location in R/W memory, called the stack. The beginning of the stack is
defined by loading 16-bit address in the stack pointer. The stack concept is explained
in the chapter "Stack and Subroutines."

Instruction Register/Decoder

        Temporary store for the current instruction of a program. Latest instruction sent here
from memory prior to execution. Decoder then takes instruction and ‘decodes’ or
interprets the instruction. Decoded instruction then passed to next stage.

Memory Address Register

        Holds address, received from PC, of next program instruction. Feeds the address bus
with addresses of location of the program under execution.

Control Generator

        Generates signals within uP to carry out the instruction which has been decoded. In
reality causes certain connections between blocks of the uP to be opened or closed, so
that data goes where it is required, and so that ALU operations occur.

Register Selector

        This block controls the use of the register stack in the example. Just a logic circuit
which switches between different registers in the set will receive instructions from
Control Unit.

For more subscribe us...

Read more...

Complete Processor System Architecture

Complete Processor System Architecture

The typical processor system consists of:
  •        CPU -central processing unit
    •       ALU -Arithmetic Logic unit
    •       Control Logic
    •       Registers,etc..
  •        Memory
  •        Input/Output interface
Interconnections between these units:
  •       Address Bus
  •       Data Bus
  •       Control Bus


The internal architecture of the 8085 CPU is capable of performing the following operations:
§   Store 8-bit data (Registers, Accumulator)
§
§   Perform arithmetic and logic operations (ALU)
§
§   Test for conditions (IF / THEN)
§
§   Sequence the execution of instructions
§
   Store temporary data in RAM during execution 

Download complete PPT Here


Read more...

Introduction to Microprocessor Architecture

An Introduction to Microprocessor  Architecture using intel 8085 as a classic processor





 The typical processor system consists of:
  • CPU (central processing unit)
  • ALU (arithmetic-logic unit)
  • Control Logic
  • Registers, etc…
  • Memory
  • Input / Output interfaces


Interconnections between these units:
  •       Address Bus
  •       Data Bus
  •       Control Bus

**Read more: PPT HERE




Read more...

SUBTRACTION OF TWO 8 BIT NUMBERS


SUBTRACTION OF TWO 8 BIT NUMBERS

AIM:
     To perform the subtraction of two 8 bit numbers using 8085.
   
ALGORITHM:
     1. Start the program by loading the first data into Accumulator.
        Move the data to a register (B register).
     2. Get the second data and load into Accumulator.
     3. Subtract the two register contents.
     4. Check for carry.
     5. If carry is present take 2’s complement of Accumulator.
     6. Store the value of borrow in memory location.
     7. Store the difference value (present in Accumulator) to a memory
     8. location and terminate the program.
 

PROGRAM:
          MVI C, 00I Initialize C to 00
          LDA 4150     Load the value to Acc.
          MOV B, A    Move the content of Acc to B register.
          LDA 4151     Load the value to Acc.
          SUB B
          JNC LOOP   Jump on no carry.
          CMA           Complement Accumulator contents.
          INR A          Increment value in Accumulator.
          INR C          Increment value in register C
LOOP: STA 4152     Store the value of A-reg to memory address.
          MOV A, C    Move contents of register C to Accumulator.
          STA 4153     Store the value of Accumulator memory address.
          HLT             Terminate the program.

OBSERVATION:
            Input:   06 (4150)
                       02 (4251)
            Output: 04 (4152)
                        01 (4153)
                 
RESULT:
     Thus the program to subtract two 8-bit numbers was executed.


NOTE: AM SHARING THIS FOR EDUCATIONAL PURPOSE ONLY.
Read more...

DIVISION OF TWO 8 BIT NUMBERS


DIVISION OF TWO 8 BIT NUMBERS

AIM:
     To perform the division of two 8 bit numbers using 8085.
     
ALGORITHM:
     1) Start the program by loading HL register pair with address of memory location.
     2) Move the data to a register(B register).
     3) Get the second data and load into Accumulator.
     4) Compare the two numbers to check for carry.
     5) Subtract the two numbers.
     6) Increment the value of carry .
     7) Check whether repeated subtraction is over and store the value of product and
        carry in memory location.
     8) Terminate the program.
     

PROGRAM:
               LXI  H, 4150
               MOV  B,M      Get the dividend in B – reg.
               MVI  C,00       Clear C – reg for qoutient
               INX  H
               MOV A,M       Get the divisor in A – reg.
NEXT:        CMP B           Compare A - reg with register B.
               JC  LOOP        Jump on carry to LOOP
               SUB  B            Subtract A – reg from B- reg.
               INR C               Increment content of register C.
               JMP NEXT        Jump to NEXT
 LOOP:       STA 4152        Store the remainder in Memory
               MOV A,C
               STA 4153         Store the quotient in memory
               HLT                  Terminate the program.

OBSERVATION:   

    Input:
      F (4150)
     FF (4251)

    Output:
     01 (4152) ---- Remainder
     FE (4153) ---- Quotient
    
RESULT:
Thus the program to divide two 8-bit numbers was executed.


NOTE: AM SHARING THIS FOR EDUCATIONAL PURPOSE ONLY.
Read more...

MULTIPLICATION OF TWO 8 BIT NUMBERS


MULTIPLICATION OF TWO 8 BIT NUMBERS


AIM:
     To perform the multiplication of two 8 bit numbers using 8085.
    
ALGORITHM:
     1) Start the program by loading HL register pair with address of memory location.
     2) Move the data to a register (B register).
     3) Get the second data and load into Accumulator.
        Add the two register contents
     4) Check for carry.
        Increment the value of carry.
     5) Check whether repeated addition is over and store the value of product and carry
        in memory location.
     6) Terminate the program.

    
PROGRAM:
            MVI D,00         Initialize register D to 00
            MVI A,00         Initialize Accumulator content to 00
            LXI H,4150
            MOV B,M        Get the first number in B - reg
            INX H
            MOV C,M        Get the second number in C- reg.
LOOP:    ADD B            Add content of A - reg to register B.
            JNC NEXT       Jump on no carry to NEXT.
            INR D             Increment content of register D
NEXT:     DCR C           Decrement content of register C.
            JNZ LOOP      Jump on no zero to address
            STA 4152       Store the result in Memory
            MOV A, D
            STA 4153       Store the MSB of result in Memory
           HLT               Terminate the program.


OBSERVATION:
                  FF (4150)
    Input:
                  FF (4151)
                  01 (4152)
    Output:
                  FE (4153)
                 
RESULT:
Thus the program to multiply two 8-bit numbers was executed.
Read more...

LARGEST NUMBER IN AN ARRAY OF DATA


LARGEST NUMBER IN AN ARRAY OF DATA




AIM:
     To find the largest number in an array of data using 8085 instruction set.
     
ALGORITHM:
     1) Load the address of the first element of the array in HL pair
     2) Move the count to B – reg.
     3) Increment the pointer
     4) Get the first data in A – reg.
     5) Decrement the count.
     6) Increment the pointer
     7) Compare the content of memory addressed by HL pair with that of A - reg.
     8) If Carry = 0, go to step 10 or if Carry = 1 go to step 9
     9) Move the content of memory addressed by HL to A – reg.
     10) Decrement the count
     11) Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to next step.
     12) Store the largest data in memory.
     13) Terminate the program.
     
PROGRAM:
             LXI H,4200    Set pointer for array
             MOV B,M     Load the Count
             INX H           Set 1st element as largest data
             MOV A,M
             DCR B            Decrements the count
LOOP:     INX H
             CMP M           f A- reg > M go to AHEAD
             JNC AHEAD
             MOVA,M        Set the new value as largest
AHEAD:   DCR B
             JNZ LOOP     Repeat comparisons till count = 0
             STA 4300       Store the largest value at 4300
             HLT

OBSERVATION:
                   
    Input: 05 (4200) ----- Array Size
                   
    Output: 0A (4201)
                F1 (4202)
               1F (4203)
                26 (4204)
                FE (4205)
                FE (4300)
    
RESULT:
Thus the program to find the largest number in an array of data was executed


NOTE: AM SHARING THIS FOR EDUCATIONAL PURPOSE ONLY.
Read more...

ADDITION OF TWO 8 BIT NUMBERS


ADDITION OF TWO 8 BIT NUMBERS

AIM:
To perform addition of two 8 bit numbers using 8085.

ALGORITHM:
1) Start the program by loading the first data into Accumulator.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
4) Add the two register contents.
5) Check for carry.
6) Store the value of sum and carry in memory location.
7) Terminate the program.

PROGRAM:
MVI C, 00          'Initialize C register to 00
LDA 4150          'Load the value to Accumulator.
MOV B, A  'Move the content of Accumulator to B register.
LDA 4151          'Load the value to Accumulator.
ADD B  'Add the value of register B to A
JNC LOOP  'Jump on no carry.
INR C  'Increment value of register C
LOOP: STA 4152  'Store the value of Accumulator (SUM).
MOV A, C  'Move content of register C to Acc.
STA 4153          'Store the value of Accumulator (CARRY)
HLT          'Halt the program.

OBSERVATION:
Input: 80 (4150)
80 (4251)
Output: 00 (4152)
01 (4153)

RESULT:
Thus the program to add two 8-bit numbers was executed.


NOTE: AM SHARING THIS FOR EDUCATIONAL PURPOSE ONLY.
Read more...

SMALLEST NUMBER IN AN ARRAY OF DATA


SMALLEST NUMBER IN AN ARRAY OF DATA

AIM:
     To find the smallest number in an array of data using 8085 instruction set.
     
ALGORITHM:
     1) Load the address of the first element of the array in HL pair
     2) Move the count to B – reg.
     3) Increment the pointer
     4) Get the first data in A – reg.
     5) Decrement the count.
     6) Increment the pointer
     7) Compare the content of memory addressed by HL pair with that of A - reg.
     8) If carry = 1, go to step 10 or if Carry = 0 go to step 9
     9) Move the content of memory addressed by HL to A – reg.
     10) Decrement the count
     11) Check for Zero of the count. If ZF = 0, go to step 6, or if ZF = 1 go to next step.
     12) Store the smallest data in memory.
     13) Terminate the program.
     
PROGRAM:
             LXI H,4200        Set pointer for array
             MOV B,M         Load the Count
             INX  H              Set 1st element as largest data
             MOV A,M
             DCR B              Decremented the count
LOOP:       INX H
             CMP M             If A- reg < M go to AHEAD
             JC AHEAD
             MOV A,M        Set the new value as smallest
AHEAD:     DCR B
             JNZ LOOP        Repeat comparisons till count = 0
             STA 4300         Store the largest value at 4300
             HLT


OBSERVATION:
                   05 (4200) ----- Array Size
    Input:
                   0A (4201)
                   F1 (4202)
                   1F (4203)
                   06 (4204)
                   FE (4205)
                   0A (4300)
    Output:
                   06 (4300)
    
RESULT:
Thus the program to find the smallest number in an array of data was executed


NOTE: AM SHARING THIS FOR EDUCATIONAL PURPOSE ONLY.
Read more...

Thursday, 27 June 2013

Programmable interval Timer 8253

 Programmable interval Timer 8253

Function and working principle of 8253:

•The 8253/54 solves one of most common problem in any microcomputer system, the generation of accurate time delays under software control.
•Instead of setting up timing loops in system software, the programmer configures the 8253/54 to match his requirements, initializes one of the counters of the 8253/54 with the desired quantity, then upon command the 8253/54 will count out the delay and interrupt the CPU when it has completed its tasks.
•It is easy to see that the software overhead is minimum and that multiple delays can be easily be maintained by assignment of priority levels.
•The 8253/54 includes three identical 16 bit counters that can operate independently.
•To operate a counter, a 16-bit count is loaded in its register and, on command, it begins to decrement the count until it reaches 0.





Read more...

8251A programmable Communication Interface

8251A programmable Communication Interface


§8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.§ §Programmable peripheral designed for synchronous /asynchronous serial data communication, packaged in a 28-pin DIP.§ §Receives parallel data from the CPU & transmits serial data after conversion.§ §Also receives serial data from the outside & transmits parallel data to the CPU after conversion.






Read more...