chipKIT® Development Platform

Inspired by Arduino™

Analogic read and interrupts

Created Tue, 18 Dec 2012 12:18:51 +0000 by PICedh


PICedh

Tue, 18 Dec 2012 12:18:51 +0000

Hello,

I have connected a sharp IR sensor whith my UNO and I use the "analogic read" function to compute the distance. In the Aduino doc, it is said that analogic read takes about 100 micro secs.

In addition, I use wheel encoder based on interrupt using the fucntion attachInterrupt. At normal speed (180tr/min) the encoder shoul trigger an interrupr every 10 micro secs so the analogic read should be interrupted several times during the processing.

Do you know if analogic read manage properly this case ? Maybe it is better to forbid interrupt during analogic read ?


GeneApperson

Thu, 20 Dec 2012 00:19:13 +0000

On a chipKIT board, analogRead probably takes more like 3-5 uSec to execute. There shouldn't be any problem that I can see with calling analogRead from inside of an ISR.

Gene Apperson Digilent


PICedh

Thu, 20 Dec 2012 20:56:23 +0000

thanks a lot


PICedh

Fri, 28 Dec 2012 15:39:08 +0000

Hello,

In the PIC documentation "Section 17. 10-bit Analog-to-Digital Converter (ADC)" of MICROCHIP, I see in "Example 17-1:Converting 1 Channel, Manual Sample Start, Manual Conversion Start Code" that they put a delay of 100 ms in order to get the data before the conversion

But in the analogic read lib in wiring_analoc.c, the delay is 2 ms only

Who is right, MICROCHIP doc or CHIPKIT lib ?