From MEG Wiki
Jump to navigation Jump to search

Using E-Prime

Using E-Prime on one of the machines in the Lab can be tricky. When you are designing your experiment, you will probably have to check to see if the computer you are using for Stimuli presentation is running the same E-Prime version that you are testing/building your experiment in.

MEG Machine

The MEG presentation computer has the E-Prime version 1 installed. When you are building your experiment in the Lab area, you can contact Travis Williams to setup the Virtual Machine(VirtualBox) to link to the WindowsXP machine on your work station. You can then create, test and edit your experiment at your own office space! It is very convenient.

Designing your experiment

Reference Guide

There are some E-Prime Reference guides in the Lab. Contact Candida Jane Maria Ustine if you would like to have a look at them. They are very useful if you are new to E-Prime. Trust me!!

Common problems and solutions

There is an online web support page for common problems and their solutions. Please follow the link HERE

Some additional problems that can be encountered are listed below with instructions on how to solve them.

1) It says, "sound device is set not to open"

  • Double-click on the Experiment Object Icon in the Structure Window and a properties window should pop up
  • Then click on the Devices tab near the top
  • There should be a Sound Option - Make sure that it is checked (If it is not there, select Add and add the Sound Device).
  • Now, click on the Sound Option to highlight it and click Edit (option at the bottom of the screen)
  • An "Edit SoundDeviceObject Properties" Window should now pop up...make sure the following values are there:
  • Channels: 2
  • Samples: 44100
  • Bits Per Sample: 16

NOTE: Check your wave file to see if you can generate a specific tone with a desired frequency. See Stimuli Presentation Scripts for the generate_tones.m script that can create mono tones with the desired sampling frequency.

Triggering in E-Prime

When using Eprime to present your stimuli in the MEG you will have to do the following:
1) Add the Port to the Experiment Devices
2) Insert specific Inline object codes telling the script when to send triggers to the Machine.


Read here about the three ways to send triggers to the MEG.

STEP1: Add Port Device

  • Go to Edit --> Experiment --> Devices Tab
  • Click on the Add device button and select Port device.
  • Select the Port device you have added and click on the Edit button


  • Choose the settings you see in the picture above.
    • Collection Mode: Presses Only
    • Address: &H379
    • Size: 8
    • Invert: No
    • Mask: -1
    • Emulate Device: None (Unless you are testing this on your computer then choose keyboard or Mouse)

STEP2: InLine Code

This set of script lines are inserted wherever you would like to send triggers to the MEG machine.

Initialising MEG communication

Before you start sending triggers to the machine ie., before you start the actual experiment you will have to initialise the MEG communication. ResetMEGTrigger.jpeg

Insert a similar code to the beginning of your experiment. The WritePort command will send the port address the value of 0, in other words resets the port.

Sending MEG Triggers

This is the part when you send the MEG triggers to the MEG machine when an event happens. For example: Stimulus Onset or Key Response. Sending MEG Triggers

Note that in this experiment the triggers that the Experiment must send the MEG machine is coded along with the trials. And so they are easily referenced in the in line code.

Encoding Responses

When you have a task that requires the subject to press a button in the MEG then you will have to edit the properties of the Stimulus object so that the exact triggers are sent to the MEG system when the subject presses a button. You will also have to edit the Properties of your Stimulus object and add the Port as a device of response. You will also have to include another column in your trial list specifying the correct answers codes for the response pads in the MEG system. MEGPortDuration.jpeg

You can have E-Prime code the button presses with an additional trigger which also gets stamped into the MEG output file. In this case, you will ne alerting E-Prime that you’d like all button presses to be referenced as a specific trigger number. Look at the Properties window for SoundOut1. Here you can let E-Prime know that it should look for responses from the Port device, and that the responses it should be looking for are numbered 7 and 8 (see ‘Allowable’). 7 is the left button and 8 is the right button.
Your triggers from the response will always be 7 and 8 because these are the channels used for button responses by the MEG Trigger Box.

Encoding Responses: Inline code

If you would like to send a trigger when the subject has pressed a button then you can use the following inline object script.

Syntax: WritePort address value 
Example: WritePort &H378,SoundOut1.RESP

Links to more Info on Triggers and Ports

See Pstnet FAQ page for more information.

See Pstnet Parallel Port Info for information on parallel port i/o.