Code examples

Example: produce a 120-second pulse train of 2.5V, 2ms square pulses at 10Hz on output channel 1. The pulse train is to be triggered and subsequently aborted by a pair of incoming TTL pulses on trigger channel 1.


% Method 1: less compact but more human-readable code.

load PulsePalProgram_Example; % Loads the default parameter matrix

ProgramPulsePal(ParameterMatrix); % Sends the default parameter matrix to Pulse Pal

ProgramPulsePalParam(1, 'Phase1Voltage', 2.5); % Set output channel 1 to produce 2.5V pulses

ProgramPulsePalParam(1, 'Phase1Duration', 0.002); % Set output channel 1 to produce 2ms pulses

ProgramPulsePalParam(1, 'InterPulseInterval', 0.098); % Set pulse interval to produce 10Hz pulses

ProgramPulsePalParam(1, 'PulseTrainDuration', 120); % Set pulse train to last 120 seconds

ProgramPulsePalParam(1, 'LinkedToTriggerCH1', 1); % Set output channel 1 to respond to trigger ch 1

ProgramPulsePalParam(1, 'TriggerMode', 1); % Set trigger channel 1 to toggle mode


% Method 2: using one command to sync all parameters (more compact)

load PulsePalProgram_Example; % Loads the default parameter matrix

ParameterMatrix(2:13, 2) = {0 2.5 0 0.002 0 0 0.098 0 0 120 0 1}; % Set output channel 1 parameters of interest

ParameterMatrix{2,8} = 1; % Set trigger channel 1 to toggle mode

ProgramPulsePal(ParameterMatrix); % Send matrix of parameters to Pulse Pal