MS51
Dec. 17, 2019
Page
299
of 316
Rev 1.01
M
S51
SE
RIES
TE
CHNICA
L REF
ERE
N
CE MA
NU
A
L
PTRGTYP[1:0]
(ADCCON1[3:2])
[00]
[01]
[10]
[11]
00
01
10
PTRGSEL[1:0]
(ADCCON0[5:4])
PWM0_CH0
PWM0_CH2
PWM0_CH4
ADCDLY
External
Trigger
11
STADC
Figure 6.12-2 External Triggering ADC Circuit
6.12.3
ADC Conversion Result Comparator
The MS51 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) is set. When ADCMPO is set, it generates a
ADC compare event and asserts Fault Brake. Please also see Section 6.11.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.12-3 ADC Result Comparator
6.12.4 Internal Band-gap
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.