EE 308
 
Homework #7 
 
Due Mar. 7, 2001
- What setup do you need to do to have the HC12 generate an interrupt
on the falling edge of Input Capture 2?  Write some C code
to do this.
- An engineer is using the HC12 to determine the speed of a motor in RPM.
A pulse is generated on Bit 1 of Port T
320 times every revolution of the motor.  Bit 1 of Port T is set up for input
capture mode, and captures the time of the rising edge.   The prescaler
bits PR2:0 are set to 010.  It is known that the time between pulses
is less than the timer overflow time.  When the first edge is
captured, the TC1 register has a value of 0xD87A.  When the second
rising edge is captured, the TC1 register has a value of 0x2A5F.
- What it the length of time between the two rising edges?
- How long does it take the motor to make one revolution?
- What is the motor speed in RPM?
 
- What setup do you need to do to have the HC12 toggle bit 3 of Port
T on a successful output compare?  Write some C code to do this.
- You want to generate a 250 Hz square wave using Output Compare 3.  What value should you add to TC3 in your  toc3_isr()?
(Assume that the prescaler bits PR2:0 = 101.)  What else should you do
in your toc3_isr()?  Write the interrupt service routine 
toc3_isr() to do this.
- Write the program for Part 7 of
 Lab 7.  
 
 
Bill Rison,
<rison@ee.nmt.edu >