Forum Discussion
Altera_Forum
Honored Contributor
20 years agoApplication timer
Hi, I'm trying to write an application that polls at regular intervals my hardware via serial port. What I need is an event that calls a function at regular times without charge the CP...
Altera_Forum
Honored Contributor
20 years agoHi stepa,
> What I need is an event that calls a function at regular times I'm assuming you want to access the hardware directly? ... Without using the serial driver? If so, you can use the select() system call to wakeup periodically. E.g.:<div class='quotetop'>QUOTE </div> --- Quote Start --- while (1) { /* Wait for 100 ms */ tv.tv_sec = 0; tv.tv_usec = 100 * 1000; result = select (0, NULL, NULL, NULL, &tv); /* Sleep */ /* Do the periodic check */ }[/b] --- Quote End --- See the manpage for details on select() -- it's a pretty complete manpage :-) Regards, --Scott