Geoffrey Lansberry

PE generated Timer interrupt is running slow

Discussion created by Geoffrey Lansberry on Sep 22, 2010
Latest reply on Oct 5, 2010 by Processor Expert

I used PE to create a period timer on an MC9S08AC48, for some reason the timing of the pulses is off by a factor of 2-3   please see the attachment for a screen shot of how I configured the timer.  


I'm trying to use the timer TPM3 to help control communications  with a one-wire device.   There are four specific timed pulses that I need to bit bang - a 15uS pulse, a 67uS pulse, a 240uS pulse and a 480uS pulse.    I configured the bean to provide these options.  I have also attached an image of the setting for the four times, and the output of my bit-banging.


The way I've approached the bit banging is to write a zero to the one wire bus, then set the timer to interrupt after a certain amount of time and which then writes a one to end it. 


If you look at the attached bit bang, you can see that when I create a low going pulse, and then enable and set the timer for 67uS, as in the code below, the pulse I get is 160uS, not 67uS.   Can anyone offer some advice on how to remedy this problem?


void OW_WriteBit(bool sendbit){

                OW_TXBIT(0);  //every write is preceded with a 1-0-1 transition

                if(sendbit) OW_TXBIT(1);






void OW_TIMER_Int(void)



                (void) ONEWIRE_TMR_Disable();  //shut down the counter so it doesn't keep going and cause another interrupt

               OW_TXBIT(1);  //release the bus - let the device respond