On Mon, 7 Dec 1998 Glynn Clements wrote: > > Roland Kletzing wrote: > > > I want to have a function in my program be called every full second. > > i mean, it should be called whenever the RTC of the PC rolls over > > one second. how do i do that ? > > if i use alarm or setitimer, this goes independently from the RTC, as > > as far as i understand ? > > Do I need to poll the rtc for recognizing the change of the SECOND field ? > > You would have to poll the RTC. All of the kernel's timekeeping > facilities are based upon the kernel's internal clock, as reading the > RTC chip is extremely slow. > > > another question: > > I want to communicate to a microcontroller via serial port, which shall > > aquire data (Power/Energy Measurement) > > What is the best strategy for communicating ? > > I mean, i have the problem to syncronize the microcontroller(which has no > > RTC) > > to the RTC of the PC. > > i.e. every second my program should get a value from the controller. > > But the problem for me is: if i trigger the microcontroller > > from my program under Linux, i think it is not guaranteed that the distance > > between the trigger signals will be equal, because we are in a multitasking > > environment. > > maybe the PC is busy and no trigger will arrive to the microcontroller and so > > the measurement will get wrong.... > > any suggestions ? > > If you really need exact timings: > > 1. You would have to use a real-time OS (e.g. QNX). QNX and Lynx are commercial industrial strength RTOSs, but we shouldn't forget about RT Linux. I don't currently use it. I subscribed to the RTL list some time ago, because I will be using it. RTL is packaged as a patch to the Linux kernel. It is quasi Linux kernel version independent. That is RTL versions can theoretically be applied to any Linux kernel version. In practice compatability varies between RTL and kernel versions . The RTL mail listing is great for advice and support. RTL seems to have a fairly complete set of RT features. Real time programs are implemented as modules. They execute in kernel space and have the highest priority on the system. Anything else you want can run as a regular linux process. There are facilities for RTL processes to communicate and collaborate with processes running in Linux user space. This is one of the most highly valued features of RTL for its flexibility and power. Applications can be "ROMable" and have been developed for many commercial and industrial products. > 2. The control program would have to be the only program running on > the system. See above. > > 3. You would have to be very careful about accessing any other > peripherals (e.g. hard disk), as an interrupts could preempt your program > at the critical moment. The RT facilaties provide capabilities for tuning the system (hardware/software) to a wide range of requirements. > > In general, any device which needs to perform time-synchronised > measurements should have its own timing hardware. Many and maybe all the RTL ones I have read about do. Regards, David -- David Ross [EMAIL PROTECTED] Toad Technologies "I'll be good! I will, I will !"
