linux project

B

Thread Starter

Binoy Ketan Dash

Dear sir,
Whatever value I give to USLEEP in my program it exceeds by 10msec. And also I am not able to get time period less than 10msec. Is it due to timer interrupt? If it is due to timer interrupt then can you kindly let me know the procedure to change the timer value?
With regards,
-BINOY-

*********************************************
* Binoy Ketan Dash *
* KITS,Utkal University *
* Bhubaneswar-751024 *
* INDIA *
* Phone: 0674-570696 (R) *
*********************************************

 
P

Peter Wurmsdobler

Hi,

> 10msec.And also I am not able to get time period less than 10msec.<

The time resolution in Linux is determined usually by the HZ variable defined in /usr/src/linux/include/asm/param.h. Per default this is 100, i.e. 10ms time slice at which the scheduler is called and can wakeup timer tasks. If you need a finer resolution, you can either recompile the kernel with another HZ value (<1024 I think, and don't forget to issue "make mrproper" before), or, you can install a real time linux variant (RTLinux or RTAI). In latter cases you can then program either periodic kernel threads, or user space programms using a real time user/kernel interface, e.g. LXRT for RTAI. peter
--
Peter Wurmsdobler
Control.com Inc.
508-621-3611 fon
508-621-3614 fax _______________________________________________
LinuxPLC mailing list
[email protected] http://lists.linuxplc.org/mailman/listinfo/linuxplc

 
M

Mario de Sousa

I assume you are using Linux?

Linux by default has a 10 ms timer resolution, so you cannot get any delays smaller than 10 ms, even with usleep().

If you need very small delays, you could consider doing busy waits (empty cycles calibrated to produce the required delay).

You may also consider using the real-time clock that comes standard on every PC and alpha architecure. You can acces it through the rtc device driver. Have a look at http://www.linuxhq.com/kernel/v2.4/doc/rtc.txt.html
I don't know whether it has all the info you need. I just found it a minute ago by doing a google search on "rtc linux device driver"


Cheers,


Mario.

--
--------------------------------------------------------------------------
Mario J. R. de Sousa [email protected]
--------------------------------------------------------------------------

"Humanity is the earth's cancer" - Agent Smith - The Matrix _______________________________________________
LinuxPLC mailing list
[email protected] http://lists.linuxplc.org/mailman/listinfo/linuxplc

 
Top