sending trigger to other devices locked on to the time of response

David McFarlane mcfarla9 at msu.edu
Thu Sep 2 19:08:49 UTC 2010


Good timing -- It just so happens that I have been working on this 
very issue for a lab here.  You have to make the proper settings in 
your stimulus, and use a bit of inline code following the 
stimulus.  Here is the fully-commented inline code for my solution:


'/----------------------------------------------------------------------
' We wish to present a stimulus (in this case, StimText), get a
' response during that stimlus, and raise a signal as soon as the
' subject responds.
'
' To do that, we need to run this inline code during StimText.  We
' could simply set the Duration of StimText to 0 or so (depending on
' considerations such as leaving some time between stimulus .OnsetSignal
' and .OffsetSignal) and then our code would have to also handle
' further stimulus timing.  But with judicious use of Duration and
' PreRelease, E-Prime will automatically take care of stimulus timing
' for us.
'
' So instead we simply set the Duration of StimText as desired (which
' as a result automatically determines the target onset time for the
' next stimulus object), and we set the PreRelease of StimText to a
' suitably large value (preferably >= Duration, but perhaps less due
' to other considerations as mentioned earlier).  Now this code will
' start to run soon after the onset of StimText, and handle the
' reaction to the subject response.
'
' Finally, this code simply makes use of .IsPending() to detect the
' response (see the InputMask.IsPending topic in the online E-Basic
' Help).  Note that as a result StimText will last at least as long
' its input mask Time Limit, regardless of its Duration (if you just
' keep Time Limit at the default of "(same as duration)" then this
' will not pose a problem).

Const  LptDataPort as Integer = &H0378  ' adjust this for your system
Const  SignalData as Integer = &HFF  ' adjust this for your device
Const  LoopDelay as Long = 2  'ms; set as small as possible for your
         ' system

Do While StimText.InputMasks.IsPending()
         ' Some slower machines (such as my home laptop) need a delay so that
         ' EP can detect & handle input:
         Sleep LoopDelay
Loop
WritePort LptDataPort, SignalData
'\----------------------------------------------------------------------


This is fine as long as you limit the response to coming during the 
stimulus.  If you want to present a train of stimuli during the 
response period then you must do a little more.  I also have a 
solution for that, but it is rather intricate and too much trouble to 
go into here, so I hope this is good enough for now.

-- David McFarlane, Professional Faultfinder


At 9/1/2010 02:38 AM Wednesday, Jaeyong Lee wrote:
>I was wondering if there is a way to send trigger signals locked on
>the response time.
>
>For instance,
>
>Stim.OnsetSignalEnabled = True
>Stim.OnsetSignalPort = &H378
>Stim.OnsetSignalData = 1
>
>
>WritePort &h378, 0
>
>the above code send triggers at the onset of the object "Stim".
>
>However, I am trying to figure out a way to send triggers at the time
>of response of "Stim".
>
>I would greatly appreciate all tips and advices from you.  Thanks.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list