08-09-2018 05:46 AM - edited 08-09-2018 05:48 AM
Hello,
My problem is that second while loop is executed so many times, depending on the data lengt passed through queue. So dequeue element wont't work outside while loop, but if dequeue element is in while loop, each time while loop is suppose to executed (let sey 6 times) data from a new queue is used ( while loop execute once), so I am processing only one part of the data each time not the wholle "message". First while loop is time besed. It is important to me that while loop is executed multiple times and not time based. How can I sole this.
Thank You.
Solved! Go to Solution.
08-09-2018 05:55 AM
https://forums.ni.com/t5/Community-Documents/Unofficial-Forum-Rules-and-Guidelines/ta-p/3536495
please read this
08-09-2018 05:58 AM
the dequeue has to be inside a loop, otherwise you will only get elements once.
08-09-2018 06:28 AM
I understand that queue is not working outside the loop, but how can I make my program work without queue, simply as posible. Sorry if it has been aswerewd but i didn't find solution.
Thank you.
Here is whole program, please ignore error wiring an lack of subVI's.
08-09-2018 06:54 AM
sorry can't open .. am still on 2016
if you'd like you could back save "File"->"Save for Previous Version"
regards
08-09-2018 06:58 AM
sorry, here is 2015 version.
08-09-2018 07:27 AM - edited 08-09-2018 07:28 AM
from the looks of it you could do this all as a state machine in the first loop.
put all the logic from loop2 and 3 in the timeout case and wire some timeout value to the event structure.
the VISA write should be only triggered when you push one of your buttons, so wrap it with a case structure and wire a boolean coming from the event cases where you want to write.
you should find a way to get rid of the "Bytes at Port" and make use of a termination character instead.
08-09-2018 07:32 AM
First, dequeue in a while loop. Use a for loop auto indexed on the queue data array inside the while loop.
Alternately, this sounds like a great place to use a "Channel Wire"
08-09-2018 09:17 AM
Thank you for your help.
08-09-2018 09:27 AM
you are welcome :cheers: