ni.com checkout is currently experiencing issues.

Support teams are actively working on the resolution.

Power Electronics Development Center

cancel
Showing results for 
Search instead for 
Did you mean: 

Software based PWM signal

Hello everyone,

I am doing a project on co-simulation, now I was wondering if anyone knows how to generate a fully software based PWM signal in Labview.

Every example I find about it is using a fpga or myDAQmx, but I do not use one of those, it only needs to work software based.

I hope someone can further help me.

Kind regards

Wlew

0 Kudos
Message 1 of 6
(4,949 Views)

Hello WIew,

I'm not sure to clearly understand the issue. But if you want to generate a square wave and control its duty cycle, pick a look in he paltette Signal Processing » Waveform Generation (requieres Full Development System):

contextHelp.png

Let me know if it helps.

Best regards,

     Mathieu.

0 Kudos
Message 2 of 6
(3,689 Views)

Hi Mathieu,

Thanks for the reply, I tried to work with the square Waveform.vi, but I need a frequency of 50KHz and then LabVIEW gives me an error. The error has something to do with the sampling frequency and when I change the sampling frequency to a value that is twice the frequency (Nyquist ratio) the Square waveform.vi gives me an triangular output. I am trying to figure out what is the problem, but at the moment I have no idea what it could be.

Best regards

Wlew

0 Kudos
Message 3 of 6
(3,689 Views)

Okay, just adjust the sampling info. Nyquist ratio is a theorical value. In practive, you often need 5 or 10 times your signal frequency as sampling frequency. If your requiered frequency is 50kHz, try with 1MS/s, this will allow a 5% resolution for your PWM. Be carefull with the number of samples: you can generate an unnecessary hudge amount of data...

0 Kudos
Message 4 of 6
(3,689 Views)

Hi Mathieu,

Thank you very much for your help, when I set the sampling frequency at 1 MS/s like you said, I get a nice square wave again and I can properly adjust the duty cycle.

Thank you for your help

Kind regards

Wlew

0 Kudos
Message 5 of 6
(3,689 Views)

hi,

instead of trying to create PWM signals from square waveform ( by adjusting the duty cycle), try to implement your own PWM technique.

You can easily generate sin and triangular waveforms and implement Sinusoidal PWM with variable modulation index by controlling the amplitude of the waveforms. or you can implement some other PWMs also...

if its fully software based PWM means, u can try it easily in labview..

Thanks & Regards,
Rajasekaran V
0 Kudos
Message 6 of 6
(3,689 Views)