Millisecond Forums

Unusual behaviour with sending signals

https://forums.millisecond.com/Topic26374.aspx

By Sasch - 2/5/2019

Hi Inquisit community,
We are using Inquisit 5 to control a device for thermal stimulation. We built D/A-changer (USB-based) that transform the digital 8bit signal from Inquisit to an analogous +/-5V output. The USB-changer has a built in FTDI232 chip and is recognized as COM4 on our PC (Windows 7). Other settings of the port are:
Baudrate: 57600
Bits: 8
Parity: none
Stoppbits: 1
The changer receives signals from Inquisit and gives output to the thermal stimulation device. The thermal device receives the output and starts its program.
We wrote a little script for an experiment (see below) but it shows some strange behaviour.
The procedure for the experiment is:
1.) Show intro screen, press spacebar to begin
2.) Show first picture for 6 seconds and send a signal at the 5th second of the first picture, show fixation cross for 5 seconds
3.) Show second picture for 6 seconds and send a signal at the 5th second of the second picture, show fixation cross for 5 seconds
4.) Show third picture for 6 seconds and send a signal at the 5th second of the third picture, show fixation cross for 5 seconds
5.) Show end screen
So, here's the problem: Step 1.) & 2.) work perfectly but when it comes to 3.) & 4.) the signal now is sent parallel with the showing of the picture although it should be sent at the 5th second of the picture. Also when it comes to the end screen (5.)): a signal is sent although there is no "send signal" command???

Do you have any ideas why this happens?
Below is the script we wrote.
Thanks a lot in advance,
Sasch

*** Default_Background_Screen----------------------
<defaults>
/screencolor = (0,0,0)
/txbgcolor = (0,0,0)
/txcolor = (255, 255, 255)
/minimumversion = "3.0.0.0"
</defaults>
*** Port_Signals--------------------------------------------
<port mysignal>
/port = com4
/subport=data
/items=(1)
/erase = true(0)
</port>
*** Text Press_Spacebar---------------------------------
<text spacebar>
/items = ("Press SPACEBAR to begin!")
/position = (50%, 95%)
/valign = bottom
/fontstyle = ("Arial", 3.5%)
</text>
*** Text End_Screen----------------------------------------
<text ende>
/ items = ("Thx! Experiment is over now. Press 'e' to end.")
/ position = (50%, 50%)
/ fontstyle = ("Arial", 3.5%)
</text>
*** Erase_Pic ---------------------------------------------------
<shape erase_pic>
/ shape = rectangle
/ color = black
/ position = (50%,50%)
/ size = (100%, 100%)
</shape>
*** Start_Screen--------------------------------------------------
<item intro>
/1 = "intro.png"
</item>
<picture intro>
/items = intro
/position = (50, 50)
/size = (200%, 80%)
</picture>
*** Fixation_Cross
<item fixation>
/1 = "fixation.png"
</item>
<picture fixation>
/items = fixation
/position = (50, 50)
/size = (100%, 100%)
</picture>
*** Pic_Stimuli --------------------------------------------------
<item neutral>
/1 = "F01.png"
/2 = "F03.png"
/3 = "F04.png"
/4 = "F06.png"
/5 = "F07.png"
/6 = "F08.png"
/7 = "F09.png"
/8 = "F010.png"
</item>
<picture neutral>
/items = neutral
/select = noreplace
/position = (50, 50)
/size = (100%, 100%)
</picture>
*** Trials -----------------------------------------------------------
<trial show_intro>
/stimulustimes = [1=intro]
/validresponse = (" ")
</trial>
<trial show_end>
/validresponse = ("e")
</trial>
<trial show_stimuli>
/stimulusframes = [1=neutral; 240=mysignal, systembeep; 360=fixation; 960=erase_pic]
/timeout = 1
</trial>
*** Blocks -----------------------------------------------------
<block begin_exp>
/trials = [1=show_intro]
/bgstim = (spacebar)
</block>
<block showing_stimuli>
/trials = [1=show_stimuli]
</block>
<block end_exp>
/trials = [1=show_end]
/bgstim = (ende)
</block>
*** Experiment --------------------------------------------------
<expt>
/blocks = [1=begin_exp; 2-4=showing_stimuli; 5=end_exp]
</expt>
***=======================================
By Dave - 2/5/2019

Sasch - Wednesday, February 6, 2019
Hi Inquisit community,
We are using Inquisit 5 to control a device for thermal stimulation. We built D/A-changer (USB-based) that transform the digital 8bit signal from Inquisit to an analogous +/-5V output. The USB-changer has a built in FTDI232 chip and is recognized as COM4 on our PC (Windows 7). Other settings of the port are:
Baudrate: 57600
Bits: 8
Parity: none
Stoppbits: 1
The changer receives signals from Inquisit and gives output to the thermal stimulation device. The thermal device receives the output and starts its program.
We wrote a little script for an experiment (see below) but it shows some strange behaviour.
The procedure for the experiment is:
1.) Show intro screen, press spacebar to begin
2.) Show first picture for 6 seconds and send a signal at the 5th second of the first picture, show fixation cross for 5 seconds
3.) Show second picture for 6 seconds and send a signal at the 5th second of the second picture, show fixation cross for 5 seconds
4.) Show third picture for 6 seconds and send a signal at the 5th second of the third picture, show fixation cross for 5 seconds
5.) Show end screen
So, here's the problem: Step 1.) & 2.) work perfectly but when it comes to 3.) & 4.) the signal now is sent parallel with the showing of the picture although it should be sent at the 5th second of the picture. Also when it comes to the end screen (5.)): a signal is sent although there is no "send signal" command???

Do you have any ideas why this happens?
Below is the script we wrote.
Thanks a lot in advance,
Sasch

*** Default_Background_Screen----------------------
<defaults>
/screencolor = (0,0,0)
/txbgcolor = (0,0,0)
/txcolor = (255, 255, 255)
/minimumversion = "3.0.0.0"
</defaults>
*** Port_Signals--------------------------------------------
<port mysignal>
/port = com4
/subport=data
/items=(1)
/erase = true(0)
</port>
*** Text Press_Spacebar---------------------------------
<text spacebar>
/items = ("Press SPACEBAR to begin!")
/position = (50%, 95%)
/valign = bottom
/fontstyle = ("Arial", 3.5%)
</text>
*** Text End_Screen----------------------------------------
<text ende>
/ items = ("Thx! Experiment is over now. Press 'e' to end.")
/ position = (50%, 50%)
/ fontstyle = ("Arial", 3.5%)
</text>
*** Erase_Pic ---------------------------------------------------
<shape erase_pic>
/ shape = rectangle
/ color = black
/ position = (50%,50%)
/ size = (100%, 100%)
</shape>
*** Start_Screen--------------------------------------------------
<item intro>
/1 = "intro.png"
</item>
<picture intro>
/items = intro
/position = (50, 50)
/size = (200%, 80%)
</picture>
*** Fixation_Cross
<item fixation>
/1 = "fixation.png"
</item>
<picture fixation>
/items = fixation
/position = (50, 50)
/size = (100%, 100%)
</picture>
*** Pic_Stimuli --------------------------------------------------
<item neutral>
/1 = "F01.png"
/2 = "F03.png"
/3 = "F04.png"
/4 = "F06.png"
/5 = "F07.png"
/6 = "F08.png"
/7 = "F09.png"
/8 = "F010.png"
</item>
<picture neutral>
/items = neutral
/select = noreplace
/position = (50, 50)
/size = (100%, 100%)
</picture>
*** Trials -----------------------------------------------------------
<trial show_intro>
/stimulustimes = [1=intro]
/validresponse = (" ")
</trial>
<trial show_end>
/validresponse = ("e")
</trial>
<trial show_stimuli>
/stimulusframes = [1=neutral; 240=mysignal, systembeep; 360=fixation; 960=erase_pic]
/timeout = 1
</trial>
*** Blocks -----------------------------------------------------
<block begin_exp>
/trials = [1=show_intro]
/bgstim = (spacebar)
</block>
<block showing_stimuli>
/trials = [1=show_stimuli]
</block>
<block end_exp>
/trials = [1=show_end]
/bgstim = (ende)
</block>
*** Experiment --------------------------------------------------
<expt>
/blocks = [1=begin_exp; 2-4=showing_stimuli; 5=end_exp]
</expt>
***=======================================

What you should do is turn the signal *off* at some point during your <trial show_stimuli> trial, i.e. send a <port> stimulus that resets all bits back to zero

<port signaloff>
/port = com4
/subport=data
/items=(0)
/erase = false
</port>

with something like

<trial show_stimuli>
/stimulusframes = [1=neutral; 240=mysignal, systembeep; 360=signaloff, fixation; 960=erase_pic]
/ validresponse = (0)
/timeout = 1
/ responseinterrupt = frames
</trial>
By Sasch - 2/6/2019

Dave - Wednesday, February 6, 2019

What you should do is turn the signal *off* at some point during your <trial show_stimuli> trial, i.e. send a <port> stimulus that resets all bits back to zero

<port signaloff>
/port = com4
/subport=data
/items=(0)
/erase = false
</port>

with something like

<trial show_stimuli>
/stimulusframes = [1=neutral; 240=mysignal, systembeep; 360=signaloff, fixation; 960=erase_pic]
/ validresponse = (0)
/timeout = 1
/ responseinterrupt = frames
</trial>

Hi Dave,
thanks a lot for your reply.
We've tried that before and I also tried now your idea.
Unfortunately it doesn't work :(
With beginning of the second & third picture, a signal is sent immediately. Also a signal is still sent at the end screen.
Could there be something wrong with the USB-changer?

Best,
Sasch

By Dave - 2/6/2019

Sasch - Wednesday, February 6, 2019
Dave - Wednesday, February 6, 2019

What you should do is turn the signal *off* at some point during your <trial show_stimuli> trial, i.e. send a <port> stimulus that resets all bits back to zero

<port signaloff>
/port = com4
/subport=data
/items=(0)
/erase = false
</port>

with something like

<trial show_stimuli>
/stimulusframes = [1=neutral; 240=mysignal, systembeep; 360=signaloff, fixation; 960=erase_pic]
/ validresponse = (0)
/timeout = 1
/ responseinterrupt = frames
</trial>

Hi Dave,
thanks a lot for your reply.
We've tried that before and I also tried now your idea.
Unfortunately it doesn't work :(
With beginning of the second & third picture, a signal is sent immediately. Also a signal is still sent at the end screen.
Could there be something wrong with the USB-changer?

Best,
Sasch


> Could there be something wrong with the USB-changer?

Maybe, I don't know. What you describe makes it sound like the USB-device just keeps the signal raised once it's turned on for the first time during the trial, but never erases it / lowers the signal again.
What happens if you change your <trial>'s code to this:

<trial show_stimuli>
/stimulustimes = [0=neutral; 5000=mysignal, systembeep; 6000=clearscreen, signaloff, fixation]
/ validresponse = (0)
/ trialduration = 11000
/ responseinterrupt = frames
/ ontrialend = [trial.show_stimuli.resetstimulusframes();]
</trial>

with

<port signaloff>
/port = com4
/subport=data
/items=(0)
/erase = false
</port>

and

<port mysignal>
/port = com4
/subport=data
/items=(1)
/erase = false
</port>


By Sasch - 2/6/2019

Hi Dave,
thanks a lot, this works!!
Could you tell me what excatly happens here and why I have to do it this way?
Best,
Sasch