Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

If/Than embeded within While loop with multiple outputs

We are a Senior Design Group who is having much troubles with LV as none of us are programers and especially unfamiliar with all that LV has to offer. 
 
Here is what we are thinking that the program we need needs to look like but have no real clue as to how to implement it in LV.
 
WHILE Time Elapsed < 10 seconds
  {  IF Voltage = 1 V
     THAN Output Sound File 1 and Write "1" to Excel File in "A1" and Reset Time Elapsed
.
.
     IF Voltage = 1 V again
     THAN Output Sound File 2 and Write "2" to Excel File in "A2" and Reset Time Elapsed
.
.
.
.
     IF Voltage = 1 V again (for the 50th time)
     THAN Output Sound File 50 and Write "50" to Excel File in "A50" and Reset Time Elapsed
  }
 
Once 10 seconds elapses we need to break out and start the above program again (once 1 V is reconized again), except Write to Excel File in "B1....B50"
 
Thank you for any help
 
Struggling Students
0 Kudos
Message 1 of 6
(4,427 Views)

Well in my opinion, it would do you good by going through the online LabVIEW tutorials on ni.com

you will find it here and here

That way, you should be able to achieve what you are looking for Smiley Wink

0 Kudos
Message 2 of 6
(4,424 Views)
Thank you for this information.  We have already been through this.  Some basics are understood but we are still very unsure about implementing them.  Still having problems as there is not much specifics in the ouline tutorial courses.
 
One suggestion that we have previously gotten was to incorporate a Shift Register function.  After playing around with this we have come up with only a very minimum understanding of this function.  If we use the Shift Register function and it shifts the array, would it be possible to pull information as to how many times that the shift register has been used?  Essencially stating that if register was used twice than use sound file 2 and if register is used 3 times use sound file 3, ext.  Would we be accurate in assuming that there is a function that could do this?  If so could you help explain how to do this?  Or if there is an easier way.
 
Thanks
0 Kudos
Message 3 of 6
(4,408 Views)
Here is something to get you started, a while loop with an If/Then (Case Structure) embeded.  If you need to repeat once the loop is done, put a large while loop around the whole thing.  A loop should have a delay timer (I chose 10mS) so that the loop doesn't hog all the CPU time.  During that delay, the CPU can perform other functions.  Without the delay, the loop will use 100% CPU time and strange things can happen.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 6
(4,392 Views)
Hello everyone,

I'm going to chime in here and thank devchander and AnalogKid2DigitalMan for taking care of multiple posts by this user here here here and here (all posted within 15 minutes of each other).

Cheers.



| Michael K | Project Manager | LabVIEW R&D | National Instruments |

0 Kudos
Message 5 of 6
(4,367 Views)
I am having a hard time figuring out what you are really trying to do.  I read your text based code and I am unsure about the desired result.  You want to wait for up to 10 sec.  If during that time, a voltage is 1 (and watch out for checking for exactly one as inputs from hardware are usually floating point and rarely = 1.00000000...) you want to play a sound (one from an array of sounds or an array of sound files?) and log the sound's index to that row in excel.  After 50 times of playing a sound (although you don't define what happens if the voltage != 1 in 10 sec) increment the excel column.

Is this right?

Oh, one more thing; its If - Then or Greater Than.  The word is Then (subsequent instead of comparison).  Perhaps in addition to not being programmers, you aren't English majors either Smiley Wink.

Thanks,
Bob Young

0 Kudos
Message 6 of 6
(4,327 Views)