10.4.2 Sample Sequencer Configuration
Configuration of the sample sequencers is slightly more complex than the module initialization because each sample sequencer is completely programmable.
The configuration for each sample sequencer should be as follows:
- Ensure that the sample sequencer is disabled by clearing the corresponding ASENn bit in the ADCACTSS register. Programming of the sample sequencers is allowed without having them enabled. Disabling the sequencer during programming prevents erroneous execution if a trigger event were to occur during the configuration process.
- Configure the trigger event for the sample sequencer in the ADCEMUX register.
- When using a PWM generator as the trigger source, use the ADC Trigger Source Select (ADCTSSEL) register to specify in which PWM module the generator is located. The default register reset selects PWM module 0 for all generators.
- For each sample in the sample sequence, configure the corresponding input source in the ADCSSMUXn and ADCSSEMUXn registers.
- For each sample in the sample sequence, configure the sample control bits in the corresponding nibble in the ADCSSCTLn register. When programming the last nibble, ensure that the END bit is set. Failure to set the END bit causes unpredictable behavior.
- If interrupts are to be used, set the corresponding MASK bit in the ADCIM register.
- Enable the sample sequencer logic by setting the corresponding ASENn bit in the ADCACTSS register.