Response triggers with accurate timing
RB209
jennaology at yahoo.com
Fri Jan 7 09:51:48 UTC 2011
I wanted to update this thread in case anyone else finds themselves
with a similar problem.
Before I decided to send triggers the basic design was as follows:
300ms fixation followed by slide1 object to display an image for
2500ms, followed by a blank screen for 1000ms. Participants can
respond as soon as slide 1 appears but I also wanted responses to be
collected for 1000ms afterwards. So although the duration for slide1
was initially set to 2500ms the time limit was 3500ms and end action
was none.
My need to send accurate response triggers was complicated by 2
factors.
1.) The response should not terminate the slide1 object
2.) Response triggers should be collected during the running of 2
different objects but I didn't want to leave open the possibility that
participants could respond twice within a single trial.
Eprime support have been extremely helpful and have come up with a
solution that I would be happy to send to anyone. I will briefly cover
the details:
Trial procedure is as follows:
1. Inline1 loads the blank screen (imagedisplay1) so that this is
ready to go when needed. Imagedisplay1 is an unreferenced object.
2.) Slide1: duration = 0, timelimit = 3700, end action = none. This
displays the image and sets an input mask for 3700ms
3.) Inline2: Firstly, certain variables are declared. Then, a loop
runs while the input mask ispending and breaks when a response is made
or the time limit
(3500) is reached. During this time, Eprime checks to see if 2500ms
has elapsed and if so, presents imagedisplay1 (which has already been
loaded to minimise delays). When the loop breaks, a trigger is sent. A
second loop is needed to control for participants responding before
2500ms has elapsed and breaking the loop too soon. (See below for the
actual code).
4.) Imagedisplay1 is held as an unreferenced object and has a duration
set to 1200ms
5.) A final inline object sends a 0 to the parallel port.
I have tried this and it all seems to work perfectly.
INLINE2 CODE:
Dim nStartTime As Long
nStartTime = Slide1.OnsetTime
Dim nImageTime As Long
nImageTime = nStartTime + 2500
Dim boolImageShown As Boolean
Dim nDrawTime As Long
Dim nTriggerTime As Long
'This checks to see if it is time to put up the image.
Do While Slide1.InputMasks.IsPending()
If Clock.Read >= nImageTime And boolImageShown = False Then
'cnvs.Copy offScreenCnvs, src, dest
Display.WaitForVerticalBlank
ImageDisplay1.Draw
nDrawTime = Clock.Read - nStartTime
boolImageShown = True
End If
Loop
If slide1.resp = "" then
writeport &H378, 5
nTriggerTime = Clock.Read
else
writeport &H378, slide1.resp
nTriggerTime = Clock.Read
end if
'This checks to see if it is time to put up the image if the subject
replied before the image
'was displayed.
Do While Clock.Read < nStartTime + 3700
If Clock.Read >= nImageTime And boolImageShown = False Then
'cnvs.Copy offScreenCnvs, src, dest
Display.WaitForVerticalBlank
ImageDisplay1.Draw
nDrawTime = Clock.Read - nStartTime
boolImageShown = True
End If
Loop
If slide1.resp = c.getattrib ("cr1") or slide1.resp = c.getattrib
("cr2") or slide1.resp = c.getattrib ("cr3") then
slide1.acc = 1
end if
'Save the trigger time and the time that ImageDisplay1 was drawn as an
attribute relative to the
'onset of Slide1
c.SetAttrib "TriggerSendTime", nTriggerTime
c.SetAttrib "ImageDrawTime", nDrawTime
'Debug.Print "Slide: " & Slide1.OnsetTime & ebTab & "Trigger: " &
nTriggerTime & ebTab & "RTTime: " & Slide1.RTTime & ebTab & "Image: "
& nImageShowTime
--
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