Blackrock LED driver

  1. Setup
    • Firmware update

        Blackrock's stock firmware must be updated, to make the driver work with NIMH ML. When you receive a new driver, please bring it to Jaewon.

      Install the FTDI driver

        The Blackrock LED driver box requires the FTDI D2XX driver, which can be downloaded from the FTDI website. The easiest way to install the driver is to download the setup executable. The installation guide is available here.

      MATLAB setup

        Add the daqtoolbox and mgl directories of NIMH ML to the MATLAB path, to call the command-line functions without running NIMH ML.

  2. Command-line functions
    • id = BlackrockLED_init; % This id is required to use the other functions BlackrockLED_shot(id, intensity); % change intensity immediately BlackrockLED_load(id, intensity, duration); % load an intensity pattern without changing output yet BlackrockLED_play(id); % apply the pattern all at once BlackrockLED_clear(id); % turn off all LEDs temperature = BlackrockLED_temp(id); % get temperature readings temperature = BlackrockLED_temp(id, ver); % ver - 1: pogo pins, 2: Omnetics connectors (default) BlackrockLED_setmax(id, max_intensity); % change the max settable intensity (0.5, by default)

      intensity must be between 0 (off) and 1 (maximum current) and can be in any of the following formats.

      • a scalar (the same value for all channels)
      • a vector of 64 elements (individual value for each channel)
      • an n-by-2 matrix (a subset of the channels. [chanA intensityA; chanB intensityB; ...]). The channels not specified in the matrix are set to zero.
      • an n-by-64 matrix (n ≤ 50, patterned output). For BlackrockLED_load only. In this case, duration indicates the period of each row.

      duration is in milliseconds and must be a multiple of 2.

    • BlackrockLED_shot sequentially changes the LED state and takes ~11 ms to turn on/off all LEDs, while BlackrockLED_play needs <1 ms. For precisely timed presentations, BlackrockLED_load + BlackrockLED_play should be used.
    • BlackrockLED_play turns on LEDs only for a certain duration, but BlackrockLED_shot keeps the new state indefinately.
    • BlackrockLED_temp reads temperature in a way compatible with the Omnetics connector cable, by default. Put 1 to 'ver', to make it work with the pogo pin cable.

  3. Using the LED driver in NIMH ML
    • Let NIMH ML create the device "id" so that it can control stimulus presentation. The way to retrieve the created id from NIMH ML is shown below.
    • Only one application can be connected to the LED driver at a time, so do not declare more than one LED taskobject (or LED adapter), even when stimulating multiple times in a trial.
    • BlackrockLED_load (and perhaps BlackrockLED_setmax) is the only command-line function needed when using the LED driver in NIMH ML. Load a pattern with BlackrockLED_load before calling toggleobject (or run_scene).
    • Loading a new pattern turns off the ongoing stimulation, so wait long enough before loading another pattern to execute multiple stimulations in a trial. Repeating the same pattern does not require reloading.
    • See the "task\runtime v2\27 BlackrockLED" directory for an example of multiple stimulation.
    • Timing script v1

        LED_taskobj.txt (conditions file)

        ConditionFrequencyBlockTiming FileTaskObject#1
        111LED_taskobjgen(BlackrockLED_taskobj)

        LED_taskobj.m (timing script)

        id = TaskObject(1).ID; % TaskObject#1 BlackrockLED_setmax(id, 0.005); % change the maximum allowed intensity for safety BlackrockLED_load(id, 0.005, 500); toggleobject(1); idle(500); dashboard(1, sprintf('LED temperature: %4.1f %4.1f %4.1f %4.1f', BlackrockLED_temp(id))); idle(500);

      Timing script v2 (scene framework)

        LED_adapter.m (timing script)

        led = BlackrockLED(null_); % led.ID is the id, but you rarely need it in the scene framework led.MaxIntensity = 0.005; % or led.setmax(intensity); led.load(0.005, 500); % led.load(intensity, duration); tc = TimeCounter(led); tc.Duration = 500; scene = create_scene(tc); run_scene(scene); dashboard(1, sprintf('LED temperature: %4.1f %4.1f %4.1f %4.1f', led.Temperature)); % or led.temp(2); idle(500);

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.