Contributions:NIDAQFilter

From BCI2000 Wiki
Revision as of 20:50, 27 July 2010 by Jrenga (talk | contribs)

Jump to: navigation, search

Synopsis

A filter that outputs different statesr from BCI2000 to outputs connected to a National Instruments Board running DAQmx 8.5 or higher.

Location

Not yet in the repository.

Versioning

Author

Justin Renga (justin.renga@gmail.com)

Version History

1.0

Source Code Revision

Not Applicable

Functional Description

The NIDAQFilter uses any DAQmx 8.5 or higher compliant board and allows the user to pipe state data from BCI2000 through the board. All necesary components must be connected to the BCI computer before initiating a module using the filter.

Parameters

The NIDAQFilter uses command line parameters to initialize the device(s) and set up the active ports. It then uses BCI2000 parameters for finer controls over the device, such as changing the sampling rate of the device.

Command Line Parameters

Initializing the NIDAQFilter

To begin using the NIDAQFilter, use the --LogNIDAQout flag and set it equal to 1. To activate device(s) for specific functions, use the following flags:

  • --LogDigiOut --> Enable the device to use digital output characteristics
  • --LogAnaOut --> Enable the device to use analog output characteristics

The format for the outputs for above flags is as follows:

[flag]="[device specification]-[port specifications]"

Please note that if --LogNIDAQout is enabled, then at least one of the above flags MUST be used.

Device Specification

The device name is to be written as "Dev1" or "Dev2" (without the quotes) in the first part of the parameter value. After the device name is specified, use a hyphen (-) to indicate the device name is finished. For example, the first part of the parameter value would look like this: "Dev1-.

If the device numbers are unclear, run the filter with just the --LogNIDAQout flag specified. The device names (along with their familiar names) will appear in the operator log.

Port Specifications

There are two acceptable states that the user can specify for each port that they are going to use:

  • 0 --> the associated port WILL NOT be used
  • 1 --> the associated port WILL be used

The values will be used for every single port that the user wants to use. For example, if the user wants to use ports 3 and 5 on a device with 10 ports, then the port specification for that device will be the following:

0010100000

Notice how even though the user wants to use only 2 ports, all 10 ports have been indicated. This is required. Any port that is not needed should be marked with a 0. If the number of ports specified in the parameter file does not match the number of ports found on the device, an error will be thrown, showing the number of ports were specified and how many ports there are for that device function.

Important: If both the NIDAQLogger(Contributions:NIDAQLogger) and the NIDAQFilter are being used, and both are using the digital lines on the same device, make sure that any port that is being referenced in a parameter is referenced only once. One port cannot use both digital input and digital output functionality, and will cause BCI2000 to throw an error, saying that the line is RESERVED.

A Completed Flag

The following is the completed flag, whose parts were described above:

--LogAnaOut="Dev1-0010100000"

The above flag tells the filter that the user wants to use the analog output ports on Device 1, which has 10 ports on it. The user wants to use the 3rd and 5th ports on the device, but leave everything else unused.

BCI2000 Parameters

After the commandline parameters have been set, more parameters may be configured in the Configuration dialog box in BCI2000. Under the header NIDAQFilter, the following parameters MAY appear, as some of them are dependant on flags being used:

  • #OVRanges [ENUMERATION] --> This parameter tells the user if there are multiple output voltage ranges that are acceptable for use. If not, then the parameter will NOT show up. The parameter is activated by the --LogAnaOut flag.
  • FilterExpressions [MATRIX] --> This parameter allows the user to associate different states to individual output lines on the board. By clicking on the Edit Matrix button, the user will see a list of the lines that are active on the board, and a space to put an expression. This parameter will always show up, regardless of the flags being used.

States

Template

The states are constructed in a contextual manner, that is to say, they are created based on the channels that the user decides to use. The template of the state names is shown below:

NI[device name][A:D]OUTPUT[port number-1]

Some key things about the template:

  • [device name] -> the name of the device to which the port is associated to (for example, if Device 4 is being used, then there will be a state that begins with NIDev4 will exist)
  • [A:D] -> analog or digital state (an analog state has a bit width of 16, while a digital state has a bit width of 1). This is dependant on the way the device is being used, and is not settable by the user.
  • [port number - 1] -> the number of the port being used (the states begin at port 0, so when port 4 is being used, the number in the state will be 3)

Example

If the following parameter list were used as a user's command line parameter:

--LogNIDAQout=1 --LogAnaOut="Dev1-00100010100" --LogDigiOut="Dev2-00100001010"

Then the following states would be produced:

     NIDev1AOUTPUT2     NIDev1AOUTPUT6     NIDev1AOUTPUT8
     NIDev2DOUTPUT2     NIDev2DOUTPUT7     NIDev2DOUTPUT9