Analog comparator Frequency Measurement

Put together the attached code and put it into a NANO and a UNO

The NANO shows triggering of ANALOG_COMP-vect with silly results that stay about the same irrespective of frequency iput. The UNO does not trigger

I have a signal generator with 5VP-P wave, set at 2.5VDC offset as will be seen on photo of generator and oscilloscope reading

Input is A1 and the mode is using the internal 1.1V reference

Can anyone tell me what I am doing wrong. It must be code, but I cannot find it

The photo shows the readings

Freq_Test_Rod_Rev1.ino (2.89 KB)

Please provide a wiring diagram.

I have a signal generator with 5VP-P wave, set at 2.5VDC offset as will be seen on photo of generator and oscilloscope reading

I haven't found that photo in your post.

If I understand your post correctly you apply the signal to A1 but in the software you configure D7(AIN1) as input (ADCSRB=0).

Thanks for the reply, but

27,2 of the manual says

"When ADCSRB.ACME=0 or ADCSCRA.ADEN=1 , AIN1 is applied to the negative input of the Analog Converter"

SOLVED

I put the inputs into A0 and A1 ( ADC0/ADC1) not AIN0-D6/AIN1-D7 :slight_smile:
Duh!

:slight_smile: :slight_smile: :slight_smile: