One problem that you may be having is that usleep really isn't designed
for precise delays. It will return after at least the time you have
requested (though signals might make it return sooner), but if the
kernel has decided to schedule another task, it might return much later.
I expect that for you, it often returns very fast, and sometimes takes
much longer to return, but this is just a supposition.
In any case, because your code can get preempted by the kernel to let
other tasks run, you will probably suffer from a lot of jitter.
I don't know what you want to do exactly with this ADC so this is
probably no good for you. It seems to me that if you want to make your
code work fast and with little jitter, you should probably block
interrupts (not for too long or you might have strange things happen)
and do the delays by hand. One delay trich that often works is to read
from the parallel port. This takes approx 1 microsecond. So to delay
3us, read 3 times (though you already have some parallel port accesses
in your loop that count towards those 3 times).
Just remember, everything I said above is really hacky. If you want
clean portable code, you shouldn't do this; in fact you should use
proper hardware that has its own clock for setting the sampling rate,
and some buffering for when your program isn't running.
> hi all,
> I connected one ADC to the parallel port , and i am
> using parport for getting the data from the ADC
> I have written a program, which is working very
> Here i am appending my program........
> but my problem is there is some time delay for
> execution of instruction , which limits the sampling
> i can only sample at a rate of 300 samples per
> that means it is taking 3 ms for execution of less
> than 10 instructions........
> Is there any solution to this problem..... how can i
> increase my sampling rate ????
> i need this information urgently
> if anybody used parport for interfacing ADC, can u
> tell me how to get rid of the problem
> thanks in advance
> Best Regards
> Missed your favourite TV serial last night? Try the new, Yahoo! TV.
> visit http://in.tv.yahoo.com
-- To unsubscribe, send mail to: firstname.lastname@example.org --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Sun Dec 22 2002 - 04:02:51 EST