Forest Shick

Output Compare on the MC9S08AC16

Discussion created by Forest Shick on May 30, 2011
Latest reply on Jun 13, 2011 by Lou Calkins

I am attempting to create a pulse using the output compare function on the MC9S08AC16.

I measure an incoming pulse for example - 3 msec and I would like to set the out going pulse to be longer - say 5 msec.  The outgoing pulse has to begin on the rising edge of the incoming pulse.

 

I am using TPM3CH0 to measure the incoming pulse - this appears to work correctly.

I am using TPM1CH0 to create the outgoing pulse - does not work

 

On the rising edge of the incoming pulse I set  PTE2 (TPM1CH0).

On the falling edge of the incoming pulse, I set the compare value and enable clear on compare function and enable the compare interrupt.

 

TPM1C0V = TPM1CNT + delta

delta is the 2 msec that would be added to the 3 to give 5msec

 

The output compare does not happen at any predictable time

 

Any suggestions?

 

Thank You

Outcomes