Contributions:NIDAQLogger

From BCI2000 Wiki
Revision as of 20:33, 26 July 2010 by Jrenga (talk | contribs)
Jump to: navigation, search

Synopsis

National Instruments Data Acquisition Module

Location

Not yet in the repository. (It would be in the following directory: http://www.bci2000.org/svn/trunk/src/contrib/SignalSource/NIDAQLogger)

Versioning

Author

Justin Renga (justin.renga@gmail.com)

Version History

Source Code Revisions

  • Initial development: --
  • Tested under: --
  • Known to compile under: --
  • Broken since: --

Functional Description

Acquires signals using National Instruments Data Acquisition boards, other devices, and the computer. Device must be connected to computer beforehand.

Parameters

Command Line Parameters

Initializing NIDAQLogger

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

  • --LogDigiIn (for digital input)
  • --LogAnaIn (for analog input)

The format for the inputs for the above flags is as follows: [flag]="[device name]-[port specification]" Note that if --LogNIDAQ is used, that at least one of the three above flags MUST be used.

Device Specification

The device name (usually) is to be written as "Dev1" or "Dev2" (without the ""). Afterwards, use a - to indicate the device name is finished. If the device number is unclear, run the program with the --LogNIDAQin flag activated, and look at the Operator Log. The devices (along with their number) will be listed.

Port Specifications

There are two acceptable states that the user can specify for each port:

  • 0 - this indicates the port is INACTIVE.
  • 1 - this indicates the port is ACTIVE

Example

Let's assume that the user wants to use one device for both analog and digital input. The device has 8 Analog Input ports and 12 Digital I/O ports. The user also wants to use the 3rd and 4th analog input ports, and the 4th and 10th digital ports for digital input.

The user needs to use 3 flags to accomplish this:

  • --LogNIDAQin=1
    • This flag activates the NIDAQLogger for use.
  • --LogDigiIn="Dev1-000100000100"
    • This flag indicates that the user wants to use digital I/O.
    • "Dev1" is the name of the device connected to the computer that she wants to use.
    • 0001000000100 indicates that the user wants ports 4 and 10 (the 1's) as ACTIVE.
  • --LogAnaIn="Dev1-00011000"
    • This flag indicates that she wants to use analog output.
    • "Dev1" is the name of the device connected to the computer that she wants to use.
    • 00011000 indicates that she wants to the use ports 3 and 4 on analog input.

The full command (assuming she uses this with SignalGenerator.exe) that the user would use is the following:

SignalGenerator.exe --LogNIDAQin=1 --LogDigiIn="Dev1-000100000100" --LogAnaIn="Dev1-00011000"

BCI2000 Parameters

There are two possible parameters that the user will be able to use. They are outlined below:

  • #IVRanges - the available voltage ranges for analog input for the given device (where # will be replaced by the device name)
    • This parameter will only be enabled if the --LogAnaIn flag is being used.
  • #InSampleRate - the sampling rate for the NIDAQLogger
    • This parameter will be here if the --LogNIDAQ flag is being used.

The parameters will be located under the Source tab, in the section labeled LogNIDAQ.

States

The states that are available are dependent on the port specifications declared in the command line parameters. The format for the states is the following:

NIDev#[A:D]INPUT#

  • The first # refers to the device number.
  • The second # refers to the line number (starting at 0).
  • The [A:D] denotes if the state refers to an analog (A) or a digital (D) channel.

For example, if the command parameters look like this:

SignalGenerator.exe --LogNIDAQin=1 --LogDigiIn="Dev1-000100000100" --LogAnaIn="Dev1-10011000"

the states that will be created are the following:

  • NIDev1DINPUT3
  • NIDev1DINPUT9
  • NIDev1AINPUT0
  • NIDev1AINPUT2
  • NIDev1AINPUT3

Acquired Data

The data (analog) that is acquired by the device is translated to make sure that all of the data will fit inside of the state's parameters. Due to this fact, the data needs to be translated back in order to return it to units of milliVolts (mV). This can be done by subtracting the data by (2000*upper voltage bound). For example, if the data was logged with the range -10V to 10V, then the data must be subtracted by 20,000.