Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/04/03 02:02
Read: times


 
#57786 - RE: timer2 period code problems for rpm meas
Responding to: ???'s previous message
Micheal, I do use the overflow interrupt and have a routine to deal with it. I can see when the calcs are getting serviced with and without an overflow by my # of overflows' register. At this time if the overflow is greater than one, I display a message. I realize I will need to eventully use long integer but this should work for the higher frequencies.

calc_rpm()
{
// shift starting T2 bytes into an integer
capture1 = capt_high1;
capture1 = capture1 << 8;
capture1 = capture1 | capt_low1;

// shift ending T2 bytes into an integer
capture2 = capt_high2;
capture2 = capture2 << 8;
capture2 = capture2 | capt_low2;

switch(t2_overflow)
{
case 0x00:
period = capture2 - capture1;
break;

case 0x01:
capture1 = 65535 - capture1;
period = capture1 + capture2;
break;

case 0x02:
printf ("Period too large");
break;

default:
printf ("Period way too large");
break;

List of 13 messages in thread
TopicAuthorDate
timer2 period code problems for rpm meas            01/01/70 00:00      
   RE: timer2 period code problems for rpm meas            01/01/70 00:00      
      RE: timer2 period code problems for rpm meas            01/01/70 00:00      
   RE: timer2 period code problems for rpm meas            01/01/70 00:00      
      RE: timer2 period code problems for rpm meas            01/01/70 00:00      
         RE: timer2 period code problems for rpm meas            01/01/70 00:00      
      RE: timer2 period code problems for rpm meas            01/01/70 00:00      
         RE: timer2 period code problems for rpm meas            01/01/70 00:00      
            RE: timer2 period code problems for rpm meas            01/01/70 00:00      
               RE: timer2 period code problems for rpm meas            01/01/70 00:00      
               RE: timer2 period code problems for rpm meas            01/01/70 00:00      
                  RE: timer2 period code problems for rpm meas            01/01/70 00:00      
                     RE: timer2 period code problems for rpm meas            01/01/70 00:00      

Back to Subject List