From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset the timer and counter when 48 pulses have been counted and the IM speed has been calculated in RPM

Hello everyone,

 

I am new to Labview and I need assistance.

I am setting up a speed measurement of an induction machine in Labview. The sensor that I am using is an inductive sensor that outputs a digital signal in form of pulses. There are 16 pulses in one revolution. The output of the sensor is connected to the PXIe6363 DAQ through the SCB68 and then I have used the DAQ assistant in Labview to count the number of pulses by recognising a rising edge and ultimately calculate the number of revolutions and speed in RPM. 

 

I would like my code to perform the following tasks:

1. To calculate/update the speed only after 48 pulses have been counted in each instant, that is, to calculate the speed after 3 revolutions. I am using a tick count as my timer to record the period of the 48 pulses and use this to calculate the speed. I have managed to write a code that does all this by using a comparator (to compare the number pulses that have been counted) and calculating the speed inside the case structure.

 

2. Once the speed has been calculated/updated from the previous iteration after counting 48 pulses, I would like the code to reset the counter so that it can count the next pulse train of 48 pulses. I would also like the timer to be reset to zero and start recording the period of the new (48) pulses. After this is done, then the new speed is calculated and the process repeats itself again. So the code should be resetting everything and updating the speed accordingly at the end of each iteration. This is where I am stuck. Please assist me.

 

I have attached a flow chart of the proposed code. I will also attach the VI a bit later for more information.

Thank you in advance.

0 Kudos
Message 1 of 5
(1,185 Views)

Do you really need it to ONLY calculate speed after 48 pulses? If it were me I think I'd calculate speed for each pulse, then average it together (assuming evenly spaced pulses). You can do that very easily with a Frequency measurement task.

0 Kudos
Message 2 of 5
(1,178 Views)

I don't see the attachment you mentioned, but I would approach it pretty much like BertMcMahan suggested.

 

You can use a frequency measurement task set up for continuous sampling.  In your main loop, read 48 samples at a time.  Take the average of that set of 48 individual frequencies.  That's the measurement you want.  The next iteration, you do the same thing again.

 

This will be a *better* measurement than what you're doing now with the software-based query of a Tick Count.  Instead, a frequency measurement task uses a much higher resolution hardware clock (literally,100 thousand times better, 100 MHz instead of 1 kHz) in your DAQ device to track time.

 

There's a shipping example (menu: "Help->Find Examples...->Hardware...->etc.) that'll illustrate how to do a continuous sampling frequency measurement task.  Check it out and come on back if you have more questions.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 5
(1,140 Views)

Hello BertMcMahan,

 

Thank you for your response.  Averaging using the frequency measurement task really does seem like a good approach. Let me look into that instead. 

Thanks!

0 Kudos
Message 4 of 5
(1,077 Views)

Hi Kevin_Price,

 

You have really made this clear to me. 

I'll have a look at the example(s) of using a continuous sampling frequency measurement task and review my code. Thanks so much.

 

Ester

0 Kudos
Message 5 of 5
(1,076 Views)