What is the number of instruction cycles required to perform

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.

Solution

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.

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 CA

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site