> long time no talk. this is for vw bug no advance, no injector, no retard > no thing > just basic fire. in stead of point uses hall effect. not instead of > direct > firing like i am showing in attachment coil "on time" needs to be changed > like PWM duty cycle change but the frequency of pwm should be same as > input and input start should be synchronized > like the picture shows. I think using external timer as clock source and > software pwm should solve the problem unless I am wrong. If it just needs the coil to fire when the hall effect changes state then you need to anticipate when to start energizing the coil ahead of time. I assume the hall effect sensor duty cycle stays pretty much the same throughout the RPM range. Let's say the coil must fire on the pos->neg transition of the hall effect. So pos->neg turns off the output transistor(or IGBT, whatever) and the coil fires. The transistor is turned on by either the delay expiring or by neg->pos transition(failsafe mode). neg->pos. Turn transistor on if off. Clear "x". Start counting "x". pos->neg. Turn transistor off. Stop counting "x". Use "x" as seed for "y". "y" = "x" * delay multiplier. Start decrementing "y". if "y" == 0, turn on transistor. Loop forever. You can either use processor cycles and poll all the time or load a timer to share for x and y, or use the CCP peripheral if you anticipate adding more tasks later and want to be semi-automatic. This may not be the ideal way to drive a coil, you might just need a fixed "off" time. That would make this even easier. Cheers, Bob -- http://www.fastmail.fm - Accessible with your email software or over the web -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist