LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reset a counter in every iteraion of a loop

HI, I would like to count the number of rising edges in a loop but I would like to count the number of rising edges every 10 ms then reset the counter and count the number of rising edges for the next iteraion and save all the values in an array ( exactly like sampling- count number of R-edges every T second and save all the values in an array). I would really  appreciate your help with this code. I have attached my code to this email

0 Kudos
Message 1 of 3
(5,904 Views)

You could put the number in a shift register and subtract the current from the previous value at each iteration and display the difference in an indicator. Build the array of results in another shift regsiter.

0 Kudos
Message 2 of 3
(5,901 Views)

Hi Tintin,

 

If you go to your functions palette and look under timing » elapsed time.vi and place this on the block diagram inside your loop. What this function does is count to a specified time value  (in seconds) and then produce a boelean true value which you could use to reset your counter using a shift register. Another means of storing your counter values is to use an autoindexing feature of a FOR loop rather than WHILE loop (this will add to the array on a new index on each iteration).

 

I have taken your vi and quickly added in an array building function for your results to give you an idea of what you can achieve.

 

I hope your project goes well!

 

Kind Regards,


Larry Colvin
Associate Principal Engineer
Dyson Technology Ltd.

0 Kudos
Message 3 of 3
(5,877 Views)