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). 2. The control program would have to be the only program running on the system. 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. In general, any device which needs to perform time-synchronised measurements should have its own timing hardware. -- Glynn Clements <[EMAIL PROTECTED]>