Tuesday 9 May 2017

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


No comments:

Post a Comment