SanDiegoMark posted:gunrunnerjohn posted:
The sensor clearly has to be using something like the uP counter input function, you could never individually capture all the pulses otherwise. If the motor is spinning at 8,000 RPM (some do, I checked), and you have 24 stripes, you'd have 3200 stripes/second to sense, or one about every 300 microseconds. You might be able to service interrupts at that pace, but it would be consuming a significant part of the bandwidth.
I figure that for a typical diesel, there would be 119,000 pulses per Smile. At 120 Smph, that would be 238,000 pulses per minute or 3966 pulses per second - one every 252 microseconds or so. On a lower geared steam engine the pulse rate would be even higher.
So, as you noted, its likely this is a hardware counter. But the DOD and DTO raw values are read out by reading 4 bytes of RAM each. If these are hardware counters, they could be memory mapped. I don't know what is available in whatever uP is used.
In my little C-G, I just let the tach counts accumulate in a 16 bit timer. In the mainline loop I compare that count to my calibration constant. When it equals (or exceeds) my calibration constant, I trigger a chuff and zero the hardware timer for the next cycle. Although my cycle time for the simple functions of the C-G probably never missed a count, if I did miss one, it wouldn't really make any difference in the greater scheme of things, so that wasn't a major issue.