Quote Originally Posted by Mugelpower View Post
Hi Skimask,
1. ..........Now I can handle this Input(my Variable CNT) mathematically like i want or need.
Multiplying by two is the same as a LEFT SHIFT, which only takes a single clock cycle on a byte, about 3-4 cycles on a word

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.
Learn how to use the hardware timers and you won't have a problem with the PICs internal software delays. Let the timers run on their own and interrupt the main program to trigger whatever you need triggered.

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 .......
DEBUG doesn't use the internal USART, it too is a software bit-banged command.
8000 RPM = 133.3 RPS...
A word = 16 bits, 2 bytes = 8 bits x 2 + start/stop bits = 20 bits for each word.
134 (133.3 rounded up) x 20 bits = 2,680 baud, use 9600 baud so it's a standard baud rate.
Each word takes 2.083 ms, 134 times per second, 278ms used by the serial port per second at maximum RPM, leaves you with 722 ms to play with total in between words, 5.38ms on average between each word sent.
But, cut each of those numbers by 1/4 for an 8 cyl engine, still leaves you with 1.34ms between each ignition event.

Completely software driven is NOT the way to go with this. You NEED to learn how to use the hardware timers/interrupts, etc. to get this done with blowing holes in pistons.