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 Serial Port to send markers. For details about sending markers using other devices, see the links at the bottom of this article.
General Information
E-Prime supports sending and receiving markers through a Serial Port using the RS232 protocol. Unlike a Parallel Port that can manipulate one or multiple bits at a time, markers are sent through the Serial Port and the bits of information are sent in sequential or 'serial' order on a single pin of the Serial Port. The Serial port also supports a wider range of communication options than the Parallel Port.
The first important thing to keep in mind when identifying a port as a Serial Port is that Serial Ports often come in a variety of shapes and sizes. Two common examples are a DB-9 which has 9 pins and a DB-25 which has 25 pins. Even though these configurations differ, they are still capable of sending the same markers. A diagram and pin mapping for each is shown below. Not to confuse a DB-25 Serial cable with a DB-25 Parallel Port cable, Serial cables typically have a male end.
DB9 | Pin | DB25 |
Carrier Detected (CD) | 1 | Ground |
Receive Data (RxD) | 2 | Transmit Data (TxD) |
Transmit Data (TxD) | 3 | Receive Data (RxD) |
Data Terminal Ready (DTR) | 4 | Request to Send (RTS) |
Ground | 5 | Clear to Send (CTS) |
Data Set Ready (DSR) | 6 | Data Set Ready (DSR) |
Request to Send (RTS) | 7 | Signal Ground |
Clear to Send (CTS) | 8 | Data Carrier Detect (DCD) |
Ring Indicator (RI) | 9 | Reserved |
10 | Reserved | |
11 | Unassigned | |
12 | Secondary DCD | |
13 | Secondary CTS | |
14 | Secondary TxD | |
15 | Transmit Clock | |
16 | Secondary RxD | |
17 | Receiver Clock | |
18 | Local Loopback | |
19 | Secondary RTS | |
20 | Data Terminal Ready (DTR) | |
21 | Remote Loopback | |
22 | Ring Indicator (RI) | |
23 | Data Rate Detect | |
24 | Transmit Clock | |
25 | Test Mode |
Markers are sent via the Transmit Data (TxD) pin and received on the Receive Data (RxD) pin. A null modem may be necessary in order to properly send data from the TxD to the RxD and vice versa. Other pins of the Serial Port help to control the flow of data.
Steps to configure Task Events in E-Prime to send a marker through the Serial Port
- Ensure that the Serial Device is added to the experiment and configured correctly. Please refer to DEVICE: Serial Device [17355].
- 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 Serial 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 Serial Port.
Action = WriteString | |
Goal | Send a literal string |
Set Custom Field To | Desired string value |
Set Data Type Field To | String |
Example | |
Notes | This specific example sends the string "Hello World" |
Action = WriteLong | |
Goal | Send 4 bytes of information through the serial port |
Set Custom Field To | Desired Long value |
Set Data Type Field To | Long |
Example | |
Notes | This specific example sends a value of 2147483647 |
Action = WriteInteger | |
Goal | Send 2 bytes of information through the serial port |
Set Custom Field To | Desired Integer value |
Set Data Type Field To | Integer |
Example | |
Notes | This specific example sends a value of 32767 |
Action = WriteByte | |
Goal | Send 1 byte of information through the serial port |
Set Custom Field To | The byte value to be sent |
Set Data Type Field To | Byte |
Example | |
Notes | This specific example sends a value of 1 |
Action = WriteBytes | |
Goal | Send an array of bytes through the serial port |
Set Custom Field To | A Hex String of the values to be sent |
Set Data Type Field To | String (Hexadecimal) |
Example | |
Notes | This Task Event will send the value as an array of byte values. The Integer (decimal) values that will be sent are 255 and 17. |
In general, unless the Serial port is being used to generate a TTL pulse, there is no need to clear the port before sending a subsequent marker.
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 Serial 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]
Serial Port Communications [30062]
INFO: How do I receive a marker in E-Prime from an external device? [42530]
Comments
0 comments
Please sign in to leave a comment.