Quantcast
Channel: Processors
Viewing all articles
Browse latest Browse all 149055

Forum Post: How to read am335x adc value 1000 times in 1 seconds?(let me know the s/w example )

$
0
0

Hi, im making a program which can read adc value 1000 times in 1 seconds.

actually, i read http://processors.wiki.ti.com/index.php/AM335x_ADC_Driver%27s_Guide.

after i read, i decide to use "one shot mode"

but it has big problem

when i made a program, it can read adc value every 1.2msec.

my source is following sentences.

int fd;

int ret;

char data[10];

while(1)

{

   usleep(500);

    fd=open("/sys/bus/iio/devices/iio:device0/in_voltage5_raw", O_RDONLY);

    ret=read(fd, date, sizeof(data));

    usleep(500);

    close(fd);

}

 

whenever i read adc value, i use open and close funtion.

open function spends a few time. because of that, i cannot keep the period.

i want to know another method of reading adc value in every 1msec.

actually, i tried to use continuous mode. but i cannot distinguish "chanel 5" and "exact value" like the value in one shot mode.

so i need to know exact way to read adc value.

or is it impossible to read adc value in kernel?

please help me

 


Viewing all articles
Browse latest Browse all 149055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>