Click here to Skip to main content
16,017,167 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to different data packets to serial port after specified amounts of time. I can send and receive a single string presently. For example let A, B, C be three strings. First I send A, then after time 'x' I send B, then after time 'y' I send C, after time 'z' I again send A..... and so on.

SetTimer function is triggered in regular intervals.how do i make it trigger at irregular intervals as in the case of my example??
Is CreateTimerQueueTimer function of use here.if so can you give an example on how to use it.


Any help will be welcome.
Posted

1 solution

Gautam Raiker wrote:
Is CreateTimerQueueTimer function of use here.if so can you give an example on how to use it.

This is just a regular (i.e. periodic) timer with delayed start-up.

I see three options:
  • if your intervals have a 'reasonable' common divisor then use it to set a regular timer.
  • In the WM_TIMER message handler kill the timer and then set it again with the proper,different period
  • Use many (not too many!) timers

Each method has its own drawbacks.
:)
 
Share this answer
 
Comments
Gautam Raiker 24-Jun-10 5:32am    
Thanks for your reply.
I feel the CreateTimerQueueTimer is just the function that i need.but is it ok if i use the third option as suggested by you,with 8 to 10 timers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900