E-primeHow to define your triggers in e-prime ?The parallel port address on which e-prime send stimulus related TTL is &H378 In order to have the most accurate timing, it is recommended to use the following function Object.OnsetSignalEnabled = True
Object.OnsetSignalPort = parallel &H378
Object.OnsetSignalData = value
Rather than the function "Writeport", type these command lines in a "in line" object in your e-prime tree (see the following basic example of script). In this example script, command lines are inserted in the "in line 1" object. Double click on it to open it in a window. After each e-prime stimulus object (sound, image) for which you want to send a TTL value, you have to insert an the following in line code WritePort &H378, 0
See "in line 3" object of the example script. This insure that your trigger line well returns to 0. This is CRUCIAL to avoid leaving lines ON!! Script writing:In this example, the experiment includes two types stimuli (audio and/or visual) which are presented alternatively or simultaneously. dim TTLbase as integer
dim VisualTTL as integer
dim AudioTTL as integer
This first step defines (with function "dim") the different variables (TTLbase, VisualTTL and AudioTTL) used in the e prime script. Instructions.OnsetSignalEnabled = True
Instructions.OnsetSignalPort = &H378
Instructions.OnsetSignalData = 0
This step consists in setting to 0 all parallel port pins in order to be sure to start from an initial zero level. TTLbase = 1
We define a TTLbase variable using the bit 1 which codes the presence of a trial (general convention)see Trigger definition section VisualTTL = TTLbase + 2*1 + 4*0 (visual stimulus but not audio)
AudioTTL = TTLbase + 2*0 + 4*1 (audio stimulus but not visual)
VisualTTL is coded on the bit 2: its value eaquals to 0 if there is no visual stimuli, 1 if there is a visual stimuli. Sound TTL is coded on the bit 3: its value equals to 0 if there is no audio stimuli, 1 if there is a audio stimuli Visual.OnsetSignalEnabled = True
Visual.OnsetSignalPort = &H378
Visual.OnsetSignalData = VisualTTL
Audio.OnsetSignalEnabled = True
Audio.OnsetSignalPort = &H378
Audio.OnsetSignalData = AudioTTL
These two paragraphs are used to send the corresponding TTL value defined above each time that the corresponding stimulus is played. Also, take care, after each trial, to set to 0 the parallel port pins by adding "WritePort, &H378, 0" after each stimulation. For example, when you put a sound object in your e-prime tree (for audio stimulation), place an in line code named "writeport 0" and containing the previous script line, just after your sound object. How to get the subject's responses in e-prime?Responses will be given by the subjects by using the 10 buttons fORP system. Because e-prime can only use four input pins on the parallel port to get the subject's responses, three parallel ports have been installed on the stim computer, in order to have 12 available input pins. All connections are already done between Elekta trigger unit box and the stim computer. Don't change anything, please! Thus, ten buttons lines are systematically available. And whatever you need as buttons for responses in your experiment, you will have them. All connections are labelled to make easier the checking. In your e-prime script, you can define three ports (in the device sheet of the experiment object properties window). For each port, you will set the following port addresses:
As you can see, the parallel port address for the first one is not &H378 ! Indeed, here is the parallel port address on which e prime will receive TTL signal to get the subject's responses. E-prime will attribute values 4, 5, 6 and 7 to each input pin, and unfortunately, for each parallel port, according to this table. Thus, be careful, if you use several buttons which have the same value in e-prime (see the table), you will have to insert an in line code to modify these values in order to avoid to have the same value for two different response buttons. Recommendations:Add only the parallel port(s) that you will use in your e-prime script and not systematically the three ones ! This should cause some bugs in your e-prime script. If your experiment doesn't need imperatively that you use buttons corresponding to left pinky and ringer (see the table), avoid to use these ones. It is recommended to use at first the right handler buttons and if necessary, to complete with the left ones plugged on the lines 9, 10 and 11. This will avoid all confusions between TTL signal related to the stimulus (sent on lines 1 to 8) and TTL related to the subject's response from the buttons plugged on the lines 7 and 8 ! If you absolutely need to use theses buttons, contact me. If you need left and right responses in your experiment, you can use two different buttons on the right handle or the left and right thumb buttons, corresponding to bit 16 and bit 11. So, you will not have confusions between TTL signal related to your stimuli and TTL signal related to your subject's responses. |