4 Preventing False Spike Detection
This example demonstrates the hysteresis feature of the AC peripheral that helps in avoiding frequent toggling of the AC when the positive input oscillates very close to the negative input level. This application is similar to the voltage level detector application, but additionally it has the Hysteresis mode enabled.
Configure the hysteresis by writing to the Hysteresis Mode Select (HYSMODE[1:0]) bit
field in the Control A register:A medium hysteresis is used (25 mV), which translates in the following sequence of
code:
AC0.CTRLA |= AC_HYSMODE_25mV_gc;
Tip: The full code example is also
available in the Appendix section.
An MCC generated code example for AVR128DA48 with the same functionality as the one described in this section can be found here: