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?