Which operation a microcontroller can perform faster generally; to read a digital pin state or to take an ADC reading?
And how is the answer for my microcontroller Atmel SAM3X8E?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
As Lawrence NK1G correctly pointed out, ADC is virtually always slower than a digital pin read. ADC requires several samples over a period of time to determine an analog voltage. This always takes multiple clock cycles. Reading a digital pin requires only one sample and take as few as one or two clock cycles depending on the microcontroller. According to this page http://asf.atmel.com/docs/3.21.0/sam3s/html/adc_use_case_1.html , the maximum ADC sample rate for your microcontroller is 1MHz. Compare that to this page https://forum.arduino.cc/index.php?topic=252690.0 which says that it should be possible to read a digital pin at 21MHz on the Arduino Due which uses the Atmel SAM3X8E.