I don't know if comparator is the proper term, but I need some direction here!
I need to measure a voltage on a ADC input and then set an output high when the input voltage goes higher than the original reading, no matter what the original reading was (not exceeding 5 volts or full scale of the ADC of course). sort of like an autogain of some type. I'd like to be able to adjust the gain (or level of difference) of the readings with another ADC input and pot. so:

if the original reading on AN0 was 2.33 volts
and then right after that the next reading on AN0 exceeds 2.33 volts by 1 volt (3.33)
High myOutput once, for one second.

so then if the next reading is 3.33 it does nothing, because there was no positive change

but, if the next reading is 4.33 then the output goes high again because there was a positive change.

and so on

the difference being 1 volt, which i would also like to have control of with another ADC..

the voltage on my ADC input is going to vary between 1 - 4 (thereabouts!) slowly, with only sudden bursts of a higher voltage for a short pulse (a few mS?) but i think my PIC (F684, 20 MHz) will be able to capture it.

I already know how to set up ADCs, and do my Defines and all of that, I just need some workable code here. Thanks in advance for any help!