I would like to create an algorithm to get array including pulse data. I use Labview 2019.
Normally, i will receive pulses from a DAQmx channel (NI 9423 - DI), but before connecting to cRIO, i created a pulse detection algorithm in a random vi file. I have found elapsed time calculation between pulses algorithm in an another forum content. Based on this algorithm, i have successful results to receive pulse time. However, i could not get auto-indexed values of pulse times. In design case, user will write an input number to specify the required pulse numbers. Then, program will get average time of these pulses. Then it will be used to calculate a flow rate data in a more precise way. To get pulse time, we use a namur sensor and in real application we will use pulse data that is received from this namur sensor.
I tried to get auto-indexing by using a for loop inside a while loop, but it always indexes the last value and indicates at 0th indice of array, i could not get success to list more than 1 value into the array 🙂
You're currently reinitializing your array of time values every iteration of the While loop.
Instead, you should use a Case Structure and something like Build Array, then Array Subset (to allow changing the array length at run time, perhaps with some maximum size, more complicated but possible) or with Replace Array Subset and Rotate 1D Array (or a rotating pointer to the element to replace) if you initialize the array outside and don't allow changing "Counter value" during execution (it can still be a control, it would then just only matter at the beginning).
Here's a quick set of hints on your block diagram (rearranged to make it easier in my opinion to read - you might disagree...)