Hi again Leigh,
Sorry, my other project took me longer than expected. Now, back to yours.
Not to worry, this is very doable. But, it has to be done with a little assembly language and some interrupts. The main reason I took you in the "Capture" direction for the RPM in <a href ="http://www.picbasic.co.uk/forum/showthread.php?s=&threadid=366">the previous thread</a> was to keep the interrupts free for this phase of it, and also to keep the PIC from wasting time on Pulsin measuments that don't allow anything else to happen at the same time.
Essentially, you just need to take the signal that is currently going to the CCP (RC2) and also connect it to the INT pin (RB0).
Then we'll first set INTEDG to 1 so that it creates an interrupt on the rising edge. In the interrupt, we'll start TMR0 with a preloaded value that gives the required delay. This value may need to be adjusted from what your table gives in order to account for the interrupt delay, but should be easy enough. Then when TMR0 overflows, another interrupt is generated. This time it turns ON the output and sets INTEDG to 0 to catch the falling edge of the pulse. On the next interrupt it starts TMR0 again for the "Post Delay", and when the TMR0 overflows again, it turns the output off, sets INTEDG back to 1 in prep for the next pulse.
There are a few other things to account for, one being, not interferring with the RPM reading since an interrupt will occur exactly when you have to start the capture process, but this is also doable.
But, for now I'd like to see your table, so I can get a feel for the minumum and maximum delays. Since I know Squat about engines, I can't even guess at what they might be.
Of course, if you wanted to show the whole program, it would be helpfull too. Apparently, you've made some progress (changes) in other areas as well.
Best regards,
Darrel
Bookmarks