05-17-2005 11:51 AM
05-18-2005 07:29 AM
05-18-2005 02:13 PM
05-18-2005 02:32 PM
03-29-2007 10:53 AM
Hi,
I've been using the example you linked as a stepping stone to creating a Pulse Width Modulation program that will control a DC motor by means of Pulse postitioning: is there a way to make this setup send a finite number of pulses as opposed to the continous/infinite number of pulses it does just now?
Any help would be greatly appreciated
Thanks,
John
03-30-2007 12:55 PM - edited 03-30-2007 12:55 PM
Hi,
You can create a finite pulse train with custom frequency and duty cycle by simply using the LabVIEW example program, “Gen Dig Pulse Train-Finite.vi”. During the creation of the virtual channel, you can set the duty cycle and frequency before starting the task. However, these parameters cannot then be modified during the actual output.
On the other hand, you could still use a continuous counter output, but use software to stop the task after a certain time period. For instance, in the example posted above, the frequency and duty cycle can be changed once per second according to the execution timing of the while loop. Instead of stopping the loop when the Stop button is clicked or when an error is received, consider stopping the while loop after a certain number of iterations, giving it similar functionality to a for loop. You can include the execution timing, and you will still be able to change the frequency and duty cycle during the output.
If you decide to take this approach, I would recommend using a while loop instead of a for loop because you can include the error cluster as a stop condition – for loops don’t have easily implemented break statements in LabVIEW. There is a picture of this below.
I hope this helps. Post back if you have any further questions.
Ed W.
Applications Engineer
National Instruments
Message Edited by Ed W on 03-30-2007 12:56 PM
03-30-2007 03:29 PM
04-03-2007 06:03 AM
Hi,
Thanks for responding so quickly; and thankyou for the suggestion: I've taken the vi and made a couple of small modifations.
As you may have guessed, I'm something of a novice with Labview, so forgive me if this next question sounds stupid!
How do I implement a "Go" button into the program so that when the program is run, the pulses are not generated until the user clicks the "Go" button? I presume a structure of some description is required (case or stacked/flat?), but I can't seem to get any structures to work properly.
Any help would be greatly appreciated,
Thanks,
John
04-04-2007 09:49 AM
Hi John,
To implement this functionality, you’ll probably want to use an event structure around your code. The event structure will allow you to execute code when a specific event has taken place. In this case, the event will be a button press and the code will be your data acquisition. There is a nice example program that demonstrates this functionality, along with a PPT presentation that goes into more detail about event structures.
Using the Event Structure in LabVIEW with a Boolean
I would recommend going through the presentation to make sure you fully understand the subtleties of event structures. Event structures do not follow LabVIEW’s dataflow paradigm, so be sure to not overuse them as it may introduce bugs into your program that are difficult to troubleshoot.
I hope this helps.
Ed W.
Applications Engineer
National Instruments
04-04-2007 10:16 AM