LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

comparing sine and triangle waves

hello everyone,

 

i'm a student from belgium and i have to program an BLDC motor with labview. for this i need a PWM (pulse width modulated) signal. i want to do this by comparing a sine wave with a triangle wave, theoretically this should give me

block wave with different duty cycle. i have added a picture to make my question more clear.

 

PWM.PNG  

as you can see there are two triangle waves to compare with the sine wave, every time one of the triangle crosses the sine wave a pulse is generated and stays high untill the next cross.

 

thanx in advance 

0 Kudos
Message 1 of 19
(7,723 Views)

Hi Kapoew

 

Have a look at this community example. Should give you a place to start.

 

Best Regards

 

David

NISW

0 Kudos
Message 2 of 19
(7,710 Views)

hi, thanks for the quick reply, i have a small problem i'm working with labview 8.5

so i can't open the VI is there a possibility on how to do this? like a small converter or something like that?

or should i just download the evaluation version from national instruments? 

 

thx in advance 

0 Kudos
Message 3 of 19
(7,694 Views)

Hi

 

I converted it to 8.5 for you.

 

Best Regards

 

David

Message 4 of 19
(7,680 Views)

hi, again thanks for converting it to 8.5.

 

i have another question about this topic. when i want to add a phase shift of 240° to the sine wave i'm getting this error:

LabVIEW:  (Hex 0xFFFFF8F6) Waveforms have different dt values.

but for 120° it isn't a problem. i changed the original VI but can't upload it to this topic so i added a picture.

 

problem.JPG 

 thanks in advance

0 Kudos
Message 5 of 19
(7,658 Views)

I don't have LV here to check, but I think the waveform VIs expect the phase in radians, not degrees. 240 rad is quite a lot, so this might cause problems. Try 4*pi/3 as phase.

 

 

0 Kudos
Message 6 of 19
(7,647 Views)
hi thanks for the reply, but 4 x pi / 3 doesn't work it gives me a phase shift of 4,1° so LV works with degrees instead of radians i guess. but still thanks for trying.
0 Kudos
Message 7 of 19
(7,641 Views)

If you look at the waveforms going to the "-" operator, what dt does it give for both signals?

 

0 Kudos
Message 8 of 19
(7,619 Views)

HI

 

I believe the problem is because dt is a floating point number. Floating points and strict equality aren't exactly the best of friends. I would do one of three things:

 

1. Replace the t0 and dt in one waveform with one from the other. Shouldn't make any difference since you are using the same sampling info, but it's the quickest solution so it's worth a try.

2. Extract the data array (Y) from the waveforms using the Get waveform components VI and subtract them, then rebuild the waveform (Build Waveform VI). Better solution, higher probabilty of success

3. The compared signals you are creating from the sawtooths and sine are digital, they are just represented by a analog waveform. From the image in your first post it looks like you are after a digital signal. Why not convert the signal to digital (Can be set in the From DDT VI) and use an XOR operator on them instead of a subtract?

 

Best Regards

 

David

Message Edited by Davidek on 03-29-2010 02:02 AM
0 Kudos
Message 9 of 19
(7,592 Views)

Hello,

 

When i tried to reproduce this problem, I couldn't succeed in it.

While looking at you jpeg I noticed that you have connected something to the channel input of your ddt to waveform convertors. You should remove this (except if this was your intention) and then everything should work.

If this doesnt work, then you can always use the file attached to this post.

 

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 10 of 19
(7,582 Views)