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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/05/03 07:58
Read: times


 
#57843 - RE: timer2 period code problems for rpm meas
Responding to: ???'s previous message

Firstly, for firing the ignition coils you really only need one PCA channel as with most engines the spark doesn't overlap therefore you use some port pins to select which coil you want to control and the PCA channel to control it - similarly with the injectors. This is how magnetti marelli does it with the ducati 916 injection using a 68hc11.

Back to your immediate problem - when reading multi byte values between interrupt code and normal code you have to disable the interrupts whilst the normal code reads them:

//mainline code...
uint rpm_diff,our_diff;

IE.7 = 0; //no ints
our_diff = rpm_diff; //get copy of difference
IE.7 = 1; //ints again
rpm = MAGIC_VALUE/our_diff;

//interrupt code
{
static uint t,prev_t;

t=timer2; //get current time
rpm_diff = t - prev_t; //calc elepased period
prev_t = t; //update previous
}

Make sure your assembler code reads the timer2 regs in the right order (same with the pca), reading the low latches the high reg or vice-versa so that the first read captures the timer value at that point 'cos the timer still is ticking whilst your instructions are executing.

Also for ignition timing, be sure to account for engine acceleration - calculate the difference between succesive input periods to get this. There is a lot to learn about the finer points of engine management!!



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