I cannot see your screen shot. .png or .jpg files are preferred for posting images to the Forum. Bitmap files are not allowed because of the large file size. Or just post the VI.
There is nothing wrong with the indexing method you have been using, although the process you use for calculating the index is a bit convoluted. I do not understand why you need to queue the array.
When I talked about the Producer/Consumer Design Pattern I was thinking the analog input would be in the producer loop and everything else would be in the consumer. So all the digital stuff would be in the consumer. The array can be wired directly, no queue involved. The queue I suggested is to transfer the array of analog daa from producer to Consumer.
Ok here is screenshot in the PNG format...there is not I can connect the arrary directly to the boolean digital write in the while loop.
Can you clean up the code? You have lines looping back on themselves and hitting functions at different points. It is impossible to know where each wire is coming from and going to.
Your digital write is a 1 channel, 1 sample. So that means you need to send a scalar boolean value. But you are passing a 1-D array of booleans through the queue. So what does an array of booleans mean to you with regards to a single digital output?
well the digital write VI I have takes a 1 dimensional array not one element... so that's why it accepts a 1 dimensional array of size N,, size can be changed.
Here is the code I have
You're right. You were able to connect a 1-D boolean array to the Digital Write 1 channel 1 sample.
So what is your question? "there is not I can connect the arrary directly to the boolean digital write in the while loop" is not a clear English sentence.
Well, actually what Iam saying is that if Iam using the producer/consumer loop pattern, then what would be the procedure to extract the whole 1D array using this Queing..
Because if Iam using the Obtain Queing function and Enquing function then I assume this would only extract elements of the array one by one...but I need to extract the entire 1D array and write it to the digital output port...now I see that there another function called flush Queing that does get the whole array but I do not know how to use it because i just do not see any examples.
What iam trying to do is obtain the 1D array that is inside the for loop and send this entire 1d array to the digital Write VI
This digital write VI is in enclosed in the while loop.. So the only way to get 1d boolean array from
I suppose the only way to accomplish this is using the producer/consumer loop pattern...but Iam not sure exactly what queuing operations to use for this purpose...so long story short...what iam trying to do is get the entire 1D array all at once and send it to digital write Vi that is inside the while loop
As Ravens Fans said a little cleaning up makes the program much easier to read. Here is what it looks like cleaned up.
The image below shows one way to avoid a queue for the boolean array to digital write: Put both in the consumer loop. Not shown is that you need another loop, one which encloses the analog Dequeue so that you get more than one data point and can run the boolean loop more than once. IF you make the consumer a while loop with a case structure inside it can become a state machine. It can have an idle state while waiting for the next data point. Then it can go through the digital write state 5 or 20 times, eliminating the need for the For loop. If you add an Initialization state, the DAQmx Create Channel and Start Task VIs can be there. A shutdown state can have the Clear Task.vi. This makes a very clean, robust, and easily modified program.
Now how do I connect 1 and 2, 4 and 5 of the digital write(as shown in your image) to the sides of the for loop, because when take 1,2 and 4,5 outside the for loop that gives me a broken wire...that It has different data type.. How can fix that.
When data goes through the edge of a for loop it has autoindexing turned on as default. So the data going out is built into an array. Just context-click on the tunnel and unselect Autoindexing.