Millisecond Forums

Serial port output - Syntax example

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

By SMSchulz - 3/28/2017

Hi,
we need to send a simple "on" signal through COM3 (actual hardware is: USB-to-COM-Adapter connected to USB port as a COM device) for lets say 10msec, then go back to zero. We'd like to associate this as a marker signal with e.g. presenation of a word or a picture, and send it to our physiology recording device which is designed to read a COM-port and translates this into a number in a marker channel we record concurrently to he actual physiology signals.
I struggle a bit with setting up the syntax...

<port portname>
/ erase = true("bits") or true(integer) or false
/ items = itemname or ("binary", "binary", "binary",... ) or (integer, integer, integer,... )
/ onprepare = [expression; expression; expression; ...]
/ port = port name
/ resetinterval = integer
/ select = integer or selectionmode or selectionmode(pool) or dependency(stimulusname) or dependency(listname) or listname
/ subport = porttype
</port>

Could someone point me to a reference on what all the options actually do?
Even better: coudl someone provide an example for a serial port? The parallel port is reported in the Inquisit documentation - but it seems that it is the simpler example...

Any help is greatly appreciated!
Kind regards,
Stefan




By Dave - 3/28/2017

SMSchulz - Wednesday, March 29, 2017
Hi,
we need to send a simple "on" signal through COM3 (actual hardware is: USB-to-COM-Adapter connected to USB port as a COM device) for lets say 10msec, then go back to zero. We'd like to associate this as a marker signal with e.g. presenation of a word or a picture, and send it to our physiology recording device which is designed to read a COM-port and translates this into a number in a marker channel we record concurrently to he actual physiology signals.
I struggle a bit with setting up the syntax...

<port portname>
/ erase = true("bits") or true(integer) or false
/ items = itemname or ("binary", "binary", "binary",... ) or (integer, integer, integer,... )
/ onprepare = [expression; expression; expression; ...]
/ port = port name
/ resetinterval = integer
/ select = integer or selectionmode or selectionmode(pool) or dependency(stimulusname) or dependency(listname) or listname
/ subport = porttype
</port>

Could someone point me to a reference on what all the options actually do?
Even better: coudl someone provide an example for a serial port? The parallel port is reported in the Inquisit documentation - but it seems that it is the simpler example...

Any help is greatly appreciated!
Kind regards,
Stefan





A <port> element works like any other stimulus. What you do is something like:

// sends 1
<port on>
/ items = ("00000001")
/ port = COM3
</port>

// back to 0
<port backtolow>
/ items = ("00000000")
/ port = COM3
</port>

<text word>
/ items = ("A", "B", C")
...
</text>

with 

<trial example>
/ stimulustimes = [0=word, on; 20=backtolow]
...
</trial>

You can also directly specify the integer value to wish to send instead of specifying the value in 8-bit binary:

// sends 1
<port on>
/ items = (1)
/ port = COM3
</port>