|
|||||||||||||
05-17-2012 05:47 PM
I am trying to generate a PWM (standard servo, 50 Hz, duty cycle 5-10%) with a USB-6211. I am on a Linux system so I am using the DAQmx Base C API. Following the example code supplied with DAQmx Base, I can define the frequency and duty cycle I want and start the task with no problems. However, I will need to update the duty cycle as the task is running. I have done this using the DAQmx Write VI on a full LabView Windows system in the past. However, I don't see the relevant write function in the DAQmx Base API. Does anyone know the proper function in the API to update the duty cycle of a running PWM generation task?
05-18-2012 05:40 PM
Hi Mgreytak,
Have you tried using a channel property node?
http://digital.ni.com/public.nsf/allkb/82C9F3C15F6
05-21-2012 08:01 AM
Hello,
I can do that with a VI when running LabView, but I am using DAQmx Base (the C API). Do you know how to do it in DAQmx Base? I have tried using the DAQmxBaseSetChanAttribute function to change the DAQmx_CO_Pulse_HighTime attribute of the counter output channel but I get a runtime error "Specified property is not supported by the device, is not applicable to the task, or is not implemented."
Thanks,
Matt
05-22-2012 06:19 PM
Hi Mgreytak,
I found a document which shows a different approach:
http://zone.ni.com/devzone/cda/epd/p/id/5712
I believe this will work with DAQmx Base.
05-22-2012 09:04 PM
mgreytak wrote:
I am trying to generate a PWM (standard servo, 50 Hz, duty cycle 5-10%) with a USB-6211. I am on a Linux system so I am using the DAQmx Base C API. Following the example code supplied with DAQmx Base, I can define the frequency and duty cycle I want and start the task with no problems. However, I will need to update the duty cycle as the task is running.
<snip>
I have tried using the DAQmxBaseSetChanAttribute function to change the DAQmx_CO_Pulse_HighTime attribute of the counter output channel but I get a runtime error "Specified property is not supported by the device, is not applicable to the task, or is not implemented."
Unfortunately, the error text in this case is correct: changing the value for the DAQmx_CO_Pulse_HighTime attribute while a task is running has not been implemented for NI DAQmx Base [1]. Since it appears your application requires on-the-fly updates, as opposed to stop-reconfigure-start updates, please contact your local NI representative and he or she can work with my group to evaluate further options.
[1] NI-DAQmx Base 3.5 for Linux "SUPPORTED FUNCTIONALITY" section
http://download.ni.com/support/softlib//multifunct
National Instruments
Software Engineer :: Measurements RLP Group
Applications Engineer :: High Speed Product Group (until Sep 2008)
Get with your fellow OS users :: [ NI's Linux User Group ] [ NI's OS X User Group ]
Get with your fellow developers :: [ NI's DAQmx Base User Group ] [ NI's DDK User Group ]
05-23-2012 10:39 AM
Thanks Joe. For now a workaround is to generate one pulse at a time; after each one, stop and clear the task then restart it with the new duty cycle. It takes some time to stop and restart the task so instead of my desired 20 ms period it's more like 45 ms... however, the servo I'm controlling does not seem to mind the longer period as long as the hitime is consistent. Not ideal, but good enough for now.
Thanks again,
Matt
My Profile | Privacy |
Legal |
Contact NI
© 2011 National Instruments Corporation. All rights reserved. | E-Mail this Page
|
||

E-Mail this Page