‎01-08-2018 10:24 AM
Hello Everyone,
I am using speed sensor MX5015 through sbRio-9636 board.My target is to measure the time when the sensor gives 40 rising edge and repeat it. To get this, I put a counter. If the counter is equal to 40, then I am trying to get the timing through Tick count expresss VI (screenshot). But it is not giving me the time till the sensor get 40 rising edge.
Can you please tell me what is the problem with this method? or is there any other method by which I can measure the time?
I am new in LabVIEW. so if I did someting really stupid, please forgive me. 🙂
Best Regards
Sazzad
Solved! Go to Solution.
‎01-08-2018 01:17 PM - edited ‎01-08-2018 01:18 PM
You've answered your own question.
Sazzad wrote:. If the counter is equal to 40, then I am trying to get the timing through Tick count expresss VI (screenshot). But it is not giving me the time till the sensor get 40 rising edge.
Also, you have an infinite while loop once the count equals 40 and the true case run, the loop inside of it will run forever because you have a False wired to the stop terminal.
‎01-10-2018 04:07 AM
Hello Knight of NI ,
Thank you for pointing me out the mistake. I change the conditional terminal of while loop to True and it is giving me the time.
But the problem is now the time it is counting is when I start running the program. I want to count the time when the digital input start to giving pulses. In order to do this I gave a case structure so that if digital input give pulses the tick count will start (screenshot below). But this is not working.
Do you have any suggestion how to solve this problem?
Thank you.
‎01-10-2018 04:30 AM - edited ‎01-10-2018 04:44 AM
Hi Sazzad,
I change the conditional terminal of while loop to True and it is giving me the time.
I don't think so: right now you should get either zero or just some ticks because you subtract two tick values read immediatly one after the other!
Why don't you clean up your blockdiagram to improve its readability?
I want to count the time when the digital input start to giving pulses.
Then you need to program this condition! Right now you try to read the loop time when the counter is equal to 40…
When do you want to stop the time counting?
Just a suggestion:
‎01-11-2018 09:56 AM
Hello GerdW,
Thank you for your suggestion. I followed your suggestion and the block diagram is below. I put a while loop inside because if I put the Tick count only inside the Case structure i am not getting any time. I hope now the readability is better.
But in this way the time is starting when I run the program. So i am getting the total time for how long the program is running. I think it is because the tick counter outside the big while loop is starting when the program start to run.
I want to get the time when the counter value is between 1 to 40 and then the time will become 0. It will start counting again when the counter is 1.
So where should I put the tick counter so that It only starts when Counter value is 1?
Thanks a lot for your helping and all your good works.
‎01-11-2018 10:03 AM
Hi Elf,
I hope now the readability is better.
No. Still lots of bended wires and right-to-left flow…
Just use AutoCleanup!
I want to get the time when the counter value is between 1 to 40 and then the time will become 0. It will start counting again when the counter is 1. So where should I put the tick counter so that It only starts when Counter value is 1?
You need to program all this - it mostly is missing in your VI!
- set a start time when your counter == 1
- calculate the duration when your counter == 40
- Why do you want to set the time to zero just after calculating it? Your FPGA will do this within nanoseconds: no chance to read the value from your RT host!
Start by drawing an algorithm on a sheet of paper, then do the programming… 😄