From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9201003129b5431b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-04 13:03:55 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!chcgil2-snh1.gtei.net!news.gtei.net!wn1feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3B9533B8.6EC1E11B@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: need ada timer routine References: <9n2rbg$4qj$1@zeus.orl.lmco.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 04 Sep 2001 20:03:55 GMT NNTP-Posting-Host: 12.86.32.57 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 999633835 12.86.32.57 (Tue, 04 Sep 2001 20:03:55 GMT) NNTP-Posting-Date: Tue, 04 Sep 2001 20:03:55 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:12718 Date: 2001-09-04T20:03:55+00:00 List-Id: Is your C routine a background process? If not you are likely to encounter a gradual loop skew as the timer must wait for the called function to complete. If you want to reliably send data every 50 milliseconds you want to use a task with a "delay until" statement in a loop. The following example comes right out of the Ada Language Reference Manual. In your case the identifier "Period" would be defined as: Period : constant Duration := 0.050; declare use Ada.Calendar; Next_Time : Time := Clock + Period; -- Period is a global constant of type Duration begin loop -- repeated every Period seconds delay until Next_Time; ... -- perform some actions Next_Time := Next_Time + Period; end loop; end; Jim Rogers Colorado Springs, Colorado USA mop wrote: > > i need a routine to pass serial data at a 20 hertz rate > > For my Visual C I did "m_timer = SetTimer(1, 50, NULL);" This now calls a > built in API OnTimer(UINT nIDEvent) every 50 millisec. Need something like > this in Ada.