LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have an optical sensor how do I get a RPM or frequency measurement?

Right now the only thing limiting your file write loop speed is the time taken to actually write to the file.  Try tossing in a "Wait until next millisecond multiple" to introduce a 100 or 200 millisecond wait.

 

Alternatively, you could use the "Write to Spreadsheet File" under File I/O and wire a true to the "transpose" option, which would give you basically limitless space in excel.

0 Kudos
Message 21 of 27
(1,315 Views)

Thanks Jeff, where exactly should I toss my "Wait until next millisecond multiple"?

Thanks

Best wishes

Robert

0 Kudos
Message 22 of 27
(1,309 Views)

The "Wait ms" and "Wait Until Next ms Multiple" vis will delay whatever node they are placed on.  For instance, if you place it outside all the loops, it will delay the start of the program, and then everything will run as normal.  If you place it inside your file write loop, it will delay the start of the loop every time it iterates.

 

edit - I attached a simple example.  Go to the block diagram, turn on Execution Highlighting (the lightbult button) and run the VI.  The execution will be delayed by one second at the beginning of each iteration.



Message Edited by JeffOverton on 02-26-2008 11:14 AM
0 Kudos
Message 23 of 27
(1,304 Views)


JeffOverton wrote:

The "Wait ms" and "Wait Until Next ms Multiple" vis will delay whatever node they are placed on.  For instance, if you place it outside all the loops, it will delay the start of the program, and then everything will run as normal.  If you place it inside your file write loop, it will delay the start of the loop every time it iterates.


Jeff,
 
I don't think that is entirely correct. 
 
If you have a Wait outside of all loops all that guarantees is that the program will take at least that long to run.  The wait statements will only affect nodes that are dependent upon it finishing either due to wires or sequence structures affecting the dataflow.  Parallel, non-dependent structures won't be affected.
 
If the wait is in a while loop, it guarantees the loop will take at least that long to run, but doesn't mean it will start later.  That is because the while loop can't complete or begin again until all nodes and structures inside have completed.
Message 24 of 27
(1,285 Views)
Thanks, RavensFan, I didn't know that.  I guess that shows the danger of determining how things operate via execution highlighting, too.
0 Kudos
Message 25 of 27
(1,270 Views)

I created a little VI in LV8.2 as a demo.

When it runs, you'll see that the indicator jumps immediately to 1, but the wait statement of 10,000 msec causes the loop to take 10 seconds.  The loop only runs once due to the True constant.  At which time the indicator is reset to 0 and the program ends.

If the loop ran continuously, each iteration would take 10 seconds,  but the other stuff inside the loop could happen anytime during that 10 seconds, and for something as simple as setting and indicator, it would essentially happen at the beginning of the loop.

0 Kudos
Message 26 of 27
(1,266 Views)

Hi


The code is working well, thank you.  I would like to make a modification.  There are three optical sensors and the LabVIEW is counting the time between individual pulses.  What I would like to do is count the time between different pulses.  For example there is sensor on the input drive and one on rotor, I would like to see the time between the drive and rotor pulses, so I can check their phase relationship.  How would I go about this?

Also, is there an easy way to detecting which direction the rotor is rotating? 

Thanks for your help

Best wishes

Robert

0 Kudos
Message 27 of 27
(1,197 Views)