Delay TTL and Pulse

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Delay TTL and Pulse
#1
Hi,
I was able to use Matlab to program a TTL and  Ramp and hold pulse using the following Matlab script:

%Parameters for pulse:
Ramp_duration = 0.02;%sec
Hold_duration = 0.01;%sec
Inter_stimulus_duration = 0.5;%sec
Sampling_frequency = 2000;%Hz
Total_Duration_all_pulses = 5.5;%sec will give 5.5sec/0.55(duration of one pulse+Inter_stimulus_duraton)= 10 pulses; 11sec will give 11/0.55 = 20 pulses
Maximal_amplitude_Volts = 0.6;
%**************************************************************************
MyPulse = [0:Maximal_amplitude_Volts/(Sampling_frequency*Ramp_duration):Maximal_amplitude_Volts ones(1,Sampling_frequency*Hold_duration)*Maximal_amplitude_Volts Maximal_amplitude_Volts:-Maximal_amplitude_Volts/(Sampling_frequency*Ramp_duration):0 zeros(1,Sampling_frequency*Inter_stimulus_duration)];%20ms(40 ticks),10ms (20 ticks), 20ms (40 ticks),500 ms (1000 ticks)
% Sampling rate of 2 kHz
SendCustomWaveform(1,1/Sampling_frequency,MyPulse);%2 kHz

%TTL on Output channel 2
ProgramPulsePalParam(2,'Phase1Duration',0.001);
ProgramPulsePalParam(2,'Phase1Voltage',5);
ProgramPulsePalParam(2,'PulseTrainDuration',0.001);
TriggerPulsePal([2]);

%Actual Ramp pulse
ProgramPulsePalParam(1,'CustomTrainID',1);
ProgramPulsePalParam(1,'PulseTrainDuration',Total_Duration_all_pulses);%Last parameter in seconds
ProgramPulsePalParam(1,'CustomTrainLoop',1);%Last parameter whether to loop or not 1 means yes loop
TriggerPulsePal([1]);

By examining the PulsePal output on the oscilloscope I noted that the delay between the TTL and the ramp onset varies from 0 to as much as 67 ms approximately. How can I prevent this from happening? I need the ramp to always start at the same delay.

Anyone know?

Dymphie
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)