Showing results for 
Search instead for 
Did you mean: 

looking for sample code of pwm output with Labview 7

we are looking for sample code in LabView 7 for producing a pwm output. We are current using a 3rd party digital I/O board and just want to generate a pwm output on several of the bits.
0 Kudos
Message 1 of 4
Hi Bronx68,

Since each device has its own API for accessing it from LabVIEW, I cannot give you too concrete of advice. I can tell you that DAQmx is one example of this API that we provide for our DAQ boards. For more information on DAQmx, click here.

LabVIEW also has the cababilty to interface with external code such as DLLs, and this is something that 3rd party manufacturers usually provide to you - a set of LabVIEW VIs that will call some of their dll files. I recommend that you contact this company to see if they have something like that.

If you simply need LabVIEW code and already have the interface working, it would be a matter of using a shift register and a while loop, and using some logic each time through to determine whether or not to toggle the boolean value based on the period and duty cycle.

Best regards,
0 Kudos
Message 2 of 4


     I've got the interface working but do you have an example of using a shift register to create a pwm?



0 Kudos
Message 3 of 4
Hi Ray,

There are several ways to do this, and in the example I created, I actually did not end up using shift registers. I've attached some example code that basically multiplies the period by the duty cycle percentage to achieve the number of milliseconds to be high and low.

You would just need to insert your DIO code in each frame of the sequence structure.

Hope that helps. Kind regards,
0 Kudos
Message 4 of 4