Steve Church

setting up o/p compare within input capture code

Discussion created by Steve Church on Aug 28, 2006
Latest reply on Aug 30, 2006 by bigmac
New to this board so hope someone can help
I wish to capture an input pulse (of time t1)on channel 0 and on the leading edge input capture interrupt routine set up channel 1 as an output compare to set PA3 low when a predetermined time (t2)has passed. I need the output compare on ch.1 to generate an interrupt so that I can write a new value (t1 + t2)into the compare registers so that it generates an interrupt when the new compare value is reached(so that I can cancel any further compare functions till the next i/p pulse). All I am trying to do is duplicate the i/p pulse on PA2, on PA3 after a delay of a few mS. It is possible that these pulses may overlap at times so I need the timer counter to be running without reset at least until the end of the i/p pulse.

I have tried various scenarious all of which seem sound but which fail to generate an interrupt after I set up the initial output compare from within the i/p capture interrupt routine. I have tried setting this up from within the main body of the code and this appears to work.I am just having problems doing it from with the ch0 i/p capture interrupt code.
Can someone give me some pointers on this as I am slowly going mad over this. Maybe there is a pulse delay routine somewhere. It cant be that difficult can it?
I am using the HC908KX8 and writing in assembler.