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

Frequency is 4 MHZ. b. From the start of one of the CALL instructions to the end

ID: 2083695 • Letter: F

Question

Frequency is 4 MHZ.

b. From the start of one of the CALL instructions to the end of the subsequent RETURNinstructino, how many cycles are taken?

c. Sketch the waveforms you would see if oscilloscope probes are attached to the pinsassociated with PORTB<0> and PORTB<1>. Indicate both the vertical and horizontal scale,

Constants Bit Pattern EQU H'20 Loopctr EQU H 21 23 MaxCount EQU Main program loop Main Loop CLRF Bit Pattern CALL Output BSF Bit Pattern, 1 CALL output Bit Pattern CALL Output BSF Bit Pattern, 1 CALL output COTO Main Loop Output MovF Bit Pattern, W MOVWF PORTB MOVLW MaxCount MOVWF LoopCtr NOP Loop DECFSZ Loopctr GOTO Loop NOP RETURN

Explanation / Answer

For a CPU running at a constant clock rate:
clock rate = 1 / clock cycle time
• Every machine or assembly instruction takes one or more clock
cycles to complete.
• The total time an assembly program requires to run is given by:
Execution time = Total number of cycles X Clock cycle time
= Instruction count X cycles per instruction X clock cycle time
= Instruction count X cycles per instruction / clock rate
Example:
For a CPU running at 8MHZ is executing a program with a total of 100
000 instructions. Assuming that each instruction takes 10 clock cycles
to complete:
Execution time = 100 000 X 10 / 8 000 000 = 0.125 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