ML610Q174 User’s ManualChapter 28 Analog ComparatorFEUL610Q174-01 28-728.3 Description of Operation28.3.1 Analog Comparator FunctionThe comparator can compare the voltages at CMPnP pin to the voltage at CMPnM pin, the output is shown in theCMPnD bit of comparator control register 0 (CMPnCON0).The comparator is activated by setting the CMPnEN bit of the CMPnCON0 register to “1”, also is deactivated bysetting the CMPnEN bit to “0” and the current consumption in the comparator circuit becomes zero.The CMPnD bits of CMPnCON0 indicates the status of comparator output (CMPnOUT shown in the Figure 28-1).The CMPnD bit is set to “1” when the voltage at CMPnP pin is larger than the volatage at CMPnM pin (CMPnP >CMPnM), is set to “0” when the voltage at CMPnP pin is smaller than the volatage at CMPnM pin (CMPnP <CMPnM). The last status of the CMPnD bit remains after the comparator is deactivated.The comparator needs time to be stable. Please read CMPnD bit 100μs after setting CMPnEN bit to “1”.Figure 28-2 shows an example of the operation timing diagram. n=0,1Figure 28-2 Analog Comparator Operation Timing ChartThe operations in Figure 28-2 are described below.1 Select one of interrupt mode by setting CMPnE0 bit and CMPnE1 bit of CMPnCON1 register.2 Set CMPnEN bit of CMPnCON0 register to activate the comparator.3 Wait for 100μs or longer to make the comparator stable.4 Read CMPnD bit of CMPnCON0 register.5 Reset the CMPnEN bit to “0” to deactivate the comparator. The last status of CMPnD bit remains until thecomparator becomes activate again.6 Read the CMPnD bit.2Set CMPnEN4Comparator stability time(Wait for 100μs or longer)CMPnENCMPnPCMPnDRead CMPnD bit Reset CMPnEN53CMPnMThe status of CMPnD remains.16