CereStim API - Multi-Device Control

CereStim API - Multi-Device Control

INTRODUCTION: 

StimMEX, the MATLAB based API for controlling the CereStim 96, can be programmed to operate multiple CereStim devices at the same time. This allows for a greater degree of control over multiple CereStims compared to Blackrock’s stimulation GUI, Stim Manager. 
One important preface is that the proper syntax for this application differs from what is described in the API IFU, Rev 2.00 LB-900. This article is the currently correct method for controlling multiple CereStims via MATLAB as of API version 5.02.00. 
Most information about installation, commands, and control in the API is contained in this manual here (aside from the described differences here). Commands from this manual will be referenced, as this article walks through the basics of operating two CereStim devices at once. Attached is also a short MATLAB script containing the code demonstrated here. 



WALKTHROUGH: 

Controlling multiple CereStims is done by creating more than one stimulator object in the workspace, by running the command cerestim96() multiple times: 

stim1 = cerestim96();

stim2 = cerestim96();

From here, commands will be issued to the two objects separately. While it isn’t exactly simultaneous, this method is much faster than Stim Manager, which would require manually disconnecting/reconnecting whenever commands need to be sent to a different CereStim. 



The next step is to verify that the CereStims are connected. This is done with a single line:

DeviceList = cerestim96().scanForDevices();
This DeviceList variable will be populated with the Serial Numbers of the attached devices. This variable can be used to verify that the expected CereStim devices are connected and powered on.    


Next is assigning each stim object an actual CereStim. This step is going to diverge from the manual’s explanation, as the .selectDevice() command takes an index value starting from zero as it’s input (not serial numbers like the manual says, this will be corrected in official documentation later). Delineating which object points to each CereStim will look like this: 
stim1.selectDevice(0);

stim2.selectDevice(1);

For this case, stim1 would point to the first CereStim and stim2 to the second CereStim. The order of these is shown in the DeviceList generated earlier. This command behaves this way because the API in MATLAB is just a wrapper for the C++ version of the API, which is why the command indexes from zero instead of the MATLAB default of one.  


Now that the MATLAB objects have been correlated to physical devices, commands can be issued to the CereStims. Below is a short piece of code that will connect to each device and output its identification info to a variable: 

stim1.connect

x = stim1.deviceInfo()

stim1.disconnect

    % Connects to stim1, outputs it's device information, then disconnects


stim2.connect

y = stim2.deviceInfo()

stim2.disconnect

    % Connects to stim2, outputs it's device information, then disconnects



To verify that both stimulators can be connected at the same time, the below code executes the same commands, but with a shuffled order to connect to both simultaneously. 

stim1.connect

stim2.connect

a = stim1.deviceInfo()

b = stim2.deviceInfo()

stim1.disconnect

stim2.disconnect

    % Connects to both CereStims at the same time, and reads their info


The code demonstrated above should allow control of multiple CereStims from the same PC. More information on commands and possible applications of stimMEX can be found in the API manual here, and in this set of older example files here. 


    • Related Articles

    • CereStim API - groupStimulus

      groupStimulus is a fairly useful command in Cerestim APIs, that is described on page 44 of the IFU attached below: https://blackrockneurotech.com/research/wp-content/ifu/LB-0900_2.00_CereStim_API_IFU.pdf groupStimulus allows the end user to send ...
    • Remote Recording Control

      Customers can use the Remote Recording Control feature in Central's File Storage application to remotely begin, end, and pause their recordings. This feature utilizes the Neural Signal Processor's (NSP) or Cereplex Direct's digital input port on the ...
    • Frequency Out of Range + Low Frequency Stimulation

      The CereStim will claim its minimum frequency as 4 Hz, but there are many cases in which it will not allow the user to deliver a 4 Hz stimulation because the maximum value that can be held in memory is too long to get to that low of a frequency. It ...
    • How to Synchronize Multiple Neural Signal Processors

      Introduction Neural Signal Processors can be synchronized to achieve higher channel counts on the combined system. Hardware Requirements Neural Signal Processors with PN 4176 were not all synchronization capable. To check whether your unit is ...
    • Network Connectivity (NIC, Switches) with Blackrock DAQs

      Key points of consideration for ethernet cards (aka NIC, network interface card) in your Blackrock setup: Dedicated ethernet cards with PCI/PCIe connections are more reliable and support higher speeds. We recommend these cards over integrated ...