To initialize the OPAMP peripheral for basic, always-on operation, the following
steps are recommended:
- 1.Configure the timebase of the OPAMP
peripheral by writing to the Timebase (TIMEBASE) bit field in the Timebase
(OPAMP.TIMEBASE) register.
- 2.For each op amp that will be used:
- a.Configure the Op Amp n Input Multiplexer (OPAMP.OPnINMUX):
- Select the non-inverting (+)
input of the op amp by writing to the Multiplexer for Positive Input (MUXPOS) bit
field
- Select the inverting (-) input of
the op amp by writing to the Multiplexer for Negative Input (MUXNEG) bit
field
- b.Configure the Op Amp n Resistor Ladder Multiplexer (OPAMP.OPnRESMUX):
- Select the connection to the top
resistor in the resistor ladder by writing to the Multiplexer for Top (MUXTOP) bit
field
- Select the connection to the
bottom resistor in the resistor ladder by writing to the Multiplexer for Bottom
(MUXBOT) bit field
- Select the wiper position in the
resistor ladder by writing to the Multiplexer for Wiper (MUXWIP) bit field
- c.Configure the Op Amp n Control A (OPAMP.OPnCTRLA) register:
- Configure the op amp to be always
on by writing ‘
1
’ to the Always On (ALWAYSON) bit
- Disable events for the op amp by
writing ‘
0
’ to the Event Enable (EVENTEN) bit
- Select the normal output mode by
writing the NORMAL setting to the Output Mode (OUTMODE) bit field
- d.Optional: Configure the
allowed settling time by writing to the Settle Timer (SETTLE) bit field in the Op Amp
n Settle Timer (OPAMP.OPnSETTLE) register.
- 3.Enable the OPAMP peripheral by writing a
‘
1
’ to the OPAMP Enable (ENABLE) bit in the Control A (OPAMP.CTRLA)
register.
- 4.For each op amp whose settling time was
configured in step 2.4 above, wait for the SETTLED bit in the Op Amp n Status
(OPAMP.OPnSTATUS) register to become ‘
1
’. This indicates that the op amp
start-up and settling have completed, and the OPAMP peripheral is ready for use.