(1) Add the channels to the initialisation file:
Modifying the following lines as shown in this example given for a single digital output named ‘digi’ on /dev1/port0/line1:
%Stimulator channels (Digital Output) digStimChannelNames = {'digi'}; % Cell array of descriptive names for digital output stimulus channels to configure, e.g. {'Camera Trigger' 'LED Pulse'} digStimBoardIDs = [1]; % A single number (e.g. 1 for 'Dev1') specifying DAQmx board for /all/ named digital stimulus channels; or, an array of numbers of length equal to 'digStimChannelNames' (e.g. [1 1 1 2 2] indicating 'Dev1' for first 3 channels, 'Dev2' for last 2 channels) identifying DAQmx board on which each of the named digital stimulus channels appears. digStimPortIDs = [0]; % A single number (e.g. 0 for Port 0 (P0)), or array of numbers of length equal to 'digStimChannelNames' (e.g. [0 0 0 1 1] indicating Port 0 (P0) for first 3 channels and Port 1 (P1) for for last 2 channels), identifying DAQmx board on which each of the named digital stimulus channels appears. digStimLineIDs = [1]; % Array of numbers, of length equal to 'digStimChannelNames', identifying DAQmx line number (e.g. 1 for P0.1, P1.1, etc) for each of the named digital stimulus channels (e.g. [0 1 2 0 1] indicating P#.0-2 for first 3 channels and P#.0-1 for last 2 channels, for case of multiple ports).
(2) Add the new channel to stimChannelNamesOrder
Like so (an example is shown for a standard mapper configuration plus two analog outputs ‘ao4’ and ‘ao5’):
stimChannelNamesOrder = {'shutter0', 'pockelsCell', 'xMirror', 'yMirror', 'ao4', 'ao5', 'digi'}; % Cell array of all Stimulator channel names -- analog, digital, and Mapper configured -- in desired order of appearance in Stimulator
(3) Set sampleClockOrigin and sampleClockDestination:
As appropriate for the NI DAQ boards you’re using; e.g. the following example works for a standard set up using USB-6229 or USB-6259 boards:
sampleClockOrigin = '/dev1/ctr0'; % Full DAQmx specification of single counter output channel on /one/ board (e.g. '/dev1/ctr0') on which the sample clock generated by Ephus appears. Ephus employs the default DAQmx routing of counter output channels to PFI output terminals (PFI12 for CTR0, PFI13 for CTR1; refer to DAQmx documentation for further information)sampleClockDestination = 'PFI1'; % A DAQmx PFI or RTSI terminal name (e.g. 'PFI1' or 'RTSI7') on which sample clock is input on /all/ of the boards configured for use by Ephus
For other devices, please consult your board’s documentation for appropriate setup. You can see the available routes in Device Routes panel of NI MAX.
(4) Modify line 30 of <Ephus installation folder>\USERCLASSES\@pulseMap\getDigitalData.m to the following:
data(data ~= 0) = intmax('uint32');
(5) Start Ephus with your modified initialisation file.
The new digital output channel(s) can be used in stimulator, pulseJacker, etc similarly to analog outputs. Normal pulseEditor pulses can be used, however note that the amplitude is effectively ignored: any non-zero samples in your pulse will result in 5V being output and zero-valued samples will give 0V.
---------------------------------------------------------------
added 2017-07-12 – J. Barrett, G. Shepherd