Now, onto the configuration of the ADC. There are only FOUR registers that you need to understand to configure the ADC. They are ADCON0, ADCON1, ADRESH and ADRESL. The two most important ones are ADCON0 and ADCON1. ADRESH and ADRESL are just the registers where the ADC stores the result of the conversion.
ADCON0
The user has to select the correct clock conversion. The period must be at least more than 1.6us to obtain an accurate conversion. For example, I’m using a 4MHz crystal oscillator on my PIC16F877A. So if I select Fosc/2, thats 2MHz and the period is just 500ns and it’s far less than the 1.6us required.
Aucun commentaire:
Enregistrer un commentaire