Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is the number of instruction cycles required to perform the following code,

ID: 3796578 • Letter: W

Question

What is the number of instruction cycles required to perform the following code, which starts at the label START?

  

FLOOP    ADDWF    VAR1,0

BTFSC    STATUS,DC

BRA     JPNT

CALL     FLOOP

JPNT     RETURN

START    MOVLW    0x1

MOVWF    VAR1

MOVLW    0x5

CALL     FLOOP

What is the maximum number of loops which can be attained by modifying the

“MOVLW 0x5” instruction while still having a working program (show your work)? What is the limiting factor?

How many seconds would the above code take, after being set to the maximum length you found in the second part? Assume that the clock speed on the board is 40 MHz.

Explanation / Answer

Question 3:

It will take 25 instruction cycles to execute.

Since MOVLW can hold 8-bit value so the maximum value which can be stored in MOVELW is 28-1=255.

So the loop can run maximum of 255 times.

If the loop is running for 255 times then number of instruction cycles only for loop = 256*4 =1024+4=1028

and Execution time = 1024/40*10^6 = 25 micro seconds.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote