Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ramp-Hold-Back profile
I would like to make the following waveform: From 0 to 4 V in 15 ms, then hold for 10 ms, and decrease back to zero volts again in 15 ms then hold at zero for 10 ms and repeat.

Now I tried the following Matlab script:

MyPulse = [0:0.0333:5 ones(1,100)*5 5:-0.0333:0 zeros(1,100)];%15 ms(150 ticks), 10 ms (100 ticks), 15 ms(150 ticks),10 ms (100 ticks) =50 ms total; sampling rate of 10 kHz

ProgramPulsePalParam(1, 12 , 1);
SendCustomWaveform(1,0.0001,MyPulse);%10 kHz

What the oscillocsope returns is many ramp pulses (2 ms in total width), repeated every 8.9 ms and covering a total of 1000 ms. What I was expecting was a single ramp of 50 ms. By using SetContinuousPlay() I wanted to repeat this waveform, which I have not tried yet. What am I doing wrong?

Hi Dymphie,

I'll have a look tomorrow on an oscilloscope.
One note: SetContinuousPlay is for parametric pulse trains, not for custom waveforms.
If you want to loop a custom waveform, set the "CustomTrainLoop" parameter to 1.
Then, set PulseTrainDuration to for as long as you'd like to loop.

Hi again, Dymphie

I had a chance to test your code.

There was 1 error - the correct pararmeter to set was #14, not #12, in order to set output channel 1 to use your custom waveform. The function can accept the parameter name as an in put argument - and this is much better practice unless you need extreme speed optimization.
In that case, your line would read:

ProgramPulsePalParam(1, 'CustomTrainID' , 1);

So your complete program would then be:

MyPulse = [0:0.0333:5 ones(1,100)*5 5:-0.0333:0 zeros(1,100)];
ProgramPulsePalParam(1, 'CustomTrainID' , 1);
ProgramPulsePalParam(1, 'CustomTrainLoop' , 1);

I hope this helps!

Forum Jump: