davidcyr2000:
The range of PWM signals is between 100 and 500 max. Does the sketch you referenced use input capture? I believe it uses regular interrupts, whereas the Nick Gammon sketches use input capture that is supposed to be more efficient. e.g. ICP1 on logical pin 83 on the atmega2560.
I think, one of the Nick Gammon's example is written for atmega2560, but another for atmega328 (UNO board). ICP1 -> PD4 is not routed on Mega board. >:(
Though it still would be possible to use input capture Timer4 or Timer5 (ICP4 & ICP5), pin 48 & 49.
I read on this forum someone pose same question and was able to successfully adapt Gammon's code to ICP4. Not sure, if it's measure duty cycle, may be only frequency.
500 Hz is quite low, you sure you can't do it with input change interrupt? 2 milliseconds period, and if arduino spend ~2 usec to jump into ISR the worst case scenario you 'd have 0.1% error, it's not much, isn't it ?