Question: How to delay this code from 1 second delay to 0.5 second delay? org 0000h; ljmp main; org...

50.1K

Verified Solution

Question

Electrical Engineering

Question: How to delay this code from 1 second delay to 0.5second delay?

org 0000h;

ljmp main;

org 0050h;

main:

     mov dptr,#SMG_DUAN ;

    mov r0,#00h;

    mov r1,#0ah;

lin1:mov a,r0;

    movc a,@a+dptr; get first indexed data in romto accumolator a

    mov p1,a; move data in a to port 1

    lcall delay; subroutine call for thedelay

    inc r0; increase r0 by one to get to the nextindex

    djnz r1,lin1; repeat the above instructionstill we get all the data

    sjmp main;

delay:

mov r3,#0fh; move 0fh to regester 3

lin2: mov r4,#0ffh; mov 0ff to reginster 4

lin3: mov r5,#0ffh; move 0ff to register 5

djnz r5,$; decrease r5 till it equal to 0

djnz r4,lin3; decrease r4 till it equal to 0

djnz r3,lin2; decrease r3 till it equal to 0

ret

org 0200h

SMG_DUAN: ; rom memeory

   db 0c0h,0f9h,0a4h,0b0h,99h,92H,82h,0f8h;

   db 80h,90h,88h,7ch,39h,5eh,79h,71h;

   end

Answer & Explanation Solved by verified expert
4.3 Ratings (526 Votes)
In the delay block instead of moving 0FH to registers move half the value which is 08H and decrement these values to 0 so that the delay will become half of the earlier    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students