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 Socket 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 Socket as packets of information. A Socket device can be thought of as an ethernet connection or WiFi. The methods for sending markers through a Socket are similar to the methods for sending markers through the Serial Port. However, the protocol used to send markers is very different. E-Prime allows you to choose between TCP and UDP transmissions. For detailed information on both transmission modes, please refer to DEVICE: Socket Device supports TCP and UDP communication [16877].
Like the Serial Port, the Socket supports a wider range of communication options than the Parallel Port.
Socket communication can be thought of in terms of a server-client relationship where E-Prime acts as the client, sending information to the server. When sending markers via Socket, the endpoint or the IP address plus the port number the information is being sent to must be known and configured in the Socket Device in E-Prime's Experiment Object Properties. When using Socket communication, PST recommends against using well known port numbers (ports 0-1023) and recommends instead using a registered port number (ports 1024-49151).
Steps to configure Task Events in E-Prime to send a marker through the Socket
- Ensure that the Socket Device is added to the experiment and configured correctly. Please refer to DEVICE: Socket Device [26069].
- 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 Socket 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 what marker will result when sending a specific value.
- 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 Socket.
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 socket |
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 socket |
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 socket |
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 socket |
Set Custom Field To | A Hex String of the values to be sent |
Set Data Type Field To | String |
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, 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 Socket 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:
Using a Socket to send and receive TCP/UDP communication [42528]
E-STUDIO: Using Task Events [22862]
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.