Eugen Graf Posted April 19, 2007 Report Share Posted April 19, 2007 Hello, I love the synchronisation palette of LV and multitasking functionality of them. My actually application architecture for communicating with devices over any interface is following: My application contains e.g. 5 tasks: 1. main task - is a state machine with ca. 10 steps. 2. read & parse task 3. log data to hard drive task 4. show data to user task 5. write data (command) to devise task steps in the main task are following: 1. settings - reads and writes settings cluster to a XML-File. If no XML-File exists, a settings window pops up, user have to make settings and they will be written to a new XML-File. 2. open interfaces - inits and opens interfaces to devices with settings from XML-File 3. start tasks - starts another (see above) tasks dynamically. 4. wait on commands - contains a event structure, which queries user events from FP 5. reinit program - if settings are changed by user, all tasks will be reset with Set Value Property, device interfaces will be closed and reinit then if user want to exit program 6. stop tasks - all tasks will be stopped by closing queue or notifier refnums 7. terminate tasks - if any task runs after closing refnums (normally not used) then this task will be aborted 8. close interfaces 9. exit LV Also, to communicate between tasks I use (easy example with only one devise): 1. One queue - read&parse task put messages into this queue and log task gets this messages and logs them to hard drive 2. One notifier - read&parse task put messages to notifier and show task gets them and shows to user 3. One notifier - user puts any commands to this notifier and "send to devise" task gets them and sends to devise Its okey? Good or bad? Now I want to replace my communication mechanism because of following problem: http://forums.lavag.org/index.php?s=&s...ost&p=28344 What do you think about it? best regards, Eugen Quote Link to comment
Michael Aivaliotis Posted April 19, 2007 Report Share Posted April 19, 2007 See my related post here: http://forums.lavag.org/index.php?s=&s...ost&p=28409 Quote Link to comment
Eugen Graf Posted April 21, 2007 Author Report Share Posted April 21, 2007 Can anybody say me how to solve the same problem in the "read task"? How can I "say" to the read task about new settings? Thanks, Eugen Quote Link to comment
Eugen Graf Posted April 25, 2007 Author Report Share Posted April 25, 2007 QUOTE(Eugen Graf @ Apr 20 2007, 04:59 PM) Can anybody say me how to solve the same problem in the "read task"? How can I "say" to the read task about new settings?Thanks, Eugen Ok, nobody want to help. I did it myself. Eugen http://forums.lavag.org/index.php?act=attach&type=post&id=5615 http://forums.lavag.org/index.php?act=attach&type=post&id=5618 http://forums.lavag.org/index.php?act=attach&type=post&id=5616 http://forums.lavag.org/index.php?act=attach&type=post&id=5619 P.S. can anybody say me, how to set timeout in "Wait On VISA Event" to unlimited? Quote Link to comment
i2dx Posted April 25, 2007 Report Share Posted April 25, 2007 QUOTE(Eugen Graf @ Apr 24 2007, 01:44 PM) P.S. can anybody say me, how to set timeout in "Wait On VISA Event" to unlimited? I am not sure, but usually -1 is the number you have to wire, if you want an unlimited timeout ... but I don't know if this is working with VISA, too (and I am to lazy to take a look now ) Quote Link to comment
Eugen Graf Posted April 25, 2007 Author Report Share Posted April 25, 2007 QUOTE(i2dx @ Apr 24 2007, 05:16 PM) I am not sure, but usually -1 is the number you have to wire, if you want an unlimited timeout ... but I don't know if this is working with VISA, too (and I am to lazy to take a look now ) Timeout -1 or better FFFFFFFFh should be possible, but I get "Timeout Error" if I do it. It's a bug? Eugen Quote Link to comment
i2dx Posted April 26, 2007 Report Share Posted April 26, 2007 QUOTE(Eugen Graf @ Apr 24 2007, 06:28 PM) Timeout -1 or better FFFFFFFFh should be possible, but I get "Timeout Error" if I do it. It's a bug? to be honest: I have absolutely no idea ... Quote Link to comment
Eugen Graf Posted May 4, 2007 Author Report Share Posted May 4, 2007 Thank you, Michael. Your recommendation with Variant Data and Action solves NEARLY ALL of my problems. Here I can use Queues or User Events, no functional difference is to recognize. The problem was to "OR" queues in tasks and with variance I can do it. Eugen Quote Link to comment
Eugen Graf Posted May 5, 2007 Author Report Share Posted May 5, 2007 QUOTE(Eugen Graf @ May 4 2007, 12:13 AM) ...no functional difference is to recognize... No, if I want to "say" to more than one task about new settings, I have to use User Events (or Notifier?) but no queues. Because if I dequeue new settings in a task, than other will dont get it. Eugen Quote Link to comment
Michael Aivaliotis Posted May 5, 2007 Report Share Posted May 5, 2007 QUOTE(Eugen Graf @ May 4 2007, 12:34 AM) No, if I want to "say" to more than one task about new settings, I have to use User Events (or Notifier?) but no queues. Because if I dequeue new settings in a task, than other will dont get it.Eugen I actually mentioned this in my post http://forums.lavag.org/index.php?s=&showtopic=7531&view=findpost&p=28409' target="_blank">here. QUOTEKeep in mind that you will need different queues for different types of tasks. Sorry if it wasn't clear. However, you can combine functionality into a task to handle this. Quote Link to comment
Eugen Graf Posted May 5, 2007 Author Report Share Posted May 5, 2007 QUOTE(Michael_Aivaliotis @ May 4 2007, 10:43 AM) I actually mentioned this in my post http://forums.lavag.org/index.php?s=&showtopic=7531&view=findpost&p=28409' target="_blank">here. Sorry if it wasn't clear. However, you can combine functionality into a task to handle this. Sorry, I can't solve my problem with your VI. Here a screenshot. Eugen Quote Link to comment
eaolson Posted May 5, 2007 Report Share Posted May 5, 2007 QUOTE(Eugen Graf @ May 4 2007, 02:34 AM) No, if I want to "say" to more than one task about new settings, I have to use User Events (or Notifier?) but no queues. Because if I dequeue new settings in a task, than other will dont get it. I've done something similar, and my solution was to give each task its own queue. If you must have one queue, you could make the Action specific to each task (e.g. Update settings - main, Update settings - read, etc.), and if a task dequeued an instruction that wasn't applicable to it, it sticks it back in the queue. Quote Link to comment
Eugen Graf Posted May 5, 2007 Author Report Share Posted May 5, 2007 Ups, sorry, see here http://forums.lavag.org/index.php?s=&s...ost&p=29306 Probably I am to nervous if I see my project at work an if my boss say me to make it faster. If a am home I see, where the problem is. I can imagine how to make it right, but if a am on work... Eugen So I have only to memorize , that a queue can not simply be a data buffer, but it can have a important functionality. It can "say" to a task, what to do with data in the same message. It's very significant for me. Eugen 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.