Question

Write a code to generate 20 terms in the sequence described by the recurrence relation an...

Write a code to generate 20 terms in the sequence described by

the recurrence relation

an = an-1 + n with the term a0 = 4

write the terms in memory starting at memory address 0100:0100H

then find the sum of these terms

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I m writing the code for 8051 microcontrollers, this is assembly language code.

org 000H

MOV A,#00H

MOV R0, #00H

MOV R1,#04H

MOV R2,#20H

BACK: ADD R0,R1

MOV A, R0

Dec A

INC R1

INC R0

LCALL SUM

MOV R5,R4 :this is the final sum

This is SUM subroutine:-

ORG 0100H

SUM: PUSH A

MOV R4,#00H

ADD R4,A

DJNZ R2,BACK

  

Add a comment
Know the answer?
Add Answer to:
Write a code to generate 20 terms in the sequence described by the recurrence relation an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT