- Sat Jan 06, 2024 2:07 am
#66609
Sorry I have been absent from this forum for a while, but here is how I made my TFI decoder. I set the trigger to change, so you detect on rising and falling edge. To first detect you are at the signature tooth for sync you look at the falling edge. So if the current tooth is smaller than than the last gap and the falling edge time is less than the rising edge time, then you are at the signature tooth. This way you double confirm the signature tooth and you compare 31.5 to 45 degrees (142% larger) and 76.5 to 90 degrees (118 %). Then on the next trigger, if the current tooth is 1 (signature) I also measure from the rising edge of the 2nd tooth, so that way you have a 58.5 degree gap compared to the 31.5 degree tooth and I also compare 58.5 degree gap to the 45degree gap before. You only check for sync while cranking (not in sync) and if the current tooth is the signature tooth, not every trigger event. So you are generally looking at 4 events in 135 degrees, and the large gap is 58.5 degrees compared to 31.5 degree tooth which is 185.7% larger but I set a target of being at least 150% larger while running so it can accommodate for acceleration/deceleration in that 90 degree window. I have never used Github to share code but that would be easier than trying to copy and paste the code here, so I may have to look into setting that up so you can try it out.
Chris
Chris