Multiple Trigger Codes from E-prime to Brain Vision Recorder
 
PST User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Multiple Trigger Codes from E-prime to Brain... Expand / Collapse
Author
Message
Posted 4/10/2008 7:18:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2 days ago @ 6:06:18 AM
Posts: 4, Visits: 34
Hi

I am using eprime alongside Brain Products BrainVision software and I am having problems sending trigger codes. I want to be able to send 20 different trigger codes but when I use the following code:

If c.GetAttrib("Value") = "10" Then
WritePort &H378, 1
ElseIf c.GetAttrib("Value") = "20" Then
WritePort &H378, 2
ElseIf c.GetAttrib("Value") = "30" Then
WritePort &H378, 3

......

ElseIf c.GetAttrib("Value") = "180" Then
WritePort &H378, 18
ElseIf c.GetAttrib("Value") = "190" Then
WritePort &H378, 19
ElseIf c.GetAttrib("Value") = "200" Then
WritePort &H378, 20
End If

it gives the following sequence of trigger codes

s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, r1, s1, s2, s3, s4, s5, s1, s2........

I know it is something to do with hexadecimal values, but cant figure out what I need to output to get s1, ..., s20 rather than what I have above. Any help would be greatly appreciated

Thanks

Paul
Post #1470
Posted 4/10/2008 9:20:20 AM
Forum MVP

Forum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVP

Group: Administrators
Last Login: 2/1/2012 1:26:10 PM
Posts: 652, Visits: 1,441
I think there is just a translation going on that needs to be deciphered.  Unless the documentation they provide already has it, you can determine some additional info by trying more values so the sequence can be deciphered.  Try running the following script and report back ALL of the values retrieved.  From there either myself or another forum member may be able to assist.  The code below is just basicallly walking through all values that an 8-bit data value can hold from 0 to 255.  I've put a clear zero in there in the event that the software needs a low transition to accept the change.  Thus, you'll either likely get 256 values or 512 values.  Please send them all back.  If your result is too large, you can optionally dump it in a .txt file and attach to the forum thread.

Dim x As Long
For x = 0 To 255
 WritePort &H378, x
 Sleep 10
 WritePort &H378, 0
 Sleep 10
Next 'x

Post #1471
Posted 4/10/2008 11:02:31 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2 days ago @ 6:06:18 AM
Posts: 4, Visits: 34
Thanks for getting back to me. I have run the script and attached a copy of the marker (trigger code) output file.

Paul


  Post Attachments 
testoutputmarkers.txt (39 views, 14.18 KB)
Post #1472
Posted 4/11/2008 9:18:15 AM
Forum MVP

Forum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVPForum MVP

Group: Administrators
Last Login: 2/1/2012 1:26:10 PM
Posts: 652, Visits: 1,441
From the values reported, it appears that you can have 15 unique Stimulus (S) values and 15 unique Response (R) values.  So you can only have a total of 30 unique values.

If you send values 1 - 15 to the port you'll result in S1 through S15 values.  If you take 1 - 15 and multiply that by 16 and send to the port you'll get R1 through R15 values.

You could possibly obtain more unique values by analyzing the data and determining which values ocurred at the same time stamp and the massaging those back into a binary representation but I that may be more effort than what it is worth and error prone.  I would suggest advice from the manufacture if you go that route.

To take your example you initially had, it appeared the values needed to be divided by 10 to get the root value.  So you could do something like the following to get 30 transitions.  Any attempts to go higher than 30 would result in multiple S/R combinations to appear.

Dim nValue As Long
nValue = c.GetAttrib("Value") / 10

If nValue >= 1 And <= 15 Then
 WritePort &H378, nValue
ElseIf nValue > 15 And <= 30
 WritePort &H378, (nValue * 16)
End If

Post #1478
Posted 4/14/2008 9:41:25 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2 days ago @ 6:06:18 AM
Posts: 4, Visits: 34
Thanks so much, that worked and has solved my problem. Thanks again

Paul
Post #1480
Posted 1/3/2011 11:44:18 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 1/4/2011 11:05:02 PM
Posts: 9, Visits: 40
Greetings,
I am using the following inline code to send trigger codes to a parallel port. The inline is inserted after a stimulus object within a trial proc.

'set variables
Const BASE_ADDRESS = &H378
Const OUT_PORT_ADDRESS = BASE_ADDRESS
Dim strData as Integer
Dim x as Long
strData = c.GetAttrib("TrialCode")
'write port
WritePort OUT_PORT_ADDRESS, strData
sleep 100
If (Val(Stim.ACC) = 1 AND Val(Stim.CRESP) = 4)Then
x = 8 'HIT:if accuracy code is 1 (for correct), return 8
Elseif (Val(Stim.ACC) = 0 AND Val(Stim.RESP) = 4) Then
x = 128 'MISS:if accuracy code is 0 and response code is 4 (for incorrect), return 128
End If
WritePort OUT_PORT_ADDRESS, x
sleep 100
WritePort OUT_PORT_ADDRESS, 0 '0 = all bits off
sleep 100

The code for strData appears to work, however I cannot get a stimulus response trigger. Is there a way to test this without access to a parallel port (i.e., troubleshooting on another machine). Suggestions very welcome.


KT
tavabik@email.chop.edu
Post #5141
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -5:00, Time now is 4:09pm

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0.094. 8 queries. Compression Disabled.
 
Privacy | Terms of Use | Terms and Conditions | Legal Trademarks | Authorized Use | Quality Policy
Copyright 2012 Psychology Software Tools, Inc. All Rights Reserved
Email: Info@pstnet.com | Telephone: 412.449.0078 | Fax: 412.449.0079