What I'm doing and what i'd like to do:
1. I'm using the USB DAQ6009 to read in the Current (actually the voltage drop over a resistor) supplied to a DC motor. (Using analogue input, 1 sample,as fast as possible, inside a while loop)
2. Because of commutators, as the motor spins you get dips in the voltage as the commutators make and break connectors.
3. If you do spectrum analysis of the data out (dynamic signal) you basically get a peak relating to the frequency of the rotation
4. So far so good.
5. I would like to trigger an event based upon the rotation speed of this motor (see image) - possibly a TTL signal/square wave.
6. The issue is, the motor speed changes, and i would like the freq. of the square wave output to match the freq. i measure in the analogue in signal.
7. I think i should be able to do this with a Pulse Width Modulation (effectively a square wave) on the digital out.
(more see herE: http://zone.ni.com/devzone/cda/tut/p/id/2991 )
What i can't work out is actually how to go from these counters, duty cycles and so on, to actually pursuading my DAQ to generate a output signal for me.
How to i get this "counter" square wave into my DAQ assistant, and then out, phyically down a wire ???
Any help is most appreciated.
What sort of frequency. As a search of 'pwm 6008 (or 6009)' would show, the device is not at all suited for pwm except at very low frequencies. The digital and analog outputs are software timed and any bit stream you output is going to be subject to quite a bit of jitter and low resolution. When you do your search, you will find some examples of pwm using your device. The link you found does not at all apply to the 6009.
p.s. You method of analog acquisition is also subject to quite a bit of jitter and low resolution because you are only taking a single sample at a time and using software timing instead of the hardware timed analog acquitition that the device is capable of.
I also have access to a USB 6211 DAQ. Would this be more suitable? I know this will do 250kS/s.
This may sound like a really dumb question, but how can you ensure that the timing of the data collection is running at its highest, maximum resolution ?
If i were to use the 250kS/s on the 6211, at at a frequency of 50Hz (my intented freq.), that would give me 5000 points by which to analyse my input signal, and also 5000 points per pulse.
would this be better ?
The 250kS/s has nothing at all to do with generating the pwm. As in the link you originally posted, the pwm is generated by the counter output of a DAQ card. A counter output that the 6009 does not have but the 6211 does (80MHz). The analog acquisition clock and the counter are separate.
You ensure the greatest resolution by doing NSample acquisition instead of single sample. Then the analog acquisition is hardware timed. The 6009 also has hardware time analog acquisition, though you were not using.
To summarize, the 6211 would be much better suited to generating the pwm signal.
This means I can not control the position of a servo motor using a DAQ 6009??? Is there anyway I can move it to a certain position using this DAQ, if not through a PWM??