Thanks Pedja089,

I tried it. I even went so far as to download a demo version of CCS and it doesn't work.

Alain,

OK what the code does is measure the time the input is low using TMR0 and based on that value uses a lookup table to get a delay. the problem is that creating a delay table that will work like I want is causing me to go crazy. The other thing is that I am limited to a narrow range of rpm. for example if I set the tmr0 prescale to 32:1 then I am limited to a rpm range of about 1300 to 4000. That fine.But While starting I need to measure the "dwell" or the time the input is low at 200 rpm. With that prescale tmr0 overflows. One solution I have come up with is set the Tmr0 prescale to 256:1 and at startup(200 rpm) upto 400 rpm measure the time the input is high. After 400 measure the time the input is low. Only problem with that is I can't seem to figure out how to do it. Any advice is greatly appreciated.