E-prime Code for Synchronization


Archives

Using The Parallel Port for TTL output

' Put this part early in the ebs script:
' -------------------------------------------------------------------------
' User Script
' -------------------------------------------------------------------------

Const BASEADDRESS = 888
' (Verify the Parallet port's address in the control panel first)

Const ON_Trigger = 255
Const OFF_Trigger = 0

''''''''''''''''''''
' Put this in an inLine to turn it ON
WritePort BASEADDRESS, ON_Trigger

''''''''''''''''''''
'Use this to turn it OFF
WritePort BASEADDRESS, OFF_Trigger

Top

Serial Communication with ViewPoint

' E-prime inLine code for Sending time markers to Viewpoint Eyetracker through
' a null-modem serial cable
'
' written by Luis Hernandez-Garcia at U-M
' with help from Valur Olafsson and Arrington Tech.
'
' You need the following to synch. e-prime with ViewPoint:
' - a null modem (cross-over) serial cable from COM port IFIS to COM port on Viewpoint
' - this code inserted as two inLines in the e-prime script
' - On viewPoint: Interface | Serial port | Connection Settings :
' verify that the settings is consistent with what's in this code:
' baud rate, parity, stop-bits, ....etc. You can modify the settings,
' just make sure both machines are running the same serial protocol
' - Interface | Serial Port | Reset Packet Counter
'
' When this is all done, you
' are ready to open a new file on VIewPoint
' (note that this can also be done
' through serial port commands)
' and run your e-prime script.
'
' Note:
' - This code doesn't work on ViewPoint 2.7.1.1
' (you have to send full command strings for that), but has been
' successfully tested in ViewPoint 2.7.1.95 (beta?)
'

'''''''''''''''Begin Code

' Do this section before the block starts (before RF trigger):
' This is is the Packet that we'll send to ViewPoint:
const header as string = "VP"
Dim headerBytes(1) As Integer
headerBytes(0) = 2 ' This specifies the type of string (2=Marker)
headerBytes(1) = 1 ' This specifies the number of bytes
const commandString as string = "M" 'This is the string


' initialize the serial port by creating a
' serialdevice object and setting its properties
dim myPort as SerialDevice
Set myPort = New SerialDevice
dim myPortInfo as SerialDeviceInfo
myPortInfo.CommPort = 2
myPortInfo.BaudRate = 57600
myPortInfo.DataBits = 8
myPortInfo.Parity = ebParityNo
myPortInfo.StopBits = ebStopBits1_0

'Open the port and flush the buffer
myPort.open myPortInfo
myPort.FlushOutBuffer

' End section...Port is now ready to send the packet
''''''''''''''''''''''''''''''''''''''''''''''''''''

' Put the section below as an inLine wherever you want the marker

' Write the packet itself
myPort.WriteString header 'Header string
myPort.WriteBytes headerBytes,2 'header bytes
myPort.WriteString commandString ' string
myPort.WriteString chr$(0) 'Null terminator on the string
myPort.FlushOutBuffer

' close the port and clear the object when you are finished
' (when the last packet has been sent)
myPort.close
Set myPort = Nothing
''''''''''''''''''''''''''''''''

Top