[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: usleep() timing problem



Latha wrote:
> Hi all,
> 
>   I am interfacing ADC to the parallel port of the
> Axis Developer board, and i am using parport device
> driver.
> 
> I have written a program, and it is working fine. I
> used "usleep()" to get required time delay..........
> but instead of getting time delay interms of
> microseconds... i am getting indefinite
> (unpredictable) approximately 3 ms.
> 
> this limits my sampling rate of ADC....... is there
> any other method is available to get the accurate time
> delay (atleast in milli seconds range)  ?????????
> 
> thanks in advance
> 
> Regards
> Ranganadh

Ranganadh,
  What is the fastest sampling rate you need to support? How fast is the ADC?
You may be able to get away with 'udelay()', which is a busy wait loop that 
won't switch out your task, but prevents other OS tasks from running.
  Or, you may need to use a timer interrupt handler to service your ADC reads 
- there was just a thread about fast response, interrupts, and RTAI - search 
the archive for "Fast responce (Interrupts)" 
http://mhonarc.axis.se/dev-etrax/msg02621.html
  Also, I noticed that the 2.4.19 kernel has a "fast" timer module 
(kernel/fasttimer.c) that has an API for this sort of thing - look for 
'schedule_usleep()' - maybe it will give you faster response than usleep()? 
maybe worth a try.

Regards,
  Dave