Good $daytime, > Date: Mon, 07 Dec 1998 19:23:49 +0100 > From: Roland Kletzing <[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] > Subject: timer > 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 ? In general, you can't rely on timings when you're communicating via /dev/tty[CDEHLRSX]n or /dev/cu[abdehlrx]n because these devices make use of internal 16550 (or whatever) buffering. What CPU (MCU?) is used in your hardware? Most processors (at least those already having RS-232) are capable of timing as precise as their clock frequency. Clock programming on most chips is not that hard. This way you may be able to program your power meter to measure in realtime and send buffered results to PC via some sort of more high level protocol. I am using slightly modified SECS1 protocol in similar task (security & radio alarm system). This approach also allows monitoring software to be restarted without data loss. Regards, Willy. -- "No easy hope or lies | Vitaly "Willy the Pooh" Fedrushkov Shall bring us to our goal, | Information Technology Division But iron sacrifice | Chelyabinsk State University Of Body, Will and Soul." | mailto:[EMAIL PROTECTED] +7 3512 156770 R.Kipling | http://www.csu.ac.ru/~willy VVF1-RIPE