Frequent Crashes of E-prime 3.0 During the Use of StimTracker Quad for Sending Triggers in EEG Experiments

Hi All,

I am a complete novice, and I’ve encountered some problems that are hard to resolve when using the StimTracker Quad to send triggers. I need your help.


I use E-prime 3.0 to design EEG’s ERP (event-related potential) experiments and send triggers through the StimTracker Quad. In the program design, a trigger is sent when a picture appears, a trigger is sent when a problem occurs, and a trigger is sent when the subject responds. There are three places where triggers need to be sent in total. Regarding the setting of trigger codes, I strictly follow your official tutorial Using StimTracker with E-Prime 3. (By the way, I am using the new laboratory of the university, we are the first team to use the new equipment.)


I found the program runs very unstable, every time there is a trigger picture, E-prime 3.0 will crash, and there is no any error prompt.

I have been trying to eliminate the bug for many days, although it was not effective, but I found the following things:

  1. The problem most likely lies in the trigger code used in E-prime 3.0. Because when I remove the trigger code, the E-prime program runs smoothly and stably.
  2. Even if the program runs successfully a few times, it still crashes after restarting the computer. The program is likely to crash before the second image with the trigger appears. But sometimes the program will also crash in other parts with triggers.
  3. The official tutorial Using StimTracker with E-Prime 3 seems to have some redundant code, because I have tried to delete all the code related to PulseStimTracker1, and only keep the code related to PulseStimTracker2 in the User Script (I also deleted all TrialInitInL and InLine1), StimTracker Quad can still send triggers successfully. And the whole program ran successfully once. However, after restarting the computer, the program crashed again.
  4. I also checked the computer memory and found that the memory is sufficient, so it may not be caused by insufficient memory.

The following pictures are the connection methods of the laboratory’s StimTracker. If they are helpful for eliminating bugs, you can refer to these pictures. If you need further information, please feel free to contact me.

Thanks again for your help.


Unfortunately, the staff at Cedrus is unable to assist. We offer world class support for our hardware, but we don’t have any in-house E-Prime experience nor can we delve into an individual user’s code.

The sample code that you reference was generously contributed by Dr. Rohit Tyagi, a longtime user of our products. If you do find a fault with the code, we would be happy to give you credit for it on our website.

Hi Hisham,

Thank you for your prompt reply :grinning:

Yesterday, I attempted to replace the “task event” functionality(used for sending triggers in EEG experiments) in E-prime 3.0 ( with E-basic .

The program ran successfully 12 times, so I believe the issue may have been resolved.

The following is the code I modified based on the original tutorial.

Dim integerVersionOfAttribute As Integer
Dim millisecondsDuration As Integer
Dim flagValueForDisablingPulse As Integer
millisecondsDuration = 30
'set an upper limit for the unique number to be sent out as marker (depends on receiving device)
flagValueForDisablingPulse = 260
' We use "Context.GetAttrib" to get the
' current value of "StimVal" from the StimList.
' (Refer to E-Basic help regarding "Context.GetAttrib")
Debug.Print "atrrib is: " & c.GetAttrib("StimVal")
integerVersionOfAttribute = CInt(c.GetAttrib("StimVal"))
'Just for fun, we will turn pulse OFF for the last few trials
If integerVersionOfAttribute >= flagValueForDisablingPulse Then
millisecondsDuration = 0
End If 
'Support Comments: below subroutine call has been moved to StimDisp.OnsetTime
'We will set millsecondsDuration as an attribute to be referenced in the Custom field
'PulseStimTracker integerVersionOfAttribute, millisecondsDuration
'Support Comments: setting the first variable to be passed-in as attributes
c.SetAttrib "millisecondsDuration", millisecondsDuration
'Support Comments: we can reference the StimVal attribute directly and pass it into the Script Task Event as Data Type = Integer

Dim bytesThatMakePulseConfigCommand(5) As Integer
'Here is where we construct the byte sequence
'that forms a StimTracker Event Marker command.
'(Refer to
bytesThatMakePulseConfigCommand(0) = 109 ' ascii m
bytesThatMakePulseConfigCommand(1) = 112 ' ascii p
bytesThatMakePulseConfigCommand(2) = millisecondsDuration
bytesThatMakePulseConfigCommand(3) = 0 
bytesThatMakePulseConfigCommand(4) = 0
bytesThatMakePulseConfigCommand(5) = 0
'(E-Studio generates the following script when the serial device is
'added to the experiment: Dim Serial As SerialDevice).
'Send the command to StimTracker!
Serial.WriteBytes bytesThatMakePulseConfigCommand

Dim bytesToRaiseStimTrackerLines(3) As Integer
'Make the command to zero out (clear) all lines
bytesToRaiseStimTrackerLines(0) = 109 ' ascii m
bytesToRaiseStimTrackerLines(1) = 104 ' ascii h
bytesToRaiseStimTrackerLines(2) = c.GetAttrib("StimVal")
bytesToRaiseStimTrackerLines(3) = 0 ' this final byte is currently ignored by StimTracker
Serial.WriteBytes bytesToRaiseStimTrackerLines

ExpFigure.Tasks.Add Serial.CreateTask("ExpFigure.OnsetTime",0,"WriteByte","(custom)",c.GetAttrib("StimVal"),"Byte",True)
ExpFigure.Tasks.Add Serial.CreateTask("ExpFigure.OffsetTime",0,"WriteByte","(custom)",ebDigit_0,"Byte",True)

I hope these will be helpful. As I’m new to this, I may not have everything perfect just yet, but I warmly welcome any additional feedback :slight_smile:

1 Like

Thank you for the detailed reply. I’m sure it will be helpful to other forum visitors.