AnalogRead

Guys, Anybody can give me a link or details about what does AnalogRead work exactly in low level programming.

what ports, tris , or oscillator . watchdog. such things ...

You have the source.
I'd start there.

It breaks down fairly simply into:
Select input
Start conversion
Wait for code conversion to complete.
Read result.

Read that in conjunction with the data sheet for the processor and it will answer all your questions.

The default Arduino setup (Uno and Mega) is to set an analog clock of 125kHz, and conversions take about 11 analog clocks,
so just under 100us per conversion. Interrupts aren't used by analogRead().

All the source code is there for you to look at - open source project :slight_smile:

From my recollection, it Is 13 cycles (about 104 us), except for the first, which takes 25 cycles.