Solved

How would I go about using mulitple timer's efficiently?

Posted on 2007-11-23
6
199 Views
Last Modified: 2010-04-23
I am planning on using a Timer to "poll" an PCI card that controls two different axis of a machine. I need to have at LEAST one Timer constantly getting information from the PCI card to display any fault that the servos might run into. There are also times where I am going to need to have 2-3 more timers polling the PCI card for Inputs/Outputs that are currently on and other information that needs to be updated relatively quickly (I am shooting for <1 sec). Is there any good way to go about this? Or is have 3 or 4 timers (ticks at 1 sec) executing simultaneously not a problem?


Not sure if this matters, but I would assume it would have some effect: The program will be running on a new AMD 4000+ X2 Proc, XP pro, and 1 gig or memory.
0
Comment
Question by:Gssc1414
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 20339990
would be more efficient a single timer with the proper granularity. But you have to notice that in this approach, will attend event sequentially, so if one event lasts more than 1 second, by example, another event can keep unattended for a while.
separate timers allows you to attend event virtually simultaneously, but this will depend also if your PCI card will not get confused with this.
0
 
LVL 3

Author Comment

by:Gssc1414
ID: 20340113
Would it be possible to use multi-threading? Maybe put each timer on it's own thread? Or even just the critical ones on a separate thread than that of the program? I don't know much about multi-threading, so im not sure if this is feasible, and if it is, if it would really help me out that much or not.



Jaime,

Thanks for your quick response!
I will have to check into the PCI card and make sure this won't be a problem.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20340161
In fact you don't need to do multithreading explicity. Timers are multithreaded implicity.
Just create many timers and launch them. Each timer have it own Tick event that run in a separate thread.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 3

Author Comment

by:Gssc1414
ID: 20340179
Alright, good deal. One last one for ya! Can I explicitly set a priority to different timers?


P.S. I upped the point value because of your extremely fast and precise answers. I really appreciate the help!
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20340196
What do you want to do with a "priority timer" ?
Do some tasks sequentialy when timer collide? or do them in parallel with a differnent speed?

For first, I suggest a priority queue, for second use a regular thread an simulate a timer with an infinite loop with delay.

BTW, you have to check also if the API you are using to interface the PCI card will accept concurrency
0
 
LVL 3

Author Comment

by:Gssc1414
ID: 20347101
Very well. It looks like I am a little confused. I once again apologize for my lack of knowledge. I will take your advice and go with it.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question