LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Design a VI for giving a warning signal followed by a go signal for a Simple Reaction time task

Solved!
Go to solution

Hello,

 

 I need to perform simple reaction time test trials for one of my experiments, I need to design a Lab view program to acheive the following experimental design:

 

1. Pre trial interval of 2 s ------followed by------------- A yellow (LED) WARNING SIGNAL(which stays lit for about 80 ms)

 

2. After offset of warning light------------a random interval of 1-3 seconds-----------A green (LED) GO SIGNAL (which stays lit for about 80 ms).

 

3.  Back to step 1.

 

I want this loop to go around for a multiple reaction time trials.

 

 

I am new to lab view, but after reading tutorials I have designed a VI, but there are a few issues with this VI:

 

1. If I run it, the yellow and green lights just flicker and do not turn on and off alternatively, the way I want.

 

2. If I run the VI with highlight execution window checked, the program does run, and the yellow and green lights do light up alternatively. However the interval between yellow and green light does not appear to be random between 1-3 s..

 

I am attaching the VI I have designed, I will be gratefull if somebody can help.

 

 

Thanks

0 Kudos
Message 1 of 32
(3,015 Views)

docas,

 

You need to look at the documenation for "Elapsed Time" express VI.  It does *NOT* wait the amount of elapsed time, but executes immediately taking mere miliseconds.  You need to test to see if the elapsed time is true in a loop and then exit the loop.  The loop should also have a "wait" in it so you don't spend all your CPU time repeatedly checking the time.

 

So to summarize, the elapsed time VI does not wait for the elapsed time but tells you if the elapsed time has expired.

LabVIEW ChampionLabVIEW Channel Wires

0 Kudos
Message 2 of 32
(2,997 Views)

Hi, use the wait function, and I recommend to you avoid the flat structure, you can use the template of state machines in labview

 

this will help you http://www.ni.com/white-paper/7595/en/

 

In the other link I tried to use your VI with the wait functions, check it

0 Kudos
Message 3 of 32
(2,989 Views)

Create the most useful SubVI in existence.  It is called Wait+ and just has a wait node with an error in/out terminals.  Every LV programmer creates this VI and then puts it in a library folder for reuse.

 

This allows you to sequence the waits by wiring the error terminals together and getting rid of that ugly sequence.

 

Remember the wait is in units of milliseconds.

 

NOTE: 13Cmmkl, you need to multiply by 1000 to get the correct number of milliseconds not divide.

LabVIEW ChampionLabVIEW Channel Wires

0 Kudos
Message 4 of 32
(2,981 Views)

@sth wrote:

Create the most useful SubVI in existence.  It is called Wait+ and just has a wait node with an error in/out terminals.  Every LV programmer creates this VI and then puts it in a library folder for reuse.

 

This allows you to sequence the waits by wiring the error terminals together and getting rid of that ugly sequence.

 

Remember the wait is in units of milliseconds.

 

NOTE: @13Cmmkl, you need to multiply by 1000 to get the correct number of milliseconds not divide.


I think you have to make it reentrant?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 32
(2,970 Views)

@ sth

 

Thanks, I am trying with the wait time pallete, I think it should work. Will post update soon.

0 Kudos
Message 6 of 32
(2,961 Views)

Hi all,

 

I took you advice, please see attached VI. Will run it tomorrow in my experimental set up and post updates.

 

Thanks

0 Kudos
Message 7 of 32
(2,954 Views)

@billko wrote:

 

I think you have to make it reentrant?


Actually not.  Since you are serializing the calls to it by using the error input/output it is not essential.  This the case for this example.  HOWEVER, if you are calling it in parallel from different VIs it does need to be reentrant or you will get some odd behavior where delays happen.  So in general you do need to be reentrant to be a more useful tool, just not in this specific case.

LabVIEW ChampionLabVIEW Channel Wires

0 Kudos
Message 8 of 32
(2,940 Views)

@sth wrote:

@billko wrote:

 

I think you have to make it reentrant?


Actually not.  Since you are serializing the calls to it by using the error input/output it is not essential.  This the case for this example.  HOWEVER, if you are calling it in parallel from different VIs it does need to be reentrant or you will get some odd behavior where delays happen.  So in general you do need to be reentrant to be a more useful tool, just not in this specific case.


That's exactly what I meant, and you are exactly correct for the way it will be used.  I just had this EXACT conversation with someone at work today.  No kidding.  About the usage and everything.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 32
(2,934 Views)

Here was what I was talking about in cleaner code..  This is much easier to read code, which does the same thing.  Also note that all coercion dots are eliminated.

LabVIEW ChampionLabVIEW Channel Wires

Download All
0 Kudos
Message 10 of 32
(2,929 Views)