This is a question that pops by every now and then on the E-groups, pardon GoogleGroups, E-Prime mailinglist. How do you communicate with an EEG amplifier or other such equipment? In this short tutorial, I will explain how to use Task Events to send triggers via the parallel port. I will expect you to have at least E-Prime 126.96.36.199 and an EEG amplifier that is connected via the parallel port (this includes BrainProducts and BioSemi equipment).
1. Go to Edit > Experiment > Devices and add a parallel port. Check the properties. Most of the defaults are fine, but the address of the port needs to be addressed (sorry). It is LPT 1 by default.
2. Find out whether this is correct. In Windows, go to Start, type Device Manager, and hit enter. Even if you don’t have admin rights (like myself, grr!), you can still see what the address of the printer port is:
Look under Ports, and find the one that has some sort of printer indication. It seems to be ECP Printer Port (LPT1) for me.
So that works.
3. Now in E-Prime, go to whatever object you would like to coincide with the trigger. Usually, there is some sort of Target stimulus. Here, I have “CharitySlideInfo” in an ultimatum game, and I would like it to send a trigger saying which slide it is (a number 101-199) that is presented. This info is saved under the CharityNum attribute. To make it happen, go to the Task Events tab, click on Add, and use the .OnsetTime as the relevant moment the trigger is to be sent.
4. Now the event is defined, we add a method to it: AT CharitySlide onset, DO Write a byte (.WriteByte) to the ParallelPort. So we use the WriteByte method of the ParallelPort. The source can be left to custom, because we want to send [CharityNum] as a trigger. This type of data is a byte (values 0-255, because the parallelport cannot handle anything more than that!).
5. So this should work. But unfortunately, it’s not always clear whether the port is reset to 0, such that the triggers may overlap (a good explanation can be found in the E-Primer), leading to weird errors. Accordingly, it is often better to be sure that the port is reset to its regular state 0. A trick (source) is to add another Task Event that is exactly the same, but has a value of 0 (thus resetting it) and a delay of some small value (e.g. 20). Thus, the EEG amplifier should receive the [CharityNum] value at onset time, and be reset after 20 ms, such that the next event is properly received.
5. Test it. Most amplifiers come with some sort of software that allows you to view the data in real time (or of course, look at the triggers later on). I created a little E-Prime test that uses the Task Events to send a trigger every stimulus onset, with only a single stimulus of 490 ms in duration (but with onset sync, so should be 500 ms given that my screen is 60 Hz). Another Task Event is set to send a trigger of 0, 250 ms after the onset time of the stimulus. ActiView shows this works OK:
Notice the red blocks: the .onsettime to .onsettime was (slightly less than) 500 ms, and the trigger (69) was set successfully to 0 before onset of the next trigger (70).
You can use the mini program I used for this to check out how it works by downloading it from here.