Friday 21 September 2018

8085 instruction set description step by step with suitable examples

8085 instruction set with suitable examples

8085 micro processor is a 8-bit data bus, 8-bit control bus and 16-bit address bus along with 64k memory size.
An instruction is a binary pattern designed inside a microprocessor to perform a specific function.
The entire group of instructions that a microprocessor supports is called Instruction Set.
8085 has 246 instructions.
Each instruction is represented by an 8-bit binary value.
These 8-bits of binary value is called Op-Code or Instruction Byte.
 
a 8085 micro processor supports 5 instruction set:
which are:
1. Data transfer instruction set
2. Arithmetic instruction set
3. Logical instruction set
4. Branching instruction set
5. Control instruction set 
..............................................................
1. Data transfer instruction set:
 
These instructions move data between registers, or between memory and registers.
These instructions copy data from source to destination.
While copying, the contents of source are not modified.
 
2. Arithmetic instruction set :

These instructions perform the operations like:
Addition:

Any 8-bit number, or the contents of register, or the contents of memory location can be added to the contents of accumulator.
The result (sum) is stored in the accumulator.
No two other 8-bit registers can be added directly.
Example: The contents of register B cannot  be added directly to the contents of register C.

Subtract:

Any 8-bit number, or the contents of register, or the contents of memory location can be subtracted from the contents of accumulator.
The result is stored in the accumulator.
Subtraction is performed in 2’s complement form.
If the result is negative, it is stored in 2’s complement form.
No two other 8-bit registers can be subtracted directly.

Increment/Decrement:

 The 8-bit contents of a register or a memory location can be incremented or decremented by 1.
The 16-bit contents of a register pair can be incremented or decremented by 1.
Increment or decrement can be performed on any register or a memory location.

3. Logical instruction set:
These instructions perform logical operations on data stored in registers, memory and status flags.

The logical operations are:
AND
OR
XOR
Rotate
Compare
Complement
 
Any 8-bit data, or the contents of register, or memory location can logically have
AND operation
OR operation
XOR operation
    with the contents of accumulator.
The result is stored in accumulator.
 
 4. Branching instruction set

The branching instruction alter the normal sequential flow.

These instructions alter either unconditionally or conditionally.
 
 5. Control instruction set 

The control instructions control the operation of microprocessor.

Tuesday 9 May 2017

Program for generation of Rectangle wave form

Program for generation of Rectangle wave form

Following are the steps for generating rectangle wave form...

  1. Make accumulator as  00H
  2. Load accumulator to port 1
  3. now call delay subroutine 
  4. Make accumulator to FFH
  5. again load accumulator to port 1
  6. again call delay subroutine
And then repeat the steps again


Program :
               org 2050H
 back  :   clr a         ;
               mov p1,a ; 
               lcall delay;
               mov a, #FFh;
               mov p1, a ;
               lcall delay1 ;
               sjmp back ;
               end        
delay  :   mov r2, #200H ;
       l1:   nop       ;
              nop       ;
              nop       ;
              nop       ;
              nop       ;
              djnz    r2, l1  ;
delay1 : mov r1, #50H ;
       l2:   nop       ;
              nop       ;
              nop       ;
              nop       ;
              nop       ;
              djnz    r2, l2  ;

Program for generation of Square wave

Program for generation of Square wave..

Following are the steps involved in generating Square wave using keil software

  1.  Make ACCwith =00H
  2. Load ACC to port1 ( select any port in available)
  3. Call delay subroutine
  4. Make ACC with = FFH
  5. Load ACC to port1
  6. Call delay subroutine
  7. then repeat from first step again

Program:


                        org 2050H
       back:       cla a             ; acc loading with 00
                        move p1,a   ; moving 00 into port1
                        lcall delay   ; going to delay subroutine
                        move a.#FFh ; acc loading with FF
                        move p1,a    ; moving acc into port1
                         lcall delay   ; going to delay subroutine
                        sjmp back    ; repeating steps again
                        end              ;
         Delay:   move r1, #100h ;
                l1 :  nop            ; no operation
                       nop            ; no operation 
                       nop            ;no operation
                       nop            ;no operation
                       nop            ;no operation
                       djnz r1, l1 ; decreament  jump if not equal to zero
                       ret             ; returning


Friday 9 December 2016

Program for the sum of all the numbers stored in RAM locations

the BCD numbers are stored in RAM locations from 40h

  that are 40 = 71
              41 = 11
              42 = 65
              43 = 59
             44 = 37
Now program for addition of these numbers

                      MOV R0, #40H ; load painter
                      MOV R2, #5      ; load counter
                      CLR A               ; a=0
                      MOV R7, A      ; clear r7
AGAIN:         ADD A, @R0   ; add byte painter by r0
                      DA  A               ; adjust for bcd
                      JNC NXT         ; if c=0 dont accumlate carry
                      INC R7             ;
NXT :            INC R0             ;
                     DJNZ R2, AGAIN ; repeat all untill r2 zero

Wednesday 7 December 2016

A Program for keyboard Interfacing

Keyboard subroutine : this program sends the ASCII codes for pressed key

                MOV P2,#0FF ;
 K1  :       MOV P1, #0 ;
                MOV A, P2 ;
                ANL A, #00001111B ;
                CJNE A , #00001111B , K1 ;
  K2 :       ACALL DELAY                 ;
                MOV A, P2 ;
               ANL A, #00001111B ;
               CJNE A , #00001111B , OVER ;
               SJMP K2                                    ;
  OVER : ACALL DELAY                 ;
               MOV A, P2 ;
               ANL A, #00001111B ;
              CJNE A , #00001111B , OVER1 ;
               SJMP K2
 OVER1:MOV P1 , #11111110B ;
              MOV A, P2                               ;  
              ANL A, #00001111B ;
              CJNE A , #00001111B , ROW-0 ;
              MOV P1, #11111101B ;
              MOV A, P2 ;
              ANL A, #00001111B ;
              CJNE A , #00001111B , ROW-1 ;
              MOV P1, #11111011B ;
              MOV A, P2 ;
              ANL A, #00001111B ;
              CJNE A , #00001111B , ROW-2
              MOV P1, #11110111B ;
              MOV A, P2 ;
              ANL A, #00001111B ;
              CJNE A , #00001111B , ROW-3 ;
              LJMP K2                                       ;
ROW-0:MOV DPTR, #KCODE0 ;
              SJMP FIND  ;
ROW-1:MOV DPTR, #KCODE1 ;
              SJMP FIND  ;
ROW-2:MOV DPTR, #KCODE2 ;
              SJMP FIND  ;
ROW-3:MOV DPTR, #KCODE3 ;

FIND : RRC A ;
            JNC MATCH ;
            INC DPTR ;
            SJPM FIND ;

MATCH: CLR A ;
                MOVC A,@A+DPTR ;
                MOV P0,A ;
                LJMP K1 ;

DELAY : MOV R1, #20 ;
HERE  :   MOV R2 ,#250 ;
AGAIN : DJNZ R1, AGAIN ;
               DJNZ R2 , HERE

KCODE0 : DB           '0','1','2','3'             ; R0W 0
KCODE1 : DB           '4','5','6','7'              ; ROW1
KCODE2 : DB          '8','9,'A','B'              ; ROW2
KCODE3 : DB          'C','D','E','F'            ; ROW3
               
             END

Sunday 13 November 2016

Write a program to FIND THE FACTORIAL OF GIVEN NUMBER




ORG 0000            /* starting of the                              programe
                     MOV R1,#04      /* load r1 with 04
                     MOV R7,#01      /* load r7 with 01
                    LCALL FACT      /*longcalltothefact subroutine    
                    MOV R7,A        /* load R7 WITH 00

FACT: MOV A,R7        /* LOAD A WITH 01
                    CJNE R1,#00,UP   /*compare jump in not                           equal 
                    SJMP UP1        /* inttrupt(condition                           togo up1)
UP:   MOV B,R1       /* b= 00
                    MUL AB          /* result in A
                   DJNZ R1,UP      /* decrement jump if r1                          zero
UP1:  RET             / return
                         END

What are the needed applications to program for 8051 microcontroller

They are the some of prepared tools used for 8051 microcontroller programming and debuging.

1.Assembler
2.Code editor.
3.Simulator.
4.C compiler for 8051. 
5. Keil u Vision – 8051/ARM simulation
6.Proteus – Fully embedded simulation software