Sending a trigger during a stimulus' presentation

Ben Robinson brobinso at mprc.umaryland.edu
Tue Jan 30 14:30:10 UTC 2007


yes.  this can be done.

we present our Stimulus ("TheStim") with a duration of 0 ms.  assign
the responses allowable, Time Limit = infinite, End Action = none.
also, the background is Transparent, but i'm not certain this matters.
immediately after TheStim we have this inline:

***********************
WritePort &H378, 0
WritePort &H378, c.GetAttrib("EventCode")

flag = 1

Do
   If TheStim.RT > 0 and flag = 1 then
	WritePort &H378, 0
	WritePort &H378, TheStim.ACC + 8
	timestamp = clock.read()
	flag = 2
	c.SetAttrib"ReactTime", timestamp - TheStim.OnsetTime
   end if
Loop until clock.read() > TheStim.OnsetTime + 190
**************************

the initial WritePort sends a zero to clear the line for the event
code, which we pull from the list with the next WritePort command.
we set up a flag so that the response code can only be sent one time,
without any repeats.
we use a Do Loop Until for the duration that we want TheStim to remain
onscreen (in this case, approx 200 ms).
within the Do Loop we continuously check TheStim's RT to find out when
and if a response was made (RT > 0).
if a response was made we immediately send the response code, set a
timestamp for the response, and set the flag so that this sequence won't
happen again during this trial.
at the end of the Do Loop, whether or not a response has been given, we
clear TheStim by presenting our fixation point, "Fixation," with an
opaque background and a duration of 0 ms.
following Fixation we have this inline:

***************************
Dim flag2 as integer
Dim Timestamp2 As long
Dim duration as integer

Timestamp2 = clock.read()

duration = Random (900,1300) 'choose a random duration

flag2 = 1

Do
   If TheStim.RT > 0 and flag2 = 1 and flag <> 2 then
	WritePort &H378, 0
	WritePort &H378, TheStim.ACC + 8
	timestamp = clock.read()
	flag2 = 2
	c.SetAttrib"ReactTime", timestamp - TheStim.OnsetTime
   End If
Loop until clock.read() > Timestamp2 + duration

If c.GetAttrib("Target") = "y" Then
	TotalTarget = TotalTarget + 1
	If TheStim.ACC = 1 Then
		ACC = ACC + 1
		ACCTarget = ACCTarget + 1
	End If
Else
	If TheStim.ACC = 1 Then
		ACC = ACC + 1
	End If
End If

Total = Total + 1
*************************

this inline is similar to the first inline i described. 
we set up another flag, so that only one response code can be sent.
we jitter the duration of the fixation point between 900 and 1300 ms.
we use another Do Loop Until to find the first response (we make sure
neither flag has yet been tripped, either the current "flag2," or the
previous "flag").  if we detect the first response we send a response
code, record the time it happened, and keep looping until the Fixation
duration elapses.
the If, Else, End If part of the code helps keeps track of accuracy. 


hope that helps.

ben robinson

>>> Fabrizio Ferri Benedetti <Fabrizio.Ferri at uv.es> 1/29/2007 12:38 PM
>>>
Hi!

I'll try to make it simple:

- In my procedure, an InLine BEFORE the stimulus send a start trigger 
via serial port using OnSet method; an InLine AFTER the stimulus send 
triggers accounting for accuracy or lack of response (as the subject's

answer terminates the slide)

-In the same procedure, there is also a fixed-time pause after the 
stimulus. It happens that the subject may answer during the pause, and

not during the stimulus. Now, as the pause (an empty slide) can't be 
terminated by the subject's answer, every trigger I process with an 
InLine after the pause itself will always be sent after the pause.

Is there any way to send triggers (or perform actions) if the subject 
answers during the presentation of a stimulus (slide/text/pause/etc)? 
That is: I don't want the answer to terminate the stimulus or pause; I

just want the answer to perform scripted actions (like sending
triggers) 
along the duration of the slide.

Hope I made myself clear...

Cheers,

Fabrizio

-- 
Fabrizio Ferri Benedetti
Departamento de Psicología Evolutiva y Educativa
Facultad de Psicología
Universidad de Valencia
http://www.uv.es/fafebe 



More information about the Eprime mailing list