BART task not properly sending TTL signal output


Author
Message
MiskatonicGradStudent
MiskatonicGradStudent
Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)
Group: Awaiting Activation
Posts: 4, Visits: 30
Hello,
I am using a script for the Balloon Analogue Risk Task (BART) available here: http://www.millisecond.com/download/library/BART/ I'm having trouble getting TTL signal outputs to work. We would like to have Inquisit (version 3) send signals via parallel port to our BIOPAC MP36-R device that collects skin conductance data and records it in Acqknowledge 4.3 software.  We would like to send one signal whenever the participant "collects money" at the end of a trial, and a second signal whenever the balloon pops. So far we have gotten the output TTL signal working for "collect" trials but not for "pop" trials. We haven't had difficulty getting multiple signals to send in other Inquisit tasks like the Iowa Gambling Task and Game of Dice task, so I doubt it is a global issue related to communication between the two computers. Below I have pasted the scrip, any advice for getting a signal to work for the "pop" trials would be very helpful. Thanks! 
**************************************************************************************************************
**************************************************************************************************************
Balloon Analogue Risk Task (BART)
Lejuez et al 2002. 
Adapted for use by CHEST
**************************************************************************************************************
**************************************************************************************************************
Script Version: Final (1.0)
Last Modified:11/1/10 by XXXXX
Modified 07/15/14 by XXXX to send event markers to Biopac/AcqKnowledge.
**************************************************************************************************************
**************************************************************************************************************
Adjustable Task Parameters
Number of balloons: Default is 30, adjustable via the "totalballoons" value. 
Payoff per pump: Default is $.05, adjustable via the "pumpvalue" value.
Ballon size increment: Default is 8 pixels, adjustable via the "ballonsizeincrement" value.
Show current pump count: Default is true, adjustable via the showpumpcount values.
Show current balloon count: Default is true, adjustable via the showballooncount value
Show potential earnings for the current balloon: Default is true, adjustable via the showpotentialearnings value
Probability of popping: Default is 1/128 to start, adjustable via pumpresult counter below.
<values>
/ totalballoons = 30
/ pumpvalue = .05
/ balloonsizeincrement = 8
/ showpumpcount = true
/ showballooncount = false
/ showpotentialearnings = false
/ showlastearned = true
/ totalearnings = 0.0
/ pumpcount = 0
/ lastearned = 0.0
/ ballooncount = 0
/ balloonheight = 0 
/ balloonwidth = 0
/ pumpresult = 0
/ adjustedtotalpumpcount = 0
/ adjustedaveragepumpcount = 0
</values>
<counter pumpresult>
/ select = noreplace(1-128)
</counter>
**************************************************************************************************************
**************************************************************************************************************
<data>
/ columns = [date time subject trialcode trialnum response values.ballooncount trial.pop.trialcount values.pumpcount values.pumpresult values.totalearnings values.adjustedtotalpumpcount values.adjustedaveragepumpcount]
</data>
<defaults>
/ inputdevice = mouse
/ fontstyle = ("Arial", 3.52%, false, false, false, false, 5, 0)
/ minimumversion = "3.0.4.0"
</defaults>
<expressions>
/ lastearned = format("%.2f", values.lastearned)
/ pumpvalue = format("%.2f", values.pumpvalue)
/ totalearnings = format("%.2f", values.totalearnings)
/ potentialearnings = format("%.2f", (counter.pumpresult.itemcount - 1) * .05)
</expressions>
************************************************************************************************************
BART INSTRUCTIONS
************************************************************************************************************
<item instructions>
/ 1 = "Throughout this task you will be presented with <%values.totalballoons%> balloons, one at a time, on the screen. 
For each balloon, you can click on the button labeled ''Pump up the Balloon'' to increase the size of the balloon. Each click on the mouse pumps up the balloon a little more.
BUT remember, balloons pop if you pump them up too much. It is your choice to determine how much to pump up the balloon, but be aware that at some point the balloon will explode. The explosion point varies across balloons, ranging from the first pump to enough pumps to fill up the screen.
You will get to see how many pumps you have made on the balloon in a section labeled 'number of pumps.'"'
/2 = "You get MONEY for every pump. Each pump earns 5 cents in a temporary 'bank'. At any point you can stop pumping up the balloon and click on the button labeled 'Collect $$$.' Clicking this button will start you on the next balloon and will transfer the accumulated money from your temporary bank to your permanent bank labeled ''Total Earned.''
If the balloon explodes before you click on ''Collect $$$,'' then you move on to the next balloon and all the money in your temporary bank is lost. Exploded balloons do not affect the money accumulated in your permanent bank.
The amount you earned on the previous balloon is shown by the label ''Last Balloon.''
Although you will not be paid for your performance, please play the game as if you were, and try to win as much money as you can.
Click the left mouse button to see the summary."
/ 3 = "Summary
* You make $<%expressions.pumpvalue%> for each pump.
* You save the money from a balloon when you click ~"Collect $$$~".
* You lose money from a balloon when it pops.
* There are just <%values.totalballoons%> balloons.
Click the left mouse button to begin."
</item>
<item EndInstruct>
/ 1 = "Thank you! 
This task is now complete. Click the left mouse button to continue."
</item>
<text instructions>
/ items = instructions
/ vjustify = center
/ hjustify = left
/ size = (80%, 80%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/ select = sequence
</text>
<text endinstruct>
/ items = endinstruct
/ vjustify = center
/ hjustify = left
/ size = (80%, 80%)
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 0)
/ select = sequence
</text>
<trial instructions>
/ stimulustimes = [1=instructions]
/ inputdevice = mousekey
/ validresponse = (lbuttonup)
/ recorddata = false
</trial>
<trial endinstruct>
/ stimulustimes = [1=endinstruct]
/ inputdevice = mousekey
/ validresponse = (lbuttonup)
/ recorddata = false
</trial>
************************************************************************************************************
PUMP STIMULI
************************************************************************************************************
<port trialpopsignal>
/ port = LPT1
/ subport = data
/ items = ("00000001")
</port>
<port trialcollectsignal>
/ port = LPT1
/ subport = data
/ items = ("00000010")
</port>
<picture collectbutton>
/ items = ("collectbutton.jpg")
/ position = (60%, 85%)
/ valign = top
/ halign = left
/ erase = false
</picture>
<picture collectbuttonselected>
/ items = ("collectbuttonselected.jpg")
/ position = (60%, 85%)
/ valign = top
/ halign = left
/ erase = false
</picture>
<text totalearnings>
/ items = ("Total Earned: $<%expressions.totalearnings%>    ")
/ position = (60%, 78%)
/ valign = bottom
/ halign = left
/ erase = false
</text>
<text pumpcount>
/ items = ("Number of pumps: <%values.pumpcount%>    ")
/ position = (60%, 72%)
/ valign = bottom
/ halign = left
/ erase = false
</text>
<text LastEarned>
/ items = ("Last Balloon: $<%expressions.lastearned%>    ")
/ position = (60%, 66%)
/ valign = bottom
/ halign = left
/ erase = false
</text>
<text ballooncount>
/ items = ("Balloon number: <%values.ballooncount%> of <%values.totalballoons%>   ")
/ position = (60%, 72%)
/ valign = bottom
/ halign = left
/ erase = false
</text>
<text potentialearnings>
/ items = ("Potential earnings: $<%expressions.potentialearnings%>    ")
/ position = (60%, 64%)
/ valign = bottom
/ halign = left
/ erase = false
</text>
<picture pumpbutton>
/ items = ("pumpbutton.jpg")
/ position = (33%, 85%)
/ valign = top
/ erase = false
</picture>
<picture pumpbuttonselected>
/ items = ("pumpbuttonselected.jpg")
/ position = (33%, 85%)
/ valign = top
/ erase = false
</picture>
<picture balloon>
/ items = ("balloon.jpg")
/ position = (33%, 83%)
/ valign = bottom
/ size = (100%, 100%)
/ erase = false
/ transparentcolor = white
</picture>
<picture poppedballoon>
/ items = ("poppedballoon.jpg")
/ position = (33%, 83%)
/ valign = bottom
/ size = (100%, 100%)
/ erase = false
/ transparentcolor = white
</picture>
<shape blank>
/ shape = rectangle
/ color = white
/ size = (235px, 309px)
/ position = (33%, 83%)
/ valign = bottom
</shape>
<sound popsound>
/ items = ("explosion.wav")
</sound>
<sound collectsound>
/ items = ("casino.wav")
</sound>
<sound inflatesound>
/ items = ("inflate.wav")
</sound>
************************************************************************************************************
PUMP TRIALS
************************************************************************************************************
<trial init>
/ ontrialbegin = [picture.balloon.width = values.balloonwidth]
/ ontrialbegin = [picture.balloon.height = values.balloonheight]
/ ontrialbegin = [picture.poppedballoon.width = values.balloonwidth]
/ ontrialbegin = [picture.poppedballoon.height = values.balloonheight]
/ ontrialbegin = [values.pumpcount = 0]
/ ontrialbegin = [values.ballooncount = values.ballooncount + 1]
/ stimulustimes = [1=blank]
/ response = noresponse
/ branch = [trial.choice]
/ recorddata = false
/ ontrialend = [shape.blank.width = values.balloonwidth]
/ ontrialend = [shape.blank.height = values.balloonheight]
</trial>
<trial choice>
/ ontrialbegin = [values.pumpresult = counter.pumpresult.selectedvalue]
/ stimulustimes = [1=collectbutton, balloon, pumpbutton, totalearnings, pumpcount, lastearned, potentialearnings, ballooncount]
/ inputdevice = mouse
/ validresponse = (collectbutton, pumpbutton)
/ branch = [if ( trial.choice.response == "pumpbutton") trial.pump]
/ branch = [if ( trial.choice.response == "collectbutton") trial.collect]
</trial>
<trial pump>
/ ontrialbegin = [picture.balloon.width = picture.balloon.width + values.balloonsizeincrement]
/ ontrialbegin = [picture.balloon.height = picture.balloon.height + values.balloonsizeincrement]
/ ontrialbegin = [shape.blank.width = picture.balloon.width]
/ ontrialbegin = [shape.blank.height = picture.balloon.height]
/ ontrialbegin = [values.pumpcount = values.pumpcount + 1]
/ stimulustimes = [1=inflatesound, pumpbuttonselected, balloon, totalearnings; 50=pumpbutton]
/ response = noresponse
/ responseinterrupt = trial
/ branch = [if ( values.pumpresult == 1 ) trial.pop]
/ branch = [if ( values.pumpresult != 1 ) trial.choice]
</trial>
<trial pop>
/ ontrialbegin = [picture.poppedballoon.width = picture.balloon.width]
/ ontrialbegin = [picture.poppedballoon.height = picture.balloon.height]
/ ontrialbegin = [shape.blank.width = picture.balloon.width]
/ ontrialbegin = [shape.blank.height = picture.balloon.height]
/ ontrialbegin = [reset(counter.pumpresult)]
/ ontrialbegin = [values.lastearned = 0.00]
/ stimulustimes = [1=popsound, poppedballoon, totalearnings, trialpopsignal]
/ response = noresponse
/ branch = [trial.init]
/ responseinterrupt = trial
</trial>
<trial collect>
/ ontrialbegin = [shape.blank.width = picture.balloon.width]
/ ontrialbegin = [shape.blank.height = picture.balloon.height]
/ ontrialbegin = [values.lastearned = (values.pumpcount * values.pumpvalue)]
/ ontrialbegin = [values.totalearnings = values.totalearnings + (values.pumpcount * values.pumpvalue)]
/ ontrialbegin = [values.adjustedtotalpumpcount = values.adjustedtotalpumpcount + values.pumpcount]
/ ontrialbegin = [values.adjustedaveragepumpcount = values.adjustedtotalpumpcount / trial.collect.trialcount]
/ ontrialbegin = [reset(counter.pumpresult)]
/ stimulustimes = [1=collectsound, collectbuttonselected, totalearnings, trialcollectsignal; 100 = collectbutton]
/ response = noresponse
/ branch = [trial.init]
/ responseinterrupt = trial
</trial>
<block BART>
/ onblockbegin = [values.balloonwidth = 0.3 * display.width]
/ onblockbegin = [values.balloonheight = 0.3 * display.height]
/ trials = [1-3=instructions; 4=init]
/ stop = [trial.init.trialcount > values.totalballoons]
</block>
<block EndBART>
/trials = [1 = endinstruct]
</block>
**********************************************
BART Experiment Sequence
**********************************************
<expt BART>
/ onexptbegin = [if ( !values.showpumpcount ) text.pumpcount.hposition = 100%]
/ onexptbegin = [if ( !values.showballooncount ) text.ballooncount.hposition = 100%]
/ onexptbegin = [if ( !values.showlastearned) text.lastearned.hposition = 100%]
/ onexptbegin = [if ( !values.showpotentialearnings ) text.potentialearnings.hposition = 100%]
/ blocks = [1 = BART; 2 = endBART]
</expt>​

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
If I were to hazard a guess, I'd say that <trial pop> -- which is where you try to send the TTL signal (<port trialpopsignal>) -- ends up being too short to send out the signal and having your external equipment pick it up before the pins go low again. Try giving the <trial> a sufficient duration, e.g. by setting /trialduration=100.

MiskatonicGradStudent
MiskatonicGradStudent
Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)
Group: Awaiting Activation
Posts: 4, Visits: 30
Hi there,

Thanks for responding so quickly. I tried increasing the trial duration but this did not help.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
Then I don't know. Have you ruled out issues at the receiving end? I.e., is your equipment actually configured to look at the pin you're raising in <port trialpopsignal>?
MiskatonicGradStudent
MiskatonicGradStudent
Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)
Group: Awaiting Activation
Posts: 4, Visits: 30
Hello again,

I tested the output code with another task and it worked, so I am not sure what the issue is. I will try some more troubleshooting. 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
I still think that ultimately the port signal is not remaining raised long enough to be picked up by your equipment. Several things to try:
-  Move the port stimulus to the beginning of the stimulustimes attribute:
<trial pop>
...
/ stimulustimes = [1=trialpopsignal, popsound, poppedballoon, totalearnings]
/ response = noresponse
/ branch = [trial.init]
/ responseinterrupt = trial
</trial>

- Add some dummy stimulus to the end of /stimulustimes (mimicking the setup for the collect trial, where signaling works):

<trial pop>
...
/ stimulustimes = [1=popsound, poppedballoon, totalearnings, trialpopsignal; 100=dummy]
/ response = noresponse
/ branch = [trial.init]
/ responseinterrupt = trial
</trial>



MiskatonicGradStudent
MiskatonicGradStudent
Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)Partner Member (610 reputation)
Group: Awaiting Activation
Posts: 4, Visits: 30
Hello,

I've tried the former option without success.

The later option, however, worked like a charm. Thank you so much for all of your help.



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search