Hi Skimask,
I try to answer with a minimum of translation losses....(Reminds me of principal Skinner, hehe)
1. Input is a 50% Duty cylce with 1/2 frequency of the magnetic/Hall pickup from the distributor because the Duty cycle varies sometimes with the frequency. So I took a 4027 to cut it in Half and got a nice constant 50/50 square signal. Makes 6Hz up to 300Hz. Thats my 1/2 frequency range. Threfore I have to multiply my VAR CNT by 2 to get the real freq, If I want to.Now I can handle this Input(my Variable CNT) mathematically like i want or need.
The easy thing is: we need this Input Variable only changed every 0.1 sec. thats fast enough.When the engine runs with constant speed for example for 1 minute we dont even need to change the Input variable because theres no difference.Thats the task of my first pic including sendig (by DEBUG)this Variable or the calculatet Delay (variable name and task is the same here) to PIC #2.
2. PIC #2 reacts when the RB0 pin shows a change fromlow to high. thats the same Input signal from our Distributor but the original frequency . The signal has to be changed into a square signal by a comparator or Schmitt-trigger.But here we need the precise starting point. After that a delay (Stored in the Var DELAY and calculated before depending on the input VAR CNT ) is startet ("ON Interrupt "or an asminterrupt handler needed here )
to get the right time for the Ignition action. This could be in the simplest way 10° befor OT at low speeds and 40° at high engine speeds (rotations per minute, Input signal fromthe distributor stored in VAR CNT). As you can see, even if you want a constant ignition action say 20° before OT the time of the delay after the delay starting signal (50° before OT = constant) the delay is reciprocal to the engine speed and reciprocal to VAR CNT.
3. Ignition action is a simple Output signal from the pin we choose (here PORTB.7) of 1ms high. This is send to the ignition coil driver wich switches 10Amps and 12Volts.The End of the 1ms is The Ignition timing point.
4.Due to PICs internal and software delays we need a correction factor for the VAR DELAY depending on Engine speed. Once we got this I´m happy. maybe in a list with just 10 points from low engine speeds to high speeds. Cranking is another thing because theres no constant cranking speed so the VAR DELAY has to be calculated for every cranking speed.
From 1000/min up we need only 10 different pre-ignition values, maybe 1000-1500,1500-2000 and so on. BUT: VAR DELAY would be different for a constant ignition timing for 1000/min or 1500/min.
If I can make anything more clear I will do so.
Transmission speed: The calculated VAR DELAY has to be sent from PIC1 to PIC2 (The ignition action PIC) .
BUT I put in a PIC#3 thats just for control purposes to check the VAR DELAY thats sent.
At the time theres no calculation OF The VAR DELAY and I´m sending just the "rough data VAR CNT". Calulation code is implemented after the transmission works.
Now: How will I send a WORD Variable fromPIC to PIC at Engine speeds of 8000/min? just 0.2 ms left. Or its done in the background with the famous USART registers which I try to use with DEBUG .......
Bookmarks