Hall effect sensors

Hi Rob
I have tried your code but I am still getting fluctuating output and way higher than reality. Monitor readings below.
Still thinking it could be the reed switch although using another electronic tacho using the reed switch it does not pose any problems, it gives steady accurate output.

Here is the output RPM should be no higher than 5000RPM

9689124, 123
129136, 18585
141108, 25512
161740, 3122
164620, 10357
162808, 17843
148456, 27651
164244, 6149
166992, 13234
190560, 17894
655320, 480
21667648, 69
130712, 20771
105464, 37122
116100, 7064
125380, 16112
98640, 32645
127852, 978
108672, 12194
141212, 17882
156216, 23846
110932, 5680
106732, 17147
108108, 28029
123488, 34255
140520, 8078
136992, 17046
125316, 28210
138660, 3175
151680, 10813
140284, 20246
153780, 26272
120684, 7832
109128, 19658
123776, 27027
144488, 1732
167332, 8667
421416, 6289

Thanks Tim