I need to read all 7 analog pins in the BBB every 5 milliseconds. I'm
doing so with the following C code:

...

     while(1){
             fread(&value_str, 6, 6, f0);
             value_int = strtol(value_str,NULL,0);
             printf("0 %li\n", value_int);
             fflush(stdout);

             usleep(5000);
             rewind(f0);
     }

Hoever, the cpu usage goes up really high (20%). Is there any way to
read the analog inputs differently so that it doesn't use as much CPU?

I would replace "printf("0 %li\n", value_int); fflush(stdout);" by saving the converted values into an array, and print the values only when the measurement ist finished.

Someone suggested "DMA" but I'm completely lost on that regard...

That would be for specialists

Christian

--
For more options, visit http://beagleboard.org/discuss
--- You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to