03-26-2012 01:40 PM
I have a PWM signal to turn into a % output. The rate is 1K , signal width will range from 50% ( ~.5ms ) to 90% ( ~ .9ms ). Can I use a USB- 6501 for this? Any example code you can suggest?
Thanks for any suggestions.
03-27-2012
03:32 PM
- last edited on
02-11-2025
04:57 PM
by
Content Cleaner
Hi PETERT,
The 6501 is one of our low-cost USB Digital I/O devices. I pulled up the User Guide and Specifications for this device and couldn't find anything on it. However, this device has one 32 bit counter on it, and I think this is an M series devices. I did find a tutorial that highlights how to set up PWM using Daqmx . It's not example code, but it walks you through the process.
Please let me know if I can clarify anything!
03-27-2012 05:17 PM
Thanks for that infromation. I took a look at the link to NiDAQmx and it seems to deal with generating the PWM pulse train. My application needs to get the duty cycle from an existing pulse train. Any suggestions / examples for that?
03-28-2012 11:39 AM
Hey PETERT,
I can't think of a VI that we have that specifically does that from a pulse train. How was this pulse train created? If you wrote it using daqmx, you probably specified a duty cycle somewhere in generating the pulse train or left it to be a default value. Default values are usually 50%, but it's dependent on the VIs used.
If you generated it externally, you might be able to put in a "Get Date/Time" vi for when a 0»1 (transition A) transition occurs, 1»0 transition (Transition B), and the next 0»1 (Transition C) transition and do the math with it. You could take Time C - Time A to get the period length. If you take (Time B-Time A)/(Time C-Time A) you;ll get the period the signal was high over the entire period. This will give you the duty cycle as a percentage of high time. One thing to be careful of though is that the all of the duty cycles could be just slightly different. If you do this, you'd probably want to average all the results to get the duty cycle.
Hope this helps!
03-28-2012 12:23 PM
Lea,
I guess I should have provided a bit more information up front. This pulse train is the OUTPUT from a sensor. An absolute position encoder. The Duty cycle is the analog information we need.
This pulse train is connected to a DIO input pin.
The device I currently have is the USB 6509 ( the lowest end device, I know) .
There are several questions:
I found this vi : Meas Semi-Period.vi It uses DAQmx and returns the semi Period.
The USB-6509 is not listed as a compatable device.
Working up in price from the 6509 - which devices will work for the least $
I can understand how your suggestion works. My understanding of the USB devices is that because of timing issues the measurements need to use the counter in the Device. The USB 6509 has a counter but I have found no examples of how to use it for this. If it can't be done with the 6509 then let me know and I'll move to something more suitable.
Thanks
03-29-2012
01:19 PM
- last edited on
02-11-2025
04:58 PM
by
Content Cleaner
You're right that the USB-6501 isn't listed as one of the compatible devices. This is because the 6501 doesn't have a counter, and the example requires a counter imput.
To run this, be sure that the signal is hooked into the correct areas. What breakout board for this are you using? This device only has one counter on it.Because of this, there wont be a way to directly do this on this device.
I would strongly encourage you to contact NI to speak with your account manager since you don't currently have a device. He or she will be more knowledgeable on pricing and variety of our products. They'll probably be able to best work with applications engineering and your specific account to find a product that best suits your application, needs, and budget.