CDI tester project

OK, I think I have it. I'll express things in degrees, and the event timing will be changed by RPM.

First, you will need a switch to set the AC trigger mode. This will be similar to the RISE/FALL switch and the CHARGEPULSE mode switch. Do you have this switch installed already?

Personally , I decided that ONE pulse last 10degree

In the AC Trigger mode you want the + and - pulses each to be 10 degrees long, separated by 60 degrees. We can make those values adjustable by a pot, but these sound like default starting values. I think you already have a pot 3 for bar width.

Other times the bar can be 60° long and the negative pulse is >at the beginning and then the positive is at the end of bar

You have also described and drawn the pulse train as starting with a positive 12 volts. i.e. +12v for 10 degrees, 0v for bar width(60) degrees, -12v for 10 degrees, 0v for remainder of the timing cycle.

What pulse do you want to lead with?

You will need to determine where you want the return pulse delay measurement to start. At present the RISE/FALL switch controls whether delay timing starts with the rise of the trigger or the fall of the trigger. With the AC trigger and the bar width, you will need to establish the the start of timing for the return.

I'm pretty sure you have a scope to measure output pulses. I think I will try to write a simple piece of test code at 1200 rpm (50 ms cycle timing). 50/360 = .139 milliseconds/degree or 140 microseconds/degree to use a nice round number. Let me know if you want to lead with 00 (-12v) or 11(+12v) and I will try to write some code which outputs the pulse train.

Do you have arduino pin numbers you want me to use for D1 and D2?