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

Is there anyone who knows how to do this? Here\'s how it works: To implement the

ID: 3551377 • Letter: I

Question

Is there anyone who knows how to do this? Here's how it works:


To implement the sleep timer interrupts, write a sleep timer ISR:


Write an ISR program named SleepTimerRoutine.asm using the following template.

;-----------------------------------

; SleepTimer ISR

;-----------------------------------

include "m8c.inc"

exportSleepTimerISR

SleepTimerISR:

      ; fill in your code here

reti


In the ISR, the content of PRT1DR is increased by 1 every time an interrupt has been received (use a variable bShadow to help keep the count). Note that when using the registers A or X in the ISR, be sure to push their contents into the stack at the beginning of the ISR and pop them out at the end.

Explanation / Answer

;-----------------------------------

; SleepTimer ISR

;-----------------------------------

include "m8c.inc"

exportSleepTimerISR

     area bss(RAM) // inform assembler that variables follow
     bShadow: blk 1 // count result variable
     area text(ROM,REL) // inform assembler that program code follows

SleepTimerISR:

       push A ;

       Push X;

      mov A, reg[PRT1DR] ; get content of port 1

      inc A; A=A+1

      mov reg[PRT1DR], A

      mov X,[bshadow+0]; get the bshadow variable

      inc X;

      mov [bshadow+0],X;

      pop X;

      pop A;

      reti


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