LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DaqMX turn off equipment whilst sampling

Hi,

     no you're not right in thinking that. That would be silly.   (forgive my sarcasm)

 

I have two seperate items, one is a load unit the other a USB logger, i want to send a software command to the load unit (to turn off) then log some voltage data.

 

The thing is that i want to catch the data as the load unit turns off, so i need to send the "off" command at the same time as i log the data.

0 Kudos
Message 11 of 41
(1,385 Views)

Hi,

I was hoping that I had got it wrong because that did sound silly!

What I would begin to suggest is using notifiers for this.

It sounds like a complicated matter, it would help if you could send in some sample code for us to look at.

Regards,

 

John McLaughlin
Academic Account Manager
National Instruments UK & Ireland
0 Kudos
Message 12 of 41
(1,371 Views)

Hi John,

             the whole project was posted on the previous page.

 

(i had to add .jpg to the end as its a .rar and the forum doesnt like them, but just delete the .jpg and open it)

 

Cheers, Zac.

0 Kudos
Message 13 of 41
(1,367 Views)

I've just tried changing the way i log the data,

 

I've set it to continuously aquire data, so i can:

 

1) Start the task (aquiring data)

2) Turn off the load

3) Stop the task.

4) write data to file.

5) sit back and bask in the glory of a file full of usefull data.

 

Instead it just came up with a DaqMX error, saying "the resource "INT" is reserved".  (INT is the name of the daqmx task i created for this !

 

Attached is a pic of this part of code.

 

Cheers, Guys

0 Kudos
Message 14 of 41
(1,357 Views)

The reason you are getting an error is most likely because you've put your DAQmx Read VI in a loop without setting up all the paramters for continous acquisition. You can keep your Sample Mode as Finite (as you previously had it) and wire it as in diagram  Software Synch attached. I have just created a VI instead of your DLL as I didn't have access to that to show you how to connect the error wire. This set up will create two seperate threads so hopefully you'll be able to catch the data that you need.

 

For future reference I would recommend that you try to use local variables as sparingly as possible. Instead you can use a shift register in the example that you sent, see attached Shift Register example.

Mahdieh G
Applications Engineer
National Instruments UK&Ireland
Download All
0 Kudos
Message 15 of 41
(1,334 Views)

Thanks for that i will give it a try,

 

What is the yellow box that combined the two error wires before the MSG, and where do i find it in the pallete ?

 

Thanks,

0 Kudos
Message 16 of 41
(1,327 Views)

It is the Merge Errors function. You can use this to combine your errors for processing. In your Functions Palette navigate to Programming -> Dialog & User Interface -> Merge Errors

Mahdieh G
Applications Engineer
National Instruments UK&Ireland
0 Kudos
Message 17 of 41
(1,325 Views)

I tried the example you gave, it didn't work. the file it created was empty.

 

See picture for code.

 

 

0 Kudos
Message 18 of 41
(1,320 Views)

We need to identify why there is no data logged to file. A good debugging method would be to place indicators where you have data coming out to ensure you are actually producing the right information. For instance place an indicator on the Data output of your DAQmx VI:

-       Right click the data terminal of DAQmx Read VI

-       Choose Create -> Indicator

 

If you can see the data on your front panel and not in the file then there is a problem with how it is being logged. Try just creating a simple path for your spreadsheet file and logging the data. You can do this by right clicking the file path input to your Write To Spreadsheet File VI and creating a control for it. If you can log data using this method then it is your logging to file code that is causing the problem.

 

If you can’t see any data from DAQmx Read VI data indicator then there is something wrong with your DAQmx set up.

Can you try configuring your channels on the block diagram so I can see what parameters you've chosen. I have attached some example code for this. To run this code you first need to choose which Physical Channel you want to acquire from then click run. Also in the first VI choose what type of signal you will be sampling, I've just set it to a voltage signal but you can change it as you need.

 

You might find this link useful: https://www.ni.com/en/support/documentation/supplemental/06/getting-started-with-ni-daqmx--main-page...

Mahdieh G
Applications Engineer
National Instruments UK&Ireland
0 Kudos
Message 19 of 41
(1,285 Views)

Thanks, can you post the code as a picture as i'm running labview 2009 and it won't open your V10 example.

 

Thanks, Zac

0 Kudos
Message 20 of 41
(1,280 Views)