This article applies to:
E-Prime 3.0
E-Prime 2.0
E-Prime 1.x
Detail
NOTE: This article contains information specific to step #3 from INFO: How do I send a marker to an external device? [42521] when using the Parallel Port to send markers. For details about sending markers using other devices, see the links at the bottom of this article.
General Information
The original IBM-PC's Parallel Printer Port had a total of 12 digital outputs, 5 digital inputs accessed via 3 consecutive 8-bit ports in the processor's I/O space. E-Prime sends data to the Parallel Port on output pins 2-9.
- 8 output pins accessed via the DATA Port
- 5 input pins (one inverted) accessed via the STATUS Port
- 4 output pins (three inverted) accessed via the CONTROL Port
- The remaining 8 pins are grounded
Most Parallel Ports or PCI cards today support bi-directional communications and can detect which is needed automatically. E-Prime is capable of both sending and receiving markers through the Parallel Port, though not simultaneously. There are no special configurations needed to achieve both sending and receiving markers in the same experiment. However, it may be helpful to add 2 Parallel Port devices to an experiment named differently but otherwise with identical properties. For example, one to denote outgoing markers and another to denote incoming markers.
Markers are typically sent through the output pins numbered 2-9. The states of these pins can be thought of as logic high (typically +5V) or logic low (typically 0V). The receiving device then reads the state of the pins and interprets the value that was sent. Each unique combination of high and low pins results in a unique marker being sent. When specifying a marker value, it is translated into binary notation which represents a specific bit pattern. For more detailed information on choosing a marker value to specify, please see INFO: Choosing a marker value to send from E-Prime to an external device [42529].
When communicating through the Parallel Port, the bit pattern that results from the marker value corresponds to the pins of the Parallel Port shown below.
Pin | Bit Number |
2 | 0 |
3 | 1 |
4 | 2 |
5 | 3 |
6 | 4 |
7 | 5 |
8 | 6 |
9 | 7 |
Depending on how many unique markers a given experiment requires, as well as the requirements of the receiving device, individual pins can be manipulated one at a time or multiple pins can be manipulated simultaneously. The receipt and handling of the marker by the receiving device/software is the responsibility of the user.
Steps to configure Task Events in E-Prime to send a marker through the Parallel Port
- Ensure that the Parallel Port Device is added to the experiment and configured correctly. Please refer to DEVICE: Parallel Port Device [17150].
- Choose an Event at which to send a marker such as a particular object's .OnsetTime. Open the desired object's properties, navigate to the Task Events tab, and add the event.
- After adding an Event, set the Task Name to Parallel Port as this is the device the marker will be sent through.
- Identify which value to send (INFO: Choosing a marker value to send from E-Prime to an external device [42529]). It is also important to keep in mind how these pins are physically wired to the receiving device and what marker will result when manipulating specific inputs.
- Select the desired method ("Action") to send the value.
- Set the Custom field to the value to be sent. This field can also accept Attribute references.
- Set the Data Type as appropriate for the specified Action.
Below are specific examples of how to configure Task Events to send a marker through the Parallel Port.
To manipulate a single pin at a time, bit specific methods can be used to specify which individual bit/pin will be set logic high or logic low. For example, the value specified in the Custom field will reflect the bit number itself. Examples are shown below.
Action = SetBit | |
Goal | Change a bit from low to high |
Set Custom Field To | The zero-based bit number to be set high |
Set Data Type Field To | Integer |
Example | |
Notes | This specific example shows pin 3 of the Parallel Port being set high |
Action = ResetBit | |
Goal | Change a bit from high to low |
Set Custom Field To | The zero-based bit number to be set low |
Set Data Type Field To | Integer |
Example | |
Notes | This specific example shows pin 3 of the Parallel Port being set low |
Action = ToggleBit | |
Goal | Toggle the state of the specified bit |
Set Custom Field To | The zero-based bit number to be toggled |
Set Data Type Field To | Integer |
Example | |
Notes | • This specific example shows pin 3 of the Parallel Port being toggled. • If the state of the specified bit was previously high, it is set to low. • If the state of the specified bit was previously low, it is set to high. |
To manipulate multiple pins simultaneously, the WriteByte method must be used as shown below.
Action = WriteByte | |
Goal | Set 1 or multiple bits high simultaneously |
Set Custom Field To | The byte value to be sent |
Set Data Type Field To | Byte |
Example | |
Notes | This specific example shows pins 2 and 9 of the Parallel Port being set high simultaneously while pins 3-8 remain low. |
NOTE: Specifying 0 in the Custom field when using WriteByte will set all pins low.
NOTE: The WriteByte method can be used to manipulate a single pin or multiple pins simultaneously. If the experiment requires manipulating both individual and multiple pins at different points, PST recommends using the WriteByte method consistently throughout the experiment as opposed to calling a combination of bit specific methods and the WriteByte method to mitigate incorrect markers being sent.
Lastly, it is vital that all pins that are set high are set low prior to setting them high again. This is also referred to as 'clearing the port'. If this is not done, this can lead to missing, incorrect, or duplicate markers. For example, if only pin 2 is being manipulated, if pin 2 was set high during the first trial and then a Task Event fires that sets pin 2 high on the second trial, the event will yield no change and likely appear in the receiving device's software that no marker came through at the time of the second trial.
In general, markers must be at least 1 sample period long. In most cases, a period of 10 milliseconds is long enough before clearing the port and sending another marker. If you do not wait for a sample period, this can also lead to missing, incorrect, or duplicate markers.
Therefore, when sending a marker, a pair of Task Events must be used for each marker that is sent, one to set the pin(s) high and a delayed Task Event to clear the port before sending the next marker.
The image below illustrates 2 Task Events that result in sending a marker at Stimulus.OnsetTime and clearing the port 10 milliseconds later using the SetBit and Reset Bit methods. The first one sets a single pin (pin 3) high at Stimulus.OnsetTime. The second one sets pin 3 low, 10 milliseconds after Stimulus.OnsetTime as specified in the Delay field.
The image below illustrates 2 Task Events that result in sending a marker at Stimulus.OnsetTime and clearing the port 10 milliseconds later using the WriteByte method. The first one sets pins 2 and 9 high at Stimulus.OnsetTime by sending a value of 129. The second one sets all pins low by sending a value of 0, 10 milliseconds after Stimulus.OnsetTime as specified in the Delay field.
The information above focuses on using Task Events to send markers. Note that Task Events are not available in E-Prime Professional 2.0.8.x or prior. Task Events are also not available for any versions of E-Prime 2.0 Standard edition. If you are not able to use Task Events to send markers through the Parallel Port or your experiment requires custom Inline script to do so, please see INFO: Legacy Methods to Send Markers to an External Device [17212].
See Also:
E-STUDIO: Using Task Events [22862]
Conditional Trigger (Task Events) [29972]
RELEASE INFO: E-Prime 2.0 Change History (2.0.8.90 to 2.0.10.182) [19388]
INFO: How do I receive a marker in E-Prime from an external device? [42530]
Comments
1 comment
Thank you. We appreciate you voting and writing feedback. We will do our best to improve your experience
You wrote:
“fix the links in it ”
Please sign in to leave a comment.