04-27-2009 04:02 AM
Hi,
I drive a electromagnet with a square signal with variable frequency and duty cycle.
I'm trying to change these parameters on the fly, which is possible with the frequency but not with the duty cycle.
Could someone help me ?
You can see attached a print screen of an abstract of my VI .
_____________________________
French : Français :
Bonjour,
Je pilote un électroaimant avec un signal carré de fréquence et duty cycle variables.
Je cherche à modifier ces paramètres en temps réel, ce qui est possible avec la fréquence mais je n'y arrive pas avec le duty cycle alors qu'ils sont modifiables depuis la même commande.
Quelqu'un saurait-il pourquoi ?
Ci joint un print screen d'un bout de mon programme, on y voit la commande de la fréquence et du duty dans la boucle while.
Merci
04-28-2009 06:17 AM - edited 04-28-2009 06:19 AM
Hi sylvian,
your VI looks good. I don't see an error. Can you tell me what kind of Hardware you have? Maybe the property to set the duty cycle is not supported for your device.
With a righ-click on the property node >Select Filter you can select which Properies are shown. Choose "Show Attributes For selected Devices" and select only the DAQ-Device you want to set the duty cycle.
I hope this will help you,
Cheggers
04-28-2009 06:29 AM
Thanks Cheggers,
I finally changed my tactic : I use now the DAQmx write.vi, so I am able to change this parameter in live. My final goal is to have an on-the-fly adjustable PWM.
Cheers,
Sylvian
04-28-2009 06:34 AM
Hi Sylvian,
here is an interesting link for you:
http://zone.ni.com/devzone/cda/epd/p/id/5712
I think that's what you have done...
Have a nice day!
Cheggers
04-29-2009 05:17 AM
Hum.. yes, more or less 😉
Another question : how can we predict the frequency at which a loop (while for instance) will execute itself ? Is there a simple link between all the hardware around the bench, the functions used in LabView and this frequency ? I know it is quite trivial, but I was wondering, and did not find any answer so far...
Cheers,
Sylvian
04-29-2009 06:14 AM
you have two timing functions in the timing palette: "wait" and "wait until next ms multiple". They have two mean functions:
1. Control the frequency at which a loop executes
2. Provide the processor with time to complete other tasks, such as processing the user interface
There is a small but important difference between this two timing functions. A good explanation of the difference and how they work can you find here:
http://digital.ni.com/public.nsf/allkb/12B2EA9AD5B265AD86256257004DD8E2?OpenDocument
Or you use the timed loop structure. Like an express VI, you can make a double-click on the timed loop and set some properties like loop timing or processor assignment. This is very useful if you have multiple cores in your computer or have a realtime target (for example FPGA):
http://digital.ni.com/public.nsf/allkb/F8D89E07C355EF87862572150062CC85?OpenDocument
http://digital.ni.com/public.nsf/allkb/A775216BBDBB47A086257540007D8112?OpenDocument
Hope this helps!
Cheggers
04-29-2009 07:19 AM
but I don't use any time control, I just let time running as fast as it can... I use an indicator on the index of my loop to know how many loops per second I have, but I have no idea if this value is correct regarding the clock of the uP of my computer, the caracteristics of my DAQ PCI cards, and all the LabView components I use in my VI. See what I mean ?
Sylvian