timolappalainen:
If I read it right, it does not work. On FreqCount() you have double sum; and int count; These are local and will be reset on every new call. Instead you can use
static double sum = 0;
static int count = 0;
Then those will be static inside function. Better would be make own class for measure.
The average may work, but it restarts over after 30 measure. Now if you have max RPM 4000 and you get 4 p/r, you will get 4000 * 4 / 60 = 266 Hz. So you will get 26 p/ (1/10)s, which is RadidDataPeriod. For 1000 RPM you get only 8 p This means that your data is bit late, since you average over 30.
As I mentioned it could be better to make 30 value ring buffer and calculate average over those by every measure. With clever logic you can skip error values and if RPM changes quickly from 800 to 2500, you can reset average ring.
Do not convert frequency to int
int int_frequency = (int)frequency;
SetN2kEngineParamRapid takes frequency as double in RPM. I think FreqMeasure give it as Hz, which you then need to multiply by 60 to get RPM.
double sum & int count should be global according to the original example. I placed it wrong.
The conversion to int of frequency I did because there is float used for frequency and since floating point rpm is not used in nmea2k for rpm I thought it is better to convert it to int to et the floating point away. Good if not necessary.
About the ring buffer (circular buffer), yes, I did research on that for a couple of days even on youtube but could not find a good example which I could adapt to this I need. I think as well this would be the best solution, I just don`t know how?!
about the rapid data period, I just didn`t think so far and copied this from one of your examples thinking this is a static value and can not be changed.
Now if you have max RPM 4000 and you get 4 p/r, you will get 4000 * 4 / 60 = 266 Hz.
The 266 Hz is "just" the frequency I need to output to get the result shown on the external gauge.
So for the NMEA2K sending the 1p/RPM is relevant as the engine delivers 1p per RPM. So this will be then about 16,67 Hz. how many readings of the frequency shall I now take per second, at 600RPM (expected minimum) 10 times as 600rpm are 10 Hz?
I have found now a ring buffer library which I understand and can use for this project.
This is an overview of the period times and the frequency:
RPM Frequency PeriodTime
600 10,00 Hz 100000 µs
1000 16,67 Hz 60000 µs
2000 33,33 Hz 30000 µs
3000 50,00 Hz 20000 µs
4000 66,67 Hz 15000 µs
5000 83,33 Hz 12000 µs
6000 100,00 Hz 10000 µs
I will start over again, i stopped counting how often now! 
THX for all your time Timo!