Kristopher Kaleb Goering (email@example.com)
Alex Belsten (firstname.lastname@example.org)
- 2015/06/30: Initial public release
- 2019/08/09: Added OutputMode
Source Code Revisions
- Initial development: 4881
- Tested under: 6003
- Known to compile under: 6003
- Broken since: --
This simple filter extension resides in the Application module and makes output with the parallel port easy.
Integration into BCI2000
Compile the extension into your source module by enabling contributed extensions in your CMake configuration. You can do this by going into your root build folder and opening
Configure.sh.cmd. In the CMake GUI, enable EXTENSIONS_PARALLELPORTFILTER and then click generate. Then recompile BCI2000. The filter will be built into the application module and will be ready for use.
The ParallelPortFilter is configured by the OutputMode and ParallelPortOutput parameters. If there are zero rows in the ParallelPortOutput matrix then nothing will be outputted to the parallel ports available on the system. See the Parallel Port Wiki for information about the pins that are available for writing to by the ParallelPortFilter.
To find the hardware address for the parallel ports for your machine, press WIN + R and enter devmgmt.msc. In Device Manager, expand the section labeled Ports (Com & LPT). If this section does not exist, you probably do not have LPT ports or the driver is not installed properly. Find the one labeled with (LPT1) or whatever port you are looking for. The label (LPT1 in this example) is the device name and is how the parrallel port is addressed in the ParallelPortOutput matrix parameter.
The hardware address can be found by right clicking the LPT port and selecting Properties. In the Resources tab, there is a field called I/O Range and take the first value of the range which is in hexadecimal. If multiple I/O Range, read the first one; if that does not work, try the other one. These instructions for finding the address has been tested on Windows XP, 7, 8 and 10.
The ParallelPortFilter is configured in the ParallelPort tab. The configurable parameters are:
This parameter effects the way that the ParallelPortOutput parameter is interpreted. There are two options for OutputMode, Word and Bit.
Bit mode is useful when the pins on the parallel port correspond to expressions that return Boolean values. The order in which the pins are written to for a LPT port corresponds to the order in which they appear in the ParallelPortOutput matrix. See the following image for an example:
In this example there are two parallel ports available on the system, LPT1 and LPT2. StimulusCode, Running and Recording are states that are set by the Application module (specifically the Stimulus Presentation module) and Source module. See User Reference:States for information on states. Data0 of LPT1 will be set high when the StimulusCode is equal to zero, data1 of LPT1 will always be low and data3 of LPT1 will be be high when StimulusCode is greater than 5. For LPT2, data0 will be set high when Running is equal to one and data1 will be high when Recording is equal to one.
Word mode allows the user to write words (8 bit values) to a parallel port. See the following image for an example:
In this example, there are two parallel ports available on the system. KeyDown and KeyUp are outputted on the LPT1 and LPT2, respectively. KeyDown and KeyUp are both 8 bit values the correspond to input from a keyboard. See User Reference:Logging Input for more information. The least significant bit of KeyDown is outputted to data0 and most significant bit is outputted to data7.
This matrix of expressions that controls the outputs on the parallel ports. There should always be two columns, Device Name and Expression. Device Name should be the LPT device you want to connect to and the output for the device is what the Expression evaluates to. For more on expressions, see Expressions.