Steve Church

MC9S08RG60 TPM use

Discussion created by Steve Church on Jun 4, 2011
Latest reply on Jun 17, 2011 by bigmac

I have an application which needs to do the following:

1. Register an event input (negative edge)

2. Start a timer on this event but loaded with full house as time as yet unknown.

3. Input a serial data string which holds the 'real' timer duration.

4. Load this 'real' timer data into the already running timer.

5. On timeout of this timer, output a 1mS pulse.

6. I also need to set  a 5mS timer running on this input event so I can determine if the serial data occurs within 5mS of the event.

 

Timer clock of 1MHz. All elapsed times well within the 16 bit count.

 

I have parts 1 to 5 running using the TPM in straight forward up count mode and testing for flags. However this does not appear to be the most efficient and also has inherent time delays. Using the TPM in edge-aligned PWM mode on channel 0 looks the way to go but all attempts at utilising this mode have failed so far. Also part 6 I expect can be done using channel 1, but I need to optimise the first parts first.

 

I've looked on the website for application notes but not a lot other than the data sheet. Has anyone any pointers?

 

Regards,

Steve

Outcomes