A must timer1 be setup as a timer or as a counter

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: h button. a) Must TIMER1 be setup as a Timer or as a Counter? Explain your answer! b) Write the code that sets up TIMER1 as a timer or counter following your answer under (a) and causes an interrupt to be generated every 30 pushes. c) Given the initialization under (b) write the Interrupt Service Routine (ISR) that that toggles the red LED every 30 pushes of the push button and toggles the green LED every 60 pushes (= 2*30 pushes) of the push button. HINT: Take a good look at what happens to the least significant two bits of PORTC. Problem 6. Suppose TIMER 1 is used to “tag” data coming in on another port with a 2-byte (TMR1H and TMR1L) time value. Show what we must do to make sure that the correct time is read from the TIMER 1 registers (TMR1H and TMR1L) and stored in TAGH (memory location 0x21) and TAGL (memory location 0x20), respectively. Provide the assembly code for this time tag subroutine necessary to achieve this? 2...
View Full Document

This document was uploaded on 01/22/2014.

Ask a homework question - tutors are online