07-22-2013 04:22 AM
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 🙂
07-22-2013 07:19 AM
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.
07-22-2013 07:33 AM
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.
07-22-2013 07:43 AM
@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.
07-22-2013 07:54 AM
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.
07-31-2013 03:04 AM
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