LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx measurement problem when running first time

Hello guys!

 

In my program I call a Sub-Vi that do some measurement and send the results back to the main-vi. The problem I'm about to explain happens if I run my main-vi or just my sub-vi.

 

My sub-vi activates some relays with a digital output line form my DAQmx USB-6225 M-series. I got a wire from the relay back to PFI 0 that works as my trigger port. After PFI 0 goes high I will do 40 measurements, collecting 1k samples with 1kHz samplefrequence. After this I use the digital port to deactivate the relay.

 

When I want to use my program I start my DAQmx unit. Then I start my program and call the sub-vi. I can hear the relay click, but I get a timeout and a errormessage that says some of the samples were not collected and my program stops. Then I restart my DAQmx unit and run my program again. Everything works as a charm. My relay goes *click*, I collect all the samples and the relay goes *click* again.

 

What is wrong here?

 

Do I have to start my program first and then my DAQmx unit? Do I have to start my program first and restart my DAQmx a few times before trying? Or is it as way to initialize my DAQmx during my program startup?

 

With a voltmeter I see that the trigger port goes high, but my program does not start the measurement. The voltage from the relayswitch is +5 V as "high" and 0 V as "low".

 

Thanks and regards,

Even

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 1 of 7
(3,375 Views)

Even,

 

since the application runs fine after the first call, i assume that the trigger signal itself is just fine for the 6225.

Without seeing your code (since you did not attach it), i can only guess:

You switch on the relay before you set the DAQmx task into the running mode. Therefore, the trigger occurs BEFORE the task is capable to accept it. It works for the second call (and later) because you do not destroy the task.

 

Is it possible that i am correct on this one?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 7
(3,366 Views)

Thanks for the quick reply!

 

I think maybe that can be the issue, but there is just one small problem. I'm not so experienced with measurement of this scale so I use the DAQ assistant. I hope this picture can be helpful:

 

q.png

 

I see that there is a task out on every assistant. Should I destroy the task after each assistant?

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 3 of 7
(3,361 Views)

Na, the DAQ Assistant destroys the task if you do not use the task out. Therefore there is nothing to be done here.

I suggest you to create DAQmx code out of the DAQ Assistens and use them parallel. In order to learn how to synchronize different functions of an M-series device, please take a look into the example finder, DAQmx examples >> Synchronization >> Multi Function.

You have to make sure that your DAQ task is alreade waiting for the trigger before switching the relay.

 

hope this helps,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 7
(3,357 Views)

 


Norbert B wrote:

You have to make sure that your DAQ task is alreade waiting for the trigger before switching the relay.

 

That's why I have the 100 ms delay. The executionorder of the error wire should do the trick. The measurement is waiting for the trigger 100 ms before the trigger activates so that problem is solved. It just that when my program runs the first time the measurement never trigs. If I remove the triggerfunction in my DAQ assistant and run the program the first time, everything is in order. But then I don't have any triggering and my measurement will have a random delay from when the relays activates.

 

I'm able to create measurement for maybe a couple voltage readings and stuff without the DAQ assistant, but when I have to read 30 voltage readings and 10 current readings at the same time, and I got not so much experience, I ended up with a huge Ruby Goldberg code and wrong timing. Therefor I use the assistant for this massive (massive enough for me :)) reading. I have not looked at the particular examples you mentioned, so I'll check them out. Now I'm finished at work so I'll check it out on Monday. Thanks for the answer 🙂 I appreciate!

 


 

 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 5 of 7
(3,348 Views)

Hi guys!

 

I feel I have to bump this thread since I still have the error as described in the first post. I have tried the code in both LV 2009 and 2010. I have re-written it, but still the same. Since I do over 40 measurements and it have to be done simultaneously and I'm no champion of DAQmx, I feel most comfortable with the DAQ Assistant. I find it so weird that I get an error when I run the code the first time and then it works perfectly after I restart my DAQmx. If I then restart my computer the problem occurs again. If I just restart LabVIEW there is no problem at all.

 

My code is still the same as in the original posts.

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 6 of 7
(3,216 Views)

Actually I found a work around for it. An error handler which will try measuring again if it fails the first time. And it always works the second time after first call. After that it works on the first try. So I think problem is solved for now, but if you got any clues why it happens I'm happy for any answers.

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 7 of 7
(3,212 Views)