LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

front panel button slows application

What happens if two events occur at or near the same time.  Can an event be lost?
0 Kudos
Message 11 of 17
(1,263 Views)
The LabVIEW system will reliably queue the events for you.
0 Kudos
Message 12 of 17
(1,261 Views)

It also sounds as though your array may be growing with each pass through the -1 state.  If so this will almost certainly cause a slowdown and eventual out of memory error for your program.

 

Events and producer/consumer are definitely the way to go.

 

Lynn 

0 Kudos
Message 13 of 17
(1,259 Views)

Haha, I thought of that right after I first posted.  That is, I thought of the time it takes to build a new array each time, so I changed the code to insert array elements instead.  I no longer build the array.  I took care of that in my 'nuts and bolts' case, but it didn't occur to me until now to fix it on the -1 case.

0 Kudos
Message 14 of 17
(1,256 Views)
Inserting into an array is no better than building an array, and can perhaps be worse.  Either way, the array is growing in size.  If you want to control the size of the array, it is best to initialize it to some predetermined size, and use replace array subset to replace elements of the array.
0 Kudos
Message 15 of 17
(1,251 Views)

Insert into Array also increases the size of the array so it has the same memory allocation problems that Build Array has.

 

A fixed size array with Replace Array Element would not have the problem. You initialize the array outside the loop to a size greater than the maximum number of element you ever expect to accumulate before you have used them.  Then inside the loop use Replace Array Element to put new data into the array.  After searching for the new data, Replace it again with the default value.

 

A queue might be better choices than an array.  They can also have fixed sizes (set at creation) and have useful features like timeout and error clusters.

 

Lynn 

0 Kudos
Message 16 of 17
(1,250 Views)
Yes, I am using 'Replace Array Subset' and I did init it at the start of the program.  I was just going from memory,but I forgot there was another function with that name.... so I am doing it right.  Sorry for the confusion.
0 Kudos
Message 17 of 17
(1,231 Views)