03-24-2010 09:57 AM
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.
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
03-24-2010 10:56 AM
Hi Kapoew
Have a look at this community example. Should give you a place to start.
Best Regards
David
NISW
03-24-2010 07:49 PM
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
03-25-2010 02:56 AM
Hi
I converted it to 8.5 for you.
Best Regards
David
03-27-2010 01:23 PM
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.
thanks in advance
03-27-2010 05:50 PM
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.
03-27-2010 07:45 PM
03-28-2010 09:18 AM
If you look at the waveforms going to the "-" operator, what dt does it give for both signals?
03-29-2010 02:01 AM - edited 03-29-2010 02:02 AM
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
03-29-2010 02:49 AM
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.