Question: Assume the PIC24FJ64GA002 microcontroller in the following problems. Note that assembly instruction descriptions can be found in Microchips, 16-bit MCU and DSC Programmers Reference Manual

Assume the PIC24FJ64GA002 microcontroller in the following problems. Note that assembly instruction descriptions can be found in Microchips, 16-bit MCU and DSC Programmers Reference Manual

.

Assume the PIC24FJ64GA002 microcontroller in the following problems. Note that assembly instruction

Problem 3. The listing of an assembly subroutine MySum written for the PIC24FJ64GA002 which recursively computes the sum of the first n integers (1, 2, 3, . . . n) is shown below. At the time the subroutine is called (8) - 0x0010 and (w15) - 0x800 MySum mov.w8, [w15++] mov. W cpo. w bra dec.w rcall add.w bra LE, L3 mysum 2 mov.W 2 mov. W return The subroutine is invoked to compute the sum 1+2+3 as: #0x3, MySum w0 ; argument is passed in wO mov.W rcall Assume FosC is 32 MHz for an instruction cycle time, Tcy, of 62.5 ns (a) Register w15 is the stack pointer. How much stack is used (number of bytes) for a single call to subroutine MySum? What is put in each location of the stack? Explain. (b) The subroutine MySum computes the sum recursively. What is the total amount of data memory (bytes) used to compute the sum of 1+2+3? (c) How long does it take to compute the sum 1+2+3 with this subroutine? (d) Where is the result computed by the subroutine MySum located when it is returned? Problem 3. The listing of an assembly subroutine MySum written for the PIC24FJ64GA002 which recursively computes the sum of the first n integers (1, 2, 3, . . . n) is shown below. At the time the subroutine is called (8) - 0x0010 and (w15) - 0x800 MySum mov.w8, [w15++] mov. W cpo. w bra dec.w rcall add.w bra LE, L3 mysum 2 mov.W 2 mov. W return The subroutine is invoked to compute the sum 1+2+3 as: #0x3, MySum w0 ; argument is passed in wO mov.W rcall Assume FosC is 32 MHz for an instruction cycle time, Tcy, of 62.5 ns (a) Register w15 is the stack pointer. How much stack is used (number of bytes) for a single call to subroutine MySum? What is put in each location of the stack? Explain. (b) The subroutine MySum computes the sum recursively. What is the total amount of data memory (bytes) used to compute the sum of 1+2+3? (c) How long does it take to compute the sum 1+2+3 with this subroutine? (d) Where is the result computed by the subroutine MySum located when it is returned

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!