Update MRI or Trigger: Insert content authored by Fabian Berg's avatar Fabian Berg
......@@ -4,10 +4,81 @@ The following chapter contains functions that can be used to execute experiments
## initMRIChatPart1
function: mmap = initMRTChatPart1
**Description**
Initialize MRI related functions. To record all triggers successfully initMRIChatPart2 has to be called AFTER initWindow is called! Returns handle to memory mapped file (output).
initMRIChatPart1 will start triggerCounter2_MCR9-2.exe automatically. This program periodically sends triggers via the parallel port pin 10 (1 trigger per scan) if the scanner is turned on. The memory mapped file that is created is important for the communication between matlab and triggerCounter2. The program can be stopped by pressing escape.
**Outputs**
~~~
mmap memory mapped file containing important information for
device communication (only important user information is
mentioned here, other information may be interesting but not
important to the experiment)
.Data(1) amount of triggers sent
.Data(2) time of the last trigger sent
~~~
## initMRIChatPart2
function: initMRTChatPart2(mmap, scans2Wait)
**Description**
Initialize MRI functions part 2. Includes waiting for the first trigger. Do not forget to call initWindow first! On the presentation window user information about the process will appear. It is not meant for stimulus presentation in this case.
**Inputs**
~~~
mmap memory mapped file, enter output from initMRIChatPart1
scans2wait number of scans to wait until the experiment starts
~~~
## sendTriggerMRI
function: sendTriggerMRI(mmap, pin, status)
**Description**
Use this function to send single triggers (e.g. for MRI or EEG) to an external device using the parallel port. All IO communications are handled via a memory mapped file that is provided by triggerCounter2 and the initMRI functions. The arguments for turning on and off certain pins is similar to parchat.
**Inputs**
~~~
mmap memory mapped file, enter output from initMRIChatPart1
pin pin number for sending trigger
status turn on/off pin, can be either ‘1’ (on) or ‘0’ (off)
~~~
## parChat
function: parchat(pin,status)
**Description**
This function opens an interface with a parallel port using InpOutx64. This is a 64bit mex files that works on 64 bit Windows only! A parallel port is mandatory for the execution of this function. Call of the function is not possible when the parallel port is occupied by continuous requests, for example when using triggerCounter2_MCR9-2.exe. Use sendTriggerMRI in this case.
The function parChat can activate or deactivate pin 2-9 if it is called with a status condition or it can listen to pin 10-15 if it is called without a status condition. In contrast to parChatWord this is only possible for one pin at a time. A table explaining all possible combinations can be found in chapter 2.4. Event-codes.
**Inputs**
~~~
pin pin number for sending trigger
~~~
**Inputs-optional**
~~~
varargin status turn on/off pin, can be either ‘1’ (on) or ‘0’ (off)
~~~
## parChatWord
function: parchatWord(repbin)
**Description**
Similar to parChat this function opens an interface with a parallel port and is able to activate or deactivate the data ports (pin 2-9). In contrast to the above parChatWord can use all 8 bits of the data port at the same time, therefore usage of the function can be a bit more challenging.
The input variable needs to be a decimal number which translates into an array representing a binary number. This array includes commands for pin 2-9 of the parallel port. Use the matlab internal functions dec2bin and bin2dec to find out which number you need to use as input for this function. Further explanation and examples can be found in chapter 2.4. Event-codes.
**Inputs**
~~~
repbin decimal number for character array representing binary number
using ‘0’ as input argument will deactivate all triggers
~~~
\ No newline at end of file