Frequency Display using external interrupt

I’ve been doing a program that display the frequency coming from a frequency generator. The setup is this; The frequency generator’s output is connected to the input of a sinewave-to-squarewave circuit. The output of the sinewave-to-squarewave circuit is connected to Port E0 of rcm2020 and oscilloscope. I am using Port E0 as my interrupt port. I am counting how many pulses my interrupt has encountered every second. The output is displayed in STDIO window. I want to have the exact number to be displayed as same as the displayed frequency from the oscilloscope.

My problem is the displayed output of my program is sometimes greater and sometimes lesser from what I am seeing in the oscilloscope. I can’t make it become stable. Is there any problem with my interrupt. I am sure that my timer interrupt is not the problem. I also used costate for counting the pulse but still won’t make it work properly.

Can anyone help me?

Thanks

What is the range of input frequencies? Describe the behaviour, is it tracking at lower frequencies and then getting off at higher, or are the differences more random? About how big are the differences you are seeing, give some examples of scope vs. Rabbit outputs. What is the peak to peak voltage of the square wave you are using as input to the Rabbit? Is this signal noisy?

Hi,

Thanks for the concern. I want to altleast display the frequency ranging from 2Hz to 40KHz. The difference I am reading from my display to the display of my oscilloscope is within the range of -4 to 20Hz. The difference is at random state. My signal from 2Hz to 40KHz is not noisy.

I hope you can give me a solution.

Thanks again and thanks in advance.

Doggie