boza Posted August 23, 2009 Report Share Posted August 23, 2009 Hello all, i am trying to find the best way of interrupting a timeout event case, in order to provide priority to other event cases within the same Event structure. The timeout runs at 1000msec and within it i perform some actions, that i would like to interrupt when another event is triggered in the same Event structure. Any suggestions? Best regards Quote Link to comment
MikaelH Posted August 23, 2009 Report Share Posted August 23, 2009 Interesting question! If you put code inside the TimeOut case, you are screwed. There are many different approaches here, but the easiest one I use is by using a state machine like this: If the TimeOutCounter is zero, I wait for 1000ms before going to the TimeOut case, else a 0 or 1 ms is wired to the TimeOut on the Event Structure, so it goes directly to the TimeOut case if no other events are in the queue. Event2.vi //Mikael 1 Quote Link to comment
PaulG. Posted August 24, 2009 Report Share Posted August 24, 2009 ... Any suggestions? User events. Quote Link to comment
Bobillier Posted August 24, 2009 Report Share Posted August 24, 2009 The timeout event is intrinsically not having priority. Every time one other event occur, the time out value is reload with the maximum value (for exempl 1000 in your case)and not fire. It's for this reason it's call TimeOut and not Timer (I think). It's easy simple to lock it definitively when one event occur by loading -1 inplace of 1000. Look my exempl to see how. Quote Link to comment
jcarmody Posted August 24, 2009 Report Share Posted August 24, 2009 i am trying to find the best way of interrupting a timeout event case, in order to provide priority to other event cases within the same Event structure. Is there a requirement that it run in the same Event Structure? Could you use a second loop with another one? The timeout runs at 1000msec and within it i perform some actions, that i would like to interrupt when another event is triggeredin the same Event structure. Do you need to prevent the actions in the Timeout event from completing or do you just want to stop them in order to handle the new event right away? A second event structure will let the Timeout code finish while the first one handles the new event. Another thought: the Caveats and Recommendations When Using Events in LabVIEW page says If you need to generate or handle other events while handling the current event, consider using the Register Event Callback function..Jim Quote Link to comment
boza Posted August 24, 2009 Author Report Share Posted August 24, 2009 Is there a requirement that it run in the same Event Structure? Could you use a second loop with another one? Do you need to prevent the actions in the Timeout event from completing or do you just want to stop them in order to handle the new event right away? Thanks for your replies. The thing is that all the event cases within the same event structures (including the timeout) handle RS232 interactions. That's why i used the timeout in the same structure. So lets say that an event is triggered while the timeout is running, then the event will have to wait some time for the timeout case code to finish in order to serve it. The possibility of using another loop with a timeout in it, must be carried out with some piece of synchronization i suppose. Do you think that this could be done using the synchronization functions? Best regards Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.