LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM generation

I want to generate a square wave by comparing the triangle wave and sinusoidal wave ( for PWM). I have used signal generation for triangle and sine wave. But could find a way to compare and generate square wave...Someone please help me with this. Thank you

0 Kudos
Message 1 of 7
(3,299 Views)

Hi Deep04,

There have been questions like yours in previous forums. Please check the one below:

http://forums.ni.com/t5/LabVIEW/comparing-sine-and-triangle-waves/td-p/1097737

0 Kudos
Message 2 of 7
(3,232 Views)

excuse me, can you help me? i want to ask How to create MSPWM(modified sinusoidal width pulse modulation) pulses by comparing the sinusoidal wave with high frequency triangular wave in labview

thanks you

0 Kudos
Message 3 of 7
(3,113 Views)

What hardware do you have?  From what I can tell you're going to need hardware capable of deterministic calculations.  Meaning an FPGA or a real time OS usually in the form of a cRIO.  Do you have either of these?  And what code have you got so far?

0 Kudos
Message 4 of 7
(3,085 Views)

http://forums.ni.com/t5/LabVIEW/How-to-create-PWM-pulses-by-comparing-the-sinusoidal-wave-with/m-p/3...

 

You've posted this question in two different threads which both contain links to code that does what you are asking.  Be specific in telling us what else you need, what you have tried and why it didn't work.  We can't read your mind. Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 5 of 7
(3,071 Views)

Hello to everyone,

I am new in LabVIEW FPGA programing and I have a couple questions, so I would be grateful if you could answer me. For my final work I have to control the speed and direction  of DC motor  using sb-RIO 9636 and H-bridge L298n. In attachments you can find scheme of the H- bridge and my program. I have conected In1(pin 5 of L298n) to digital pin 1 of the card, In2(pin 7 of L298n) to digital pin 2 of the card and changing the state of the pin I change the direction of the motor(I know that the one In should be Low and the other High so the motor can rotate  in one or the other direction). PWM(Enable pin of the L298n pin 6) I have conected to DIO3.

PWM signal I cretaed is  shown in picture.

My questions are:

1.Will loop timer I used, provide that period of signal is lenght I specify in the control(for example if I put 20 000  will the period be 20000 s)?

2. Can I vary the duty cycle changing the control Waiting (DIO3 is HIGH for a couple of us, then it sets LOW, and then all that repeats )?

3. Earlier I thaugt that PWM signal I should send in both IN1 and IN2, and that the Enable pin is used to stop or start the motor. I tried that and the motor was rotating different speed, and I could stop or star the motor with enable pin, sending it HIGH OR LOW, but I could not change the direction of the motor. So my other option was to conect the pins as I explained at the begining.  My question is: Should I PWM conect to the enable pin, and will thah work?

 

Thank you

Download All
0 Kudos
Message 6 of 7
(2,980 Views)

Hi belma,

 

please don't create double posts.

Stick with your own thread!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,972 Views)