LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create a pulse train with varying pulse widths?

I'm trying to create a finite pulse train that varies its duty cycle. I was hoping there was a clever way to do this neatly. I've attached a very rough picture of the train I'm hoping to make, with the pulse widths defined with t, the delay between pulses d, and a total of N+1 pulses. Thanks!

 

Edit: My current method is to use the pulse train function, and actually create 2N+1 pulses, stacking the "double length" pulses.

0 Kudos
Message 1 of 5
(2,177 Views)

This pseudo code should do the trick.

 

pulse train (time,t,d)

    cycle=floor(time/d)

    timeintocycle=time-cycle*d

    if timeintocycle<=(cycle+1)*t return high else return low

end function

 

 

0 Kudos
Message 2 of 5
(2,142 Views)

I wound up just building the first short pulse, and then the train of longer pulses, and sticking them together. I attached a screenshot of the code I went with.

0 Kudos
Message 3 of 5
(2,121 Views)

Hey don't go overboard with the gratitude.

0 Kudos
Message 4 of 5
(2,108 Views)
Like going overboard with the local variables. None of those are necessary.
0 Kudos
Message 5 of 5
(2,104 Views)