LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing data to and from Comm Sub Vi with 2 loops

Im sure this is simple, and I think Im stuck in vacation mode and cant wait the 4 more hours till I leave, but this is really bothering me. I have a pretty large Queued State Machine and within that machine I have some states which must communicate via the TCP/IP port. My servers are complete and made into Executables and work fine, however I want to leave my clients as sub vi's so that I can easily pass in and retreive data from them. They are designed with 2 while loops, one for sending the data and one for reading the data back. At the very least the read loop needs to remain in a loop to pick up unsolicited messages from my CAN server. However when I place these into my master QSM they hold up the process because of the loops executing. Now I have made a separate loop in my QSM for all my communication clients so the rest of the QSM runs but I cant pass data into these clients because they are stuck executing the loops internally and dont stop to pull in data.
I should note that if I run my QSM to spawn the servers, then run my client as a separate VI rather than a sub and type my commands there then they execute perfectly.
So if you can follow my crazy description what would be the best/cleanest way to circumvent this so I can get moving ahead. Thanks, Dave
0 Kudos
Message 1 of 2
(2,255 Views)
Dave,

Would it work to use a queue to pass data from your main QSM loop to your communication loop? You could write the commands to the queue from your main QSM loop, and pick them up in the communication loop. They would then still run in parallel. Let me know if this works, or if you are looking for something else.
Robert Mortensen
Software Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,235 Views)