09-23-2015 03:19 AM
I’m having trouble with a 1300ms lag on the output from my DAQ card. I can correct it with an offset value but I would like to try and find out why it is occurring so that I can correct the code rather than compensate. Please see below for explanation of what the code is programmed to do and also why I believe it is hardware related.
Program functionality
Reason for believing it is a hardware lag
Any help would be much appreciated!
09-25-2015 02:27 AM
Hi,
I'm trying to replicate your set up myself to help with debugging your vi, however I only have the 6212 in the office not the 6211. What signal do you have going into ai0/3/6? What I'm seeing for the simulated signal output is it goes fro 0v to 1v but not back to 0 and the timing isn't 0 for 2 seconds 1 for 5 like you said.
One thing I recommend trying is adding a small delay in your while loops, without the delay and depending on what you have in your while loop, cpu usage can spike resulting in undesireable outputs and unexpected behaviour, you can read more here:
09-25-2015 03:19 AM
Hi,
I do appologies, the settings for the program I posted were for a 5seconds wait time 5 seconds on at 1V and then a total experiment time of 5s. This means that the program ended before 1V was applied so you wouldn't see any voltage as you suggest.
To play around with the timings on the front panel top right there are three time inputs
1."incubation time" is the delay time before 1V is applied to the system
2."Voltage supply time" is the time the voltage is switched to 1V
3. Total experiment time is the total time before the while loop is stopped.
Please also note in the program that offset time compensation is set to 1300 (so there hardware offset was compensated for on my setup)
With regards to the AI
AI3 is physically wired to the AOO
AI0 I had connected to a resistive temperature sensor in a quater bridge config.
AI6 is not connected to anything.
Thanks for the advice on adding the timing. I have tried a few different time delays but not had any success with this.
Thanks for your help also:)
09-25-2015 03:35 AM
Hi again,
thanks for the response, I've made the necessary changes to my set up however I don't have anything going into ai0 since I don't have a temperature sensor. I've also changed the offset from 1300 to 0. What I see on the output for both the recorded step output voltage and the cell output is a square wave signal that goes from 0 to 1v then back to 0 at the same time. How are you determining a hardware delay? Are your waveforms delayed from each other?
The only delay I'm noticing is the simulated signal graph changes to 1v before the triggered data output. Is this the delay you refer to? Because for me this happens with or without the 1300 offset.
09-25-2015 04:04 AM
Hi,
The delay is seen in the recorded data text file with respect to time. The time is listed in the left hand column and the output voltage as recorded from the AI.
I believe the trigger data graph takes a bit longer to update because it is taking more samples and outputting all of the samples at once, so this isn't a concern.
Thanks again 🙂
09-25-2015 04:16 AM
Hi,
Can you show me an example of what you mean? I have my txt file here so you can compare.
09-25-2015 05:14 AM
Hi,
Sorry for the slow response i'm in and out of meetings today!
Please see attached doc, it shows very similar results to your data where the the voltage does not start until 3.3s and finishes at 8.3s then the data stops recording at 11.8s
The input parameters for test1.txt are as follows:
Incubation time 2s
voltage supply time 5s
total experiment time 12s
09-28-2015
08:12 AM
- last edited on
11-26-2024
05:28 PM
by
Content Cleaner
Hi,
So I've spent a lot of time narrowing down where the delay is coming from and what I think is that it's due to how you are using the DAQmx Write vi. When you enter the loop, it auto starts the vi even when there is no data on the line. So I think it gets stuck around here and this is where the unexpected behaviour occurs. The main problem is with how you are using the DAQmx write vi, I've attached a few links which are similar to what you want to achieve:
http://www.ni.com/example/27148/en/
However I'm not entirely sure if what you want to do is possible with the USB 6212 device, there have been people with similar problems using it when trying to re write to it's buffer in a loop like what you are doing. Most examples only write to the buffer once and then it's manipulated later in the code.
I hope this helps.
10-01-2015 03:17 AM
Thanks for looking into this and for your suggestion, I'll have a play around with the regeneration feature and see if it solves the problem.
Cheers
Darryl