void main(void) { unsigned int Ch_result; TRISA = 0xFF /* set all A ports as input */ ADCON1 = 0x00; /* Vrefs +/- are set to VDD/VSS and configure all pins as analog */ ADCON2 =0x92; /* right justified, 4Tad and Fosc/32. */ ADRESH=0; ADRESL=0; while(1) { ADCON0=0b00000001; // Select Channel 0, Go=0, ADON =1 ADCON0bits.GO=1; // providing Start of Conversion Signal =1 while (ADCON0bits.GO ==1 ); // Wait for end of conversion Ch_result = ADRES; // store 10 bit result ADRESH-ADRESL // register in variable Ch_result } }
Thanks for the video! But how can we modify the code so that the program reads the inputs of 4 sensors and displays its digital one-to-one representation Thank you
I don't know about this chip, but on similar chips the ADC is multiplexed, meaning all the channels use the one ADC. But, Tight Man, maybe you know something I don't.
Thank you so much. It helped me to clear all doubt regarding ADC in PIC18f Uc
void main(void)
{
unsigned int Ch_result;
TRISA = 0xFF /* set all A ports as input */
ADCON1 = 0x00; /* Vrefs +/- are set to VDD/VSS and configure all pins as analog */
ADCON2 =0x92; /* right justified, 4Tad and Fosc/32. */
ADRESH=0;
ADRESL=0;
while(1)
{
ADCON0=0b00000001; // Select Channel 0, Go=0, ADON =1
ADCON0bits.GO=1; // providing Start of Conversion Signal =1
while (ADCON0bits.GO ==1 ); // Wait for end of conversion
Ch_result = ADRES; // store 10 bit result ADRESH-ADRESL
// register in variable Ch_result
}
}
Thanks for the video!
But how can we modify the code so that the program reads the inputs of 4 sensors and displays its digital
one-to-one representation Thank you
Thankyou very muchh :')))))))))))))))
Mam Make a video on interrupt pic microcontroller plz
How do we monitor the 13 channels ADC at once if we can connect the 13 channels at once
Use TDMA
I don't know about this chip, but on similar chips the ADC is multiplexed, meaning all the channels use the one ADC. But, Tight Man, maybe you know something I don't.
Thanks mam