This article applies to:
E-Prime 3.0
E-Prime 2.0
E-Prime 1.x
Detail
Markers can be sent from an external device to a running E-Prime experiment via a wired connection to Chronos, a parallel port, serial port, or a socket. In order for the experiment to receive the signal, the appropriate device must be added to the experiment (since none of these devices are included by default) and the device may also need to be configured. For example, a port address must be specified for the parallel, serial, and socket devices. See the device of interest below for details on how to add and configure the device:
- DEVICE: Chronos as a Response Device [24491]
- DEVICE: Parallel Port Device [17150]
- DEVICE: Serial Device [17355]
- DEVICE: Socket Device [26069]
The remainder of this article describes how to receive markers from each of the devices listed above.
Chronos
To receive a digital marker sent to the Chronos device, PST recommends creating a Chronos InputMask in the Duration/Input properties of an object. Chronos generates a pseudo button response when the digital marker value is received, and then the InputMask processes the response. This is similar to how a Keyboard InputMask processes a keyboard response. The specific Chronos pseudo button response generated is determined by which of its 16 digital inputs receives the digital marker signal. See the Responses tab of the Chronos Device properties for a mapping of which digital inputs correspond to which Chronos responses. For example, a marker that sets Digital In 1 high produces a Chronos pseudo button response on Button 1 (response = 1); a marker that resets Digital In 1 low produces a release of Button 1 (response = {-1}). As another example, a marker that sets Digital In 16 high produces a Chronos pseudo button response of G (response = G); a marker that resets Digital In 16 low produces a release of the pseudo button G (response = {-G}). For more information and a chart illustrating the different pseudo button responses that Chronos generates in response to digital inputs, please refer to DEVICE: How To: Synchronize E-Prime with an incoming marker/press via an Input Mask [34380].
The marker sent to Chronos and processed by the InputMask as well as the response time when that marker was received can be logged in the data file. To do so, set the Logging properties of the E-Object containing the InputMask to log the responses of interest (see the Logging properties on the Duration/Input tab and the Logging tab on the E-Object).
NOTE: If more than one digital input is set simultaneously by the received marker value, then the InputMask's Max Count property (Duration/Input tab > Advanced) needs to be increased from its default value of 1 in order to collect a pseudo button response from each Digital Input being manipulated. If pseudo button releases are to be collected in addition to button presses, then the Collection Mode must be set in the Chronos Device properties, the Chronos InputMask must have its Allowable property specify both presses and releases of the buttons of interest, and Max Count must be set to a value > 1.
Digital markers sent to Chronos can also be identified with E-Basic script instead of with an InputMask. The Inline Script methods available to read digital markers from Chronos are as follows:
- Chronos.DigitalIn.ReadBit
- Chronos.DigitalIn.ReadByte
- Chronos.DigitalIn.ReadInteger
An example is shown below:
Dim ChronosMarkerInput As Integer
ChronosMarkerInput = Chronos.DigitalIn.ReadInteger
The example above assumes that the incoming marker(s) is an integer value. It is important to keep in mind what type of markers are going to be received from the external device in order to use the appropriate method to receive the marker. For information on other Chronos DigitalIn methods, refer to the methods under the ChronosDigitalIn (Object) topic in the E-Prime Command Reference.
NOTE: When possible, PST recommends receiving digital markers through Chronos Digital Inputs 7 and 8 only since these are the only digital inputs that are reserved solely for digital input and do not overlap with other possible Chronos responses.
Chronos can also recognize analog signals by calling the Chronos AnalogInRecord Task Event. Please refer to Section 6.5 of the Chronos Operator Manual (RELEASE INFO: Chronos Version 3.0.0.0 Released [30928]) and DEVICE: Chronos and Triggers [24492] for details.
Parallel Port
To receive a digital marker sent to the ParallelPort device, PST recommends creating a ParallelPort InputMask in the Duration/Input properties of an object. E-Prime processes a ParallelPort response based on which pin(s) are set high. Refer to the following diagram:
There are 5 input pins: 10-13 and pin 15. All input pins use normal logic except for pin 11 which is reverse logic. Each input pin maps to a Status pin that has its own value as shown in the diagram (S#). The response value returned by the ParallelPort Input mask is the Status pin number plus 1. For example, if pin number 10 is set high, a response of 7 (6 + 1) is received. If pin number 10 is set low, a response of {-7} is created. If all input pins were being used, the expected response values are 4-8. For more information, please refer to DEVICE: How To: Synchronize E-Prime with an incoming marker/press via an Input Mask [34380].
The marker sent to ParallelPort and processed by the InputMask as well as the response time when that marker was received can be logged in the data file. To do so, set the Logging properties of the E-Object containing the InputMask to kog the responses of interest (see the Logging properties on the Duration/Input tab and the Logging tab on the E-Object).
NOTE: If more than one digital input is set simultaneously when the marker is received, then the InputMask's Max Count property (Duration/Input tab > Advanced) needs to be increased from its default value of 1 in order to collect a response from each Digital Input being manipulated. In response releases are to be collected in addition to presses, then the Collection Mode must be set in the ParallelPort Device properties, the ParallelPort InputMask must have its Allowable property specify both presses and releases, and Max Count must be set to a value greater than 1.
Digital markers sent to parallel port can also be identified with E-Basic script instead of with an InputMask using the ReadCurrentByte method. An example is shown below:
Dim ParallelInput As Integer
ParallelInput = ParallelPort.ReadCurrentByte()
This method returns an integer value representing which bits are set high.
Serial Port
To receive markers in E-Prime via a Serial Port, E-Basic script must be used. The methods available to read from a Serial Device are as follows:
- Serial.ReadByte
- Serial.ReadBytes
- Serial.ReadInteger
- Serial.ReadLong
- Serial.ReadString
An example is shown below:
Dim nData As Integer
Dim nRead As Long
nRead = Serial.ReadByte(nData)
The example above assumes that the incoming marker(s) is an integer value that can be represented as a byte. The variable nRead represents the number of bytes that are read from the Serial Device's Input queue. The variable nData represents the integer value of the Byte read. It is important to keep in mind what type of markers are going to be received from the external device in order to call the appropriate method. For information on other methods to read the incoming Serial markers, refer to the methods under the SerialDevice (Object) topic in the E-Prime Command Reference.
Socket
To receive markers in E-Prime via a Socket Device, E-Basic script must be used. The methods available to read from a Socket Device are as follows:
- Socket.ReadByte
- Socket.ReadBytes
- Socket.ReadInteger
- Socket.ReadLong
- Socket.ReadString
An example is shown below:
Dim nData As Integer
Dim nRead As Long
nRead = Socket.ReadByte(nData)
The example above assumes that the incoming marker(s) is of the data type Byte. The variable nRead represents the number of bytes that are read from the Socket Device's Input queue. The variable nData represents the integer value of the Byte read. It is important to keep in mind what type of markers are going to be received from the external device in order to call the appropriate method. For information on other methods to read the incoming Socket markers, refer to the methods under the SocketDevice (Object) topic in the E-Prime Command Reference.
See Also:
INFO: How do I send a marker to an external device? [42521]
Comments
0 comments
Please sign in to leave a comment.