Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Analog input displays a negative result 50% of the time.

Hey.

I am at my wits end and I feel like I have tried everything, so I hope you can help!

(I’m using USB 6009)

My issue is this:

I am doing a test where I test an analog input, then triggers a relay, then tests the same analog input, and then close the relay.

AI1 read  -> AO1 “on” -> AI1 read  -> AO1 “off”

The relay goes on and off as it should, and the first measurement is ALWAYS ok, the second measurement however, is not. It shows the correct result about every other time, it does vary though. When it gives a wrong result it gives the result ca. -10,25V.

 

This result is completely wrong, and it never actually is -10,25V. I have verified this with a scope.

This leads me to believe it is some kind of buffer/timing problem, but I simply cannot pinpoint it.

I have tried doing intricate error wiring, and clock sharing but to no avail. And now I have even resorted to sequencing (its bad, I know) It does give me the opportunity to make sure that the task is completely closed before starting the next. But still, it does the same thing.

 

What I cannot understand is that it is always the second reading that fails, never the fist.

 

I hope you will be able to point out some glaring mistake that I’ve made. (I know that in the included file, I haven’t used sample clock, but I did before it took it out, and I was the same deal)

 

Thanks in advance 🙂

 

0 Kudos
Message 1 of 6
(3,618 Views)

I doubt it is your problem, but I've seen some strange things.  You don't need to keep recreating the task.  Create the task once and just use the DAQmx Read or DAQmx Write when you need to control the line.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(3,601 Views)

But since I use 2 different ports AI1 and AO1, wouldn’t I need 2 different task lines.

 

One for PORT AI1 and one for PORT AO1.

 

And run these in “parallel”, Or series, as I’m doing in example I uploaded.

0 Kudos
Message 3 of 6
(3,599 Views)

@Rustyhook wrote:

But since I use 2 different ports AI1 and AO1, wouldn’t I need 2 different task lines.

 

One for PORT AI1 and one for PORT AO1.

 

And run these in “parallel”, Or series, as I’m doing in example I uploaded.


Yes, but you are creating each of those twice.  You only need to create each task once.  See attached.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,596 Views)

Oh yes, i did that to begin with, but i still came with that error. That is why i changed to the current configuration.

 

To make sure that it wasent because something wasnt closed off properly.

0 Kudos
Message 5 of 6
(3,592 Views)

Hi Rusty hook

 

It seems strage that you should expirence such measurements from the provided code.

 

If I was to troubleshoot this problem I would continue to use the code you have provided, but to identify the source of the problem I would change the Analog Output to first always be off and then always be on. Do the measurements and verify that you get the same measurement every time.

 

If you still see the same error there must be something wrong with how it is setup on the PC and we need to try to make some other examples to test the behavior.

 

If you only see this behavior when you actively change the relay there must be something wrong with the wiring (can you then please post the wiring here)

 

Best Regards

Anders Rohde

Applications Engineer

National Instruments Denmark

0 Kudos
Message 6 of 6
(3,543 Views)