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

Microprocessor systems thanks for your time The following loop is used to implem

ID: 673498 • Letter: M

Question

Microprocessor systems

thanks for your time

The following loop is used to implement a tune delay routine. Assuming that the clock frequency of the microcontroller is 10MHz. specify the following. What is the value of the delay implemented by this simple loop. What is the value that register X should be initialized with, in order to implement a 20 milliseconds delay. Modify die original delay loop given, so that the loop takes 1 microsecond to execute. Assume that we want to implement the same 20 milliseconds delay using the free running counter. Write die program to implement this delay. Assume that we want to implement the 100 milliseconds delay using the Real Tune Interrupt (RTI). Write the program to implement this delay.

Explanation / Answer

; Delay = 0.02 seconds ; Clock frequency = 10 MHz ; Actual delay = 0.02 seconds = 50000 cycles ; Error = 0 % cblock d1 d2 endc ;49998 cycles movlw 0x0F movwf d1 movlw 0x28 movwf d2 Delay_0 decfsz d1, f goto $+2 decfsz d2, f goto Delay_0 ;2 cycles goto $+1