Flexible /items


Author
Message
Mattis
Mattis
Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)Respected Member (321 reputation)
Group: Forum Members
Posts: 3, Visits: 46
Hi Inquisit Team,

I'm using the <port> element in Inquisit 5 and a d/a-changer to control a device for electrical stimulation (STMISOLA, BIOPAC). The d/a changer has a parallel port and transforms the 8-bit input from Inquisit to a 0-2,55V signal, which is used to control the electrical stimulator.

Because of individual differences in sensitivity to electrical stimuli in humans, we need our scripts to be easily adjustable to individual thresholds of participants. Thus, we programmed <openended> elements in the beginning of our scripts, where we first register individual information for the stimulation as decimal numbers. Then, I want to use the openended.NAME.response to flexibly adjust the /items attribute of the <port> element with a given formula. E.g., if stimulating with 6.4mA, I need the port to output the number 64. I tried incorporating my formula [<%(openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response)*10%>]in the /items attribute [/ items = (<%openended.schmerz.response + 0.6* (openended.toleranz.response - openended.schmerz.response)*10%>)], which gave me an error:
"-1 is invalid. Value must greater than 0."

Next, I defined this as an <item>, e.g. named staerke60, and tried to read in this in the <port> element. Interestingly, now the scripts starts, but again produces errors after finishing/quitting, e.g.:
'64' is not a valid setting.

I found in the description for <item>, that in ports they must be written as binaries in "". However, the in the <port> and respective / items description, using decimals in parantheses is mentioned, too. And when using decimals regularily, not flexibly via <% %>, it works just fine.
So am I correct, that the error occurs, because my calculation in <% %> produces a decimal, but when using a calculation, the <port> only accepts binaries? If so, do you know any simple and short workaround for this? I'm not sure, if I can again transform my decimal do a 8bit binary with the mathematical operations included in Inquisit, but maybe you have more experience with that?
Another option could be defining every decimal from 0 to 255 in a single <port> element each and choosing these elements flexibly based on the openended value. However, that would heavily enlarge the script, which I would like to avoid if anyhow possible.

Thanks a lot in advance for any help and suggestions.
Best,
Mattis

PS.: the script is attached. Sorry for the German parts here and there, but I hope it is still understandable.
Attachments
experiment_portproblem.iqx (570 views, 22.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search