Eprime - task event calling attribute - Cedrus StimTracker

44 views
Skip to first unread message

Jen2368

unread,
Nov 5, 2021, 2:12:39 AM11/5/21
to E-Prime
Hi there,
New to Eprime and any help would be super appreciated. I am trying to send task events in eprime using a Cedrus stimtracker.
Despite setting the task event up as should be (task name: serial, action:write string, source: custom, custome: [code], data type: strong), I don't seem to get the task events to send data corresponding to the attribute [code]. Instead I appear to be getting random numbers. I saw it suggested that you should put mh[code]0 in the custom box, but to be honest I have no idea why, and although this sends triggers with set numbers (e.g., 50), all triggers have the same number, which doesn't correspond to my [code] attribute.
I've put this in my user tab which was sourced from the Cedrus helppages (https://cedrus.com/support/stimtracker/tn1911_eprime.htm):

' This function should be placed in the 'User' script area.
' View >> Script >> [choose 'User' tab]
Sub PulseStimTracker( lineSettings As Integer, millisecondsDuration As Integer )
Dim bytesThatMakePulseConfigCommand(5) As Integer
Dim bytesToRaiseStimTrackerLines(3) As Integer
millisecondsDuration = 10
'Here is where we construct the byte sequence
'that forms a StimTracker Event Marker command.
bytesThatMakePulseConfigCommand(0) = 109 ' ascii m
bytesThatMakePulseConfigCommand(1) = 112 ' ascii p
bytesThatMakePulseConfigCommand(2) = millisecondsDuration
bytesThatMakePulseConfigCommand(3) = 0
bytesThatMakePulseConfigCommand(4) = 0
bytesThatMakePulseConfigCommand(5) = 0
'(E-Studio generates the following script when the serial device is
'added to the experiment: Dim Serial As SerialDevice).
'Send the command to StimTracker!
Serial.WriteBytes bytesThatMakePulseConfigCommand
'Make the command to zero out (clear) all lines
bytesToRaiseStimTrackerLines(0) = 109 ' ascii m
bytesToRaiseStimTrackerLines(1) = 104 ' ascii h
bytesToRaiseStimTrackerLines(2) = lineSettings
bytesToRaiseStimTrackerLines(3) = 0 ' this final byte is currently ignored by StimTracker
Serial.WriteBytes bytesToRaiseStimTrackerLines
End Sub
_____
The issue is, I have no idea what bytesThatMakePulseConfigCommand 0-5 and bytesToRaiseStimTrackerLines 0-3 are doing. I have searched for this in the Cedrus website but their help pages seem very concise and technical. I understand vaguely that the value after bytesThatMakePulseConfigCommand 0 & 1 is related to the serial address, but apart from that I'm pretty lost.
Any thoughts/insight/reading suggestions would be super appreciated!


David McFarlane

unread,
Nov 5, 2021, 10:39:09 AM11/5/21
to e-p...@googlegroups.com
Indeed, making this work will take understanding more background
computer concepts (arrays, ASCII, byte masks, hexadecimal) than I care
to go into in this forum. If you can get your hands on an "E-Prime
User's Guide" then I suggest that you start with the chapter on "Using
E-Basic". Also, purchase "The E-Primer" and work through that. You
might also try the Wikipedia article on ASCII.

A few thoughts for now though ...

- bytesThatMakePulseConfigCommand is an array of 5 integers.

- The E-Basic code at that Cedrus page is not properly indented, making
it harder to read. The missing indentation may well result from web
browsers injudiciously eliminating leading spaces -- by contrast, the
E-Prime screen shot on that page does show proper indentation. You
should fix the indentation for yourself.

- The line
millisecondsDuration = 10
does not appear in the original code from Cedrus. This line defeats the
purpose of passing millisecondsDuration as an argument to the subroutine.

- In Task Events, it looks like WriteBytes still wants to use text
strings instead of integer arrays. You might have to set Data Type to
"String (hexadecimal)" and then submit your data using hexadecimal
notation, but I have no way to test that here. Alternatively, if you
have E-Prime 3 you might use a Script Task Event, which should work with
the subroutine provided by Cedrus.

-- David McFarlane


On 2021-11-05 Fri 2:12 AM, Jen2368 wrote:
> Hi there,
> New to Eprime and any help would be super appreciated. I am trying to
> send task events in eprime using a Cedrus stimtracker.
> Despite setting the task event up as should be (task name: serial,
> action:write string, source: custom, custome: [code], data type:
> strong), I don't seem to get the task events to send data corresponding
> to the attribute [code]. Instead I appear to be getting random numbers.
> I saw it suggested that you should put mh[code]0 in the custom box, but
> to be honest I have no idea why, and although this sends triggers with
> set numbers (e.g., 50), all triggers have the same number, which doesn't
> correspond to my [code] attribute.
> I've put this in my user tab which was sourced from the Cedrus helppages
> (https://cedrus.com/support/stimtracker/tn1911_eprime.htm
> <https://urldefense.com/v3/__https://www.researchgate.net/deref/https*3A*2F*2Fcedrus.com*2Fsupport*2Fstimtracker*2Ftn1911_eprime.htm__;JSUlJSUl!!HXCxUKc!gs1q0OfDeht9no-SOp1qzY8YocwwMQLTUnzT4Tm_5KAFgHtGhTxrrvErOdl09zmE$>):
>
> ' This function should be placed in the 'User' script area.
> ' View >> Script >> [choose 'User' tab]
> Sub PulseStimTracker( lineSettings As Integer, millisecondsDuration As
> Integer )
> Dim bytesThatMakePulseConfigCommand(5) As Integer
> Dim bytesToRaiseStimTrackerLines(3) As Integer
> millisecondsDuration = 10
> 'Here is where we construct the byte sequence
> 'that forms a StimTracker Event Marker command.
> '(Refer to http://cedrus.com/support/stimtracker/tn1450_st_commands.htm
> <https://urldefense.com/v3/__https://www.researchgate.net/deref/http*3A*2F*2Fcedrus.com*2Fsupport*2Fstimtracker*2Ftn1450_st_commands.htm__;JSUlJSUl!!HXCxUKc!gs1q0OfDeht9no-SOp1qzY8YocwwMQLTUnzT4Tm_5KAFgHtGhTxrrvErOTzxHyhT$>)

David McFarlane

unread,
Nov 5, 2021, 10:58:45 AM11/5/21
to e-p...@googlegroups.com
Oops, correction: bytesThatMakePulseConfigCommand is an array of 6 (not
5) integers. For that matter, bytesToRaiseStimTrackerLines is an array
of 4 integers.

-- David McFarlane
>> (https://urldefense.com/v3/__https://cedrus.com/support/stimtracker/tn1911_eprime.htm__;!!HXCxUKc!k_FRLWwij4MCN37Oqf8ddYpdatJwE5gBafer9q_hD5JhUQ_32GmrzgBgTGX72IJZ$
>> <https://urldefense.com/v3/__https://www.researchgate.net/deref/https*3A*2F*2Fcedrus.com*2Fsupport*2Fstimtracker*2Ftn1911_eprime.htm__;JSUlJSUl!!HXCxUKc!gs1q0OfDeht9no-SOp1qzY8YocwwMQLTUnzT4Tm_5KAFgHtGhTxrrvErOdl09zmE$>):
>>
>>
>> ' This function should be placed in the 'User' script area.
>> ' View >> Script >> [choose 'User' tab]
>> Sub PulseStimTracker( lineSettings As Integer, millisecondsDuration As
>> Integer )
>> Dim bytesThatMakePulseConfigCommand(5) As Integer
>> Dim bytesToRaiseStimTrackerLines(3) As Integer
>> millisecondsDuration = 10
>> 'Here is where we construct the byte sequence
>> 'that forms a StimTracker Event Marker command.
>> '(Refer to
>> https://urldefense.com/v3/__http://cedrus.com/support/stimtracker/tn1450_st_commands.htm__;!!HXCxUKc!k_FRLWwij4MCN37Oqf8ddYpdatJwE5gBafer9q_hD5JhUQ_32GmrzgBgTHGYXda6$

Jen2368

unread,
Nov 8, 2021, 12:00:30 AM11/8/21
to E-Prime
Thanks so much for your thoughts and input. I really appreciate your time and am following up on the suggested reading now!
Jen

Reply all
Reply to author
Forward
0 new messages