LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Another PWM question....

Ok, I need to thank you guys for the help thus far.  Currently I am able to read in two separate square wave signals off of my NI PCI-6040E daq board.  Now to close the loop on my particular controller I need to generate an output signal using the two inputs and some subsequent math operations.  My problem derives from the counter issue, which I am not familiar with.  The board I'm using has two counters which are both tied up in reading inputs.  This leaves no counter for the output signal which seems to appear in every example pulse generation VI that I come across.  Is it possible to generate these pulses without a counter or using the same counter as one of the inputs?  Let me know if there is any way around this issue, any help would be much appreciated.
-Nick
0 Kudos
Message 1 of 5
(3,034 Views)
Hi Electramotive,
Im assuming you need to output some sort of pulse train? You could try using the analog output to generate a pulse train signal. Have a look at the LV example 'PWM - Analog Output.vi' to get some ideas. Hope this helps.
0 Kudos
Message 2 of 5
(3,030 Views)

Hi Nick,

Generally, pulse train generation is performed with a counter.  It can also be done with digital lines but your DAQ board does not have hardware timed digital outputs, so you would only be able to output pulses on your digital lines as fast your while loop can iterate.  Therefore, analog output might be your best choice.  The example David referred you to is a Traditional NI-DAQ (Legacy) example.  If you would rather use NI-DAQmx, there are many analog output examples in the Example Finder.  You can find them by going to Help >> Find Examples >> Hardware Input and Output >> DAQmx >> Analog Generation. 

Thanks,

Laura

0 Kudos
Message 3 of 5
(3,007 Views)
Thanks for the suggestions people.  I have two glaring problems at this point: My daq board only has two counters which are both occupied to calculate my inputs, and I am using (ahem) Labview 5.0.  Thus I am leaning toward going the digital route to generate the output signal and am crossing my fingers that speed will not be a major issue.  Within Labview 5 tho, I am having difficulty finding examples for generating digital pulse trains.  My specifications are quite simple - square waves with a duty cycle and frequency that can be altered.  Any help or examples would be great.
Thanks,
Nick
0 Kudos
Message 4 of 5
(2,998 Views)

Hello Nick,

In the example finder, there is an example called "Write 1 Pt to Dig Line.vi" that you could use.  To create a pulse train, you would write a high and then low value in a while loop.  The duty cycle will be completely software timed, and will depend on how much time you have between writing the high value and the next low value.  The frequency will also be completely software timed and will depend on how you setup the timing of your while loop.  Remember that windows is not deterministic and can interrupt LabVIEW whenever it wants so there will be a variation in the amount of time it takes your loop to iterate. 

Hope this helps,
 
Laura
0 Kudos
Message 5 of 5
(2,986 Views)