LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

derivate a numeric variable

Solved!
Go to solution

first i have a sensor that measures pulses , and I need to obtain how many pulses i'm getting per second .

i couldnt find a way to do that , how can i convert the derivative of the pulses numeric variable that keeps changing while i am measuring from the sensor ?

0 Kudos
Message 1 of 10
(3,673 Views)
Solution
Accepted by topic author zawilious

Huh? Your problem is not quite clearly explained, but it sounds to me you have more of a Hardware problem than a LabVIEW problem. What sensor do you have? Have you taken a look at the datasheet, to see if there's info you need to know before working in your app?

 

It sounds to me like a very basic case for a frequency to voltage converter. What I would do is:

 

-Use a real-time capable device, like a comercial frequency to voltage IC or in my case, a cheap 16F887 and a few lines of code

-Get an output in voltage

-Measure that with any acquisition hardware of your choice or, if you're knowledgeable in PIC programming, send it right over to LV thru RS232 or USB if you rather use an 18 family one.

 

It is not realiable to use LV to measure pulses directly, as it runs on an OS that is not real-time capable, and you'll have discrepancies even at low frequencies. NI offers a wide range of hardware capable of reading frequency, and there are plenty of less expensive solutions, like the one I described.

 

Post back with a clear view of what you have, what you can buy, what you want to do, and we can help you further.

0 Kudos
Message 2 of 10
(3,639 Views)

Hi zawilious,

 

use a cheap DAQ device with a counter - even the cheap USB600x will do.

Then use that counter to count those pulses.

Read the counter value once a second.

Finished…

 

how can i convert the derivative of the pulses numeric variable that keeps changing

Which derivative?

Convert to what?

I guess you want to calculate the speed from pulse count: use a shift register to store values from last iteration…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 10
(3,616 Views)

could you please post an example how can I read the counter once a second , since i have a counter but its value keeps increasing as I am runing the code , I jut want to capture how many pulses new pulses i get over one second 

0 Kudos
Message 4 of 10
(3,605 Views)

Hi zawilious,

 

I jut want to capture how many pulses new pulses i get over one second 

Store the counter value of the current iteration in a shift register.

In the next iteration you subtract the old counter value from new value to get the difference. Kind of easy, don't you think?

check.png

You know how to use shift registers?

Have you taken the free online resources to learn LabVIEW?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(3,601 Views)

I'm new to labview , 

I appreciated your patience with me . could you please check the VI attached here , give it a look so you can understand what I am doing , 

0 Kudos
Message 6 of 10
(3,597 Views)

Hi zawilious,

 

could you please check the VI attached here

You seem to use a simple example VI from example finder…

 

What's wrong with using exactly this example:

- There is no loop in the VI, so how do you run this VI for more than a second?

- When you use the "run continuous" button: this is just wrong! (And your DAQmx task will be created and closed all the time…)

- Did you even try to understand my example image and to implement it in your VI?

 

I'm new to labview

Then take those FREE online resources to learn LabVIEW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 10
(3,587 Views)

yes I used a demo for a hall effect sensor from the Myrio project essential guide and I want to modify it , the thing is

that I don't have enouph time to try thinks and learn since I need to implement this in a project that I need to submit it today .

I understood  the exapmle you gave , but I didn't figure out how can I take this difference once every one second 

0 Kudos
Message 8 of 10
(3,579 Views)
Solution
Accepted by topic author zawilious

Hi zawilious,

 

I don't have enouph time to try thinks and learn since I need to implement this in a project that I need to submit it today

I'm sorry, but this community isn't the right place to ask for ready-to-use stuff to solve your homework…

Either you learn to use LabVIEW - or you can't solve your homework!

 

Don't get me wrong: you can always ask for specific help!

Ask specific questions, provide your VI and tell us, where you are stuck!

But please don't ask for "solutions for free"…

 

but I didn't figure out how can I take this difference once every one second 

Have the loop iterate once per second.

Replace the random() function in my image by your DAQmxRead function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(3,573 Views)

I didn't ask for ready to use stuff , I'm just asking to learn a specific funcion that I need.
thanks for guiding me 

 

0 Kudos
Message 10 of 10
(3,562 Views)