Hi Josh,
so I added the three lines of code after line 667 in the firmware. I assume it adds a fourth option to the Trigger parameters. I understand in theory what I need to do but I simply do not know how to communicate this via Matlab to the PulsePal. I have the following Matlab code:
load PulsePalProgram_Template; % Loads the default parameter matrix
ProgramPulsePal(ParameterMatrix); % Sends the default parameter matrix to Pulse Pal
%TTL on Output channel 1 to send TTL to Solenoid driver
ProgramPulsePalParam(1, 'Phase1Voltage', 5); % Set output channel 1 to produce 1V pulses
ProgramPulsePalParam(1, 'Phase1Duration', 0.001); % Set output channel 1 to produce 12ms pulses
ProgramPulsePalParam(1, 'InterPulseInterval', 9.999); % Set pulse interval to produce 0.1 Hz pulses
ProgramPulsePalParam(1, 'PulseTrainDuration', 200); % Set pulse train to last 200 seconds
ProgramPulsePalParam(1, 'PulseTrainDelay', 5); % onset latency prior to pulse train is 10 seconds
ProgramPulsePalParam(1, 'LinkTriggerChannel1', 1); % Set output channel 1 to respond to trigger channel 1
ProgramPulsePalParam(1, 'TriggerMode', 1); % Set trigger channel 1 to toggle mode
%TTL on Output channel 2 to Smartbox
ProgramPulsePalParam(2, 'Phase1Voltage', 5); % Set output channel 1 to produce 1V pulses
ProgramPulsePalParam(2, 'Phase1Duration', 0.001); % Set output channel 1 to produce 12ms pulses
ProgramPulsePalParam(2, 'InterPulseInterval', 9.999); % Set pulse interval to produce 0.1 Hz pulses
ProgramPulsePalParam(2, 'PulseTrainDuration', 200); % Set pulse train to last 200 seconds
ProgramPulsePalParam(2, 'PulseTrainDelay', 5); % onset latency prior to pulse train is 10 seconds
ProgramPulsePalParam(2, 'LinkTriggerChannel1', 1); % Set output channel 2 to respond to trigger channel 1
ProgramPulsePalParam(1, 'TriggerMode', 1); % Set trigger channel 2 to toggle mode
So the PulsePal receives a TTL on TriggerChannel 1 and this starts the above pulse sequence. It simply sends out two TTLs, one to our solenoid activating an air puff and the second to my acquisition program to indicate the air puff time point in my recordings. I want the program to continue this pulse sequence up until 200 s is reached or another TTL is received on TriggerChannel 2. At this time I want the pulse sequence to stop. Basically, TTL on TriggerChannel 1 starts the pulse sequence, while TTL on TriggerChannel 2 stops the pulse sequence, indefinitely.
By using the function ProgramPulsePalParams, I simply define all the needed variables, these are saved and recalled once a signal is received on TriggerChannel 1. Do I link both channel 1 and 2 to TriggerChannel 1 and 2 and thus add the following lines to each of the above TTL pulses:
ProgramPulsePalParam(1, 'LinkTriggerChannel2', 2); % Set output channel 1 to respond to trigger channel 2
ProgramPulsePalParam(2, 'TriggerMode', 3); % Set trigger channel 2 to stop mode
I guess I'm confused about how to communicate this to the PulsePal.
Please let me know if I'm on the right track.
Thanks,
Ilja