Equivalent time sampling on microcontrolers
Equivalent Time Sampling (ETS) is a trick to measure high frequency signals when you can make an assumption about the signal that you are measuring. The assumption is that the signal you are sampling is a repetitive signal (i.e. a sine wave or other "time-constant" signal).

In order to do this in a homebrew fashion you need a means to accurately and repetitively trigger at some fixed location (your trigger point), delay for a variable amount of time and then start and ADC acquisition at fixed intervals.

Triggering can be done with a fast comparator and an accurate reference. If your accurate reference is a filtered or otherwise stable DAC output then you have a nifty (albeit simplistic) software-controlled trigger point. Feed the output of the comparator into a "start timer" capture input on your microcontroller. The idea is to have your microcontroller's timer start counting the instant the comparator fires. When the timer overflows, it starts an ADC capture and stops (until you tell it to watch for the event again).

If you are using a tight loop or interrupt routine (i.e. software) to detect when the timer expires in order to start your ADC capture you may experience some jitter as it will take a variable amount of time to detect that the timer is done. If you can, set the timer interrupt to start the ADC transfer automatically. This is possible on numerous microcontrollers.

If you haven't already guessed, you will be adjusting the timer's starting value in order to give you a variable "pause" before starting the sampling loop. In essence, you'll be "walking across" the repetitive waveform.

Now for the ADC. For simplicity, let's say you will be sampling as fast as you can at all times. (I'll talk about alternatives below.)  What this means is that as soon as the ADC finishes, you will tell it to start again.  Now some microcontrollers are better at this than others; if you can DMA your ADC results and automatically restart, this is your best option. Otherwise you will have ANOTHER source of jitter in your ETS: the delay between an ADC complete interrupt (or polling detecting the completion), storing the sample, and starting another capture.

There is your basic system. pseudocode:

volatile int adc_count;

/* assumes you can't use DMA to drive the ADC */
void adc_interrupt(void)
{
    store_value();

    if(--adc_count) {
        start_adc();
    }
}

do {
    int offset;
    offset = 0;               /* offset from trigger to first ADC sample */

    do {
        adc_count = 256;      /* arbitrary, how many samples per trigger */

        load_timer(offset);   /* set timer value */
        arm_timer();          /* timer will now start when the trigger occurs */
    } while(adc_count);

    offset += 10;             /* arbitrary, how much to "move over" each trigger */
} while(offset &lt; 100);        /* arbitrary, how many triggers to use for an ETS capture */


Pretty straightforward stuff, but as I mentioned, you need to design the code and select a microcontroller that allows you to have the lowest jitter possible. This means that you want a microcontroller that can be set up such that a timer interrupt can start and ADC capture and that an ADC complete event can DMA results (and restart the ADC). If your microcontroller can't do this then you will have some jitter in your sampling and the captured waveform may look a little "off" as the sample points won't be at evenly spaced intervals.

Now what if you don't want to sample as quickly as possible? You'd want the ADC interrupt to start a second timer that waits the amount of time you want to have between samples, and have that second timer's interrupt start the ADC again.  If you're doing this, you have to be aware that this is yet another source of jitter if you have to use an interrupt routine or polling (i.e. software) to detect and start the peripherals.

In a nutshell, that's ETS.