I'm trying to use the builtin atmel analog comparator to compare two signal levels. I know how to setup the ACSR register and configure the interrupt handler. Unfortunately there seems to be no way to read the output of the comparator (HIGH/LOW). You're only able to configure the triggering of the interrupt based on a level change at the comparator output.
The first signal is a pulsed: 8 us high at some unknown level / 492 us low at a known level (DC bias). The second signal is basically a sawtooth, so it ramps up from 0V to 5V. I'm only interested in the state of the comparator during that small 8 us timeframe. If I use the interrupt based handler, there's a big chance that the signal levels cross each other during the low part of the pulse when the measurement is not relevant.
I was thinking on only activating the interrupt handler during the 8 us timeframe but again there's no guarantee that the transition happens during that timeframe. If I would be able to simply read the state of the comparator at that moment my problem would be solved.
What happens if you enable the analog comparator, does it have a fixed initial state? If it will always generate and edge regardless of the initial state of the levels at the input then my issue is also solved.