-
January 17th, 2013, 08:14 AM
#1
Trouble with timer
Hi everybody !
The purpose is to manage serial communication with a pedal.
I wrote a class pedal that allows to search for the serial port on which the pedal is connected. Therefore I send a request to the pedal and set up a timer event of 20 ms. If no reply, I search for the next serial port.
When found I send configuration to the pedal and set another timer event of 200 ms that requests for pedal state.
It runs fine.
Now if the pedal is disconnected then connected again I would like it to run again.
Therefore I set another timer event every 2s that launches all what I described above.
The trouble comes because the 20 ms timer event doesn't run and I do not understand why.
Thanks.
-
January 17th, 2013, 11:41 AM
#2
Re: Trouble with timer
You'll probably get more/better help if you post the code of a minimally complete example that shows your problem.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
January 17th, 2013, 12:00 PM
#3
Re: Trouble with timer
Please see the code written on the thread with same title below
-
January 18th, 2013, 09:06 AM
#4
Re: Trouble with timer
If you are talking about WM_TIMER type timers.
1) The time you specify only guarantees that you will get a timer message NO SOONER THAN the interval you specify, there is no guarantee of actual interval precision.
2) The system does not actually generate timer messages, it merely sets a flag. Your application needs to process messages via the PeekMessage/GetMessage type functions to actually generate a WM_TIMER message (this is similar to how WM_PAINT's arrive in your application).
3) Even if you use the callback function variant of the timer, your application needs to be processing messages to receive the callbacks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|