i have posted this question even before, however, did not get a proper solution. i would like to know what is the best technique to acquire AI and Counter inputs on PFI channels using
DAQmx on USB-6225/ USB-6229.
I wrote few programs before, however, i am getting zero's in my counter channel data.
is this a sync problem? i am sampling AI and counter both at 10Hz.
What I just did is to combine the "Cont Acq&Graph Volt-Int Clk.vi" and the "Count digital Events.vi" so I can acquire an analog input and counter rising edges, and it works just fine. Here you have a screenshot. Also, what do you mean by acquire both at 10 Hz? If you are just counting edges of a train pulse, you don't need to use the polymorphic Timing VI, so you don't specify the sampling rate. Hope this helps.
thanks for posting, the VI you provided will only calculate the edges... things become complicated say if you want to calculate RPM of a rotating shaft. then the edges need to be converted to frequency, and in turn RPM.
also, if you want to save both the analog input and the RPM into 1 single file at the same rate, you happen to mis-match the writing and data acquisition rate...
In this case, would you like to have the last acquired sample from the Analog Input, once the measurement of the frequency is made? If that is the case, please take a look at the attached screenshot for the VI I made. If you run it, it won't give you the last sample of the AI until the last frequency measurement is made. Is this what you are aiming for? In this case I modified the example "Meas Dig Frequency-Low Freq 1 Ctr.vi"
REDS, this is not what i intend to do... i want continous measurement of both freq and analog inputs, what you performed is indexed data, and probably the internal buffer will get filled up after few minutes... (this is also depend on sampling freq, higher the freq, quiicker the buffer will get filled)...
What I did was continuous acquisition, as you can see from the sample mode node in the Timing VI. What I did was just adjust the VI so that you would have the latest AI sample as soon as a frequency reading is made. If you want the AI to be independent from the Frequency reading (done by the counter), you can just put two separate while loops and you will have continuous acquisition for frequency and AI. Please further explain your application in case I am missing something.
Regarding the buffer being filled, you are right that the buffer in some occasions may become filled and cause an overwrite error, but this is not the case since I am reading from the PC buffer faster than I am acquiring the samples from the DAQ to the PC buffer.
REDS, the approach you mentioned works great if you just want to record data, however, problems arise when you want to save both AI nad RPM into 1 file as shown in the example format below...
you observe that the timings are mis-matched and you get 0's in the RPM channel even if the RPM was never 0.
Can you upload your code or a screenshot of the block diagram so that I can have a better understanding on why do you get zeros in your RPM values?