|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 8/26/2008 6:07:46 AM
Posts: 4,
Visits: 16
|
|
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
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: 2 days ago @ 8:55:28 AM
Posts: 536,
Visits: 1,158
|
|
| 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
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 8/26/2008 6:07:46 AM
Posts: 4,
Visits: 16
|
|
Thanks for getting back to me. I have run the script and attached a copy of the marker (trigger code) output file.
Paul
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: 2 days ago @ 8:55:28 AM
Posts: 536,
Visits: 1,158
|
|
| 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
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 8/26/2008 6:07:46 AM
Posts: 4,
Visits: 16
|
|
Thanks so much, that worked and has solved my problem. Thanks again
Paul
|
|
|
|