我看了一下16F1507的MCC生成的代码,有延时啊
adc_result_t ADC_GetConversion(adc_channel_t channel)
{
// select the A/D channel
ADCON0bits.CHS = channel;
// Turn on the ADC module
ADCON0bits.ADON = 1;
// Acquisition time delay
__delay_us(ACQ_US_DELAY);
// Start the conversion
ADCON0bits.GO_nDONE = 1;
// Wait for the conversion to finish
while (ADCON0bits.GO_nDONE)
{
}
// Conversion finished, return the result
return ((adc_result_t)((ADRESH << 8) + ADRESL));
} |