I would like to build a project who can change the avance ,degrees timing, in an single one piston engine without injector,only the avance i must change.
I programming in assembly all my projects,i try some times in c with not good results.
Now my thoughts about how to do this:
First I will calculate the rpm of flyweel with the crank sensor who allready the bike have,this is simple.
Lets say for now that the crank sensor is at 0 degrees
And the rpm is 8000/min
Each complete cycle of flyweel is 360 degrees.
That mean that in one min the sum of degrees is 360*8000=2880000
so if i want to give a spark at 20 degrees the calculation is 20*60sec/2880000 who is 0.0041sec =>4.1ms
So after the crank signal I have to wait 4.1ms and then give spark.
Is this thought ok?Or I missing something?
Now for all maths it is very helpful to use c language but only for maths do you suggest me to begin learn winavr or avr gcc or to try with assembly maybe with different way of mathematics?
I have never done mathematics with so large numbers in assembly.