01-09-2012 06:24 PM
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
01-09-2012 06:34 PM - edited 01-09-2012 06:36 PM
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.
01-10-2012 08:14 AM
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,