MS51
Nov. 28, 2019
Page
444
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
PTRGTYP[1:0]
(ADCCON1[3:2])
[00]
[01]
[10]
[11]
00
01
10
PTRGSEL[1:0]
(ADCCON0[5:4])
PWM0CH0
PWM0CH2
PWM0CH4
ADCDLY
External
Trigger
11
STADC
Figure 6.13-2 External Triggering ADC Circuit
ADC Conversion Result Comparator
6.13.2.3
The MS51 32K series ADC has a digital comparator, which compares the A/D conversion result with a
12-bit constant value given in ACMPH and ACMPL registers. The ADC comparator is enabled by
setting ADCMPEN (ADCCON2.5) and each compare will be done on every A/D conversion complete
moment. ADCMPO (ADCCON2.4) shows the compare result according to its output polarity setting bit
ADCMPOP (ADCCON2.6). The ADC comparing result can trigger a PWM Fault Brake output directly.
This function is enabled when ADFBEN (ADCCON2.7). When ADCMPO is set, it generates a ADC
compare event and asserts Fault Brake. Please also see Sector 18.1.5“Fault Brake”.
Note
: For the MS51 series, after enabling the result compare function, the ADCF register changes to 1
only when ADC comparing result matches the condition and then enters interrupt vector if ADC
interrupt is enabled. After this bit is enabled and ADC start is triggered, the ADC keeps converting.
The register ADCRH and ADCRL value will change based on the result of ADC setting and can also
be read out from the register. This process only stops after ADCF is set to 1.
ADCR[11:0]
ADCMP[11:0]
+
-
ADCMPO
(ADCCON2.4)
0
1
ADFBEN
(ADCCON2.7)
ADCMPOP
(ADCCON2.6)
ADCMPEN
(ADCCON2.5)
ADCF
ADC interrupt
Figure 6.13-3 ADC Result Comparator
Internal Band-gap
6.13.2.4
At room temperature, all MS51 band-gap voltage values will be calibrated within the range of 1.17V to
1.30V. If you want to get the actual band-gap value for MS51, read the 2 bytes value after the UID
address and the actually valid bit is 12. The first byte is the upper 8 bits, and the lower 4 bits of the
second byte are the lower 4 bits of the 12 bit.
Reading and calculation steps:
–
Read a bad-gap value with IAP by reading UID;
–
Merge the upper 8 bits and the lower 4 bits;
–
Use the following formula to convert to an actual voltage value.