LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring Temp/Pressure Data with NI Max Tasks (LabVIEW 18)

Hi All,

 

I am very new to LabVIEW and have no real training on how to use it other than what I have read online. I am having an issue creating a program that uses a NI compact DAQ system along with current input and thermocouple cards in order to monitor 4 temperatures and 3 pressures (from pressure transducers). I have set up multiple MAX tasks in order to specify which terminal each temperature or pressure will read from as well as ranges and scales (for current to pressure). Currently the VI is giving the error 

 

"Error -50103 occurred at DAQmx Start Task.vi:7220001

Possible reason(s):

The specified resource is reserved. The operation could not be completed as specified."

 

I need to read the temperatures and pressures every one minute and write the data to a csv file, I would also like to be able to create a new file to write on each time the program is run and subsequently stopped, preferably with a date and time stamp. The VI I am using is attached below, please respond with tips or information on what I can do.

0 Kudos
Message 1 of 8
(1,629 Views)

Hi prosep,

 


@prosep91 wrote:

I have set up multiple MAX tasks in order to specify which terminal each temperature or pressure will read from as well as ranges and scales (for current to pressure). Currently the VI is giving the error 

 

"Error -50103 occurred at DAQmx Start Task.vi:7220001

Possible reason(s):

The specified resource is reserved. The operation could not be completed as specified."


Most probably you are trying to create DAQmx tasks, which contain exactly one channel. This is only supported by DAQ hardware using one ADC per channel, while most DAQs only use one ADC and a MUX for all channels!

 

Simple rule: for DAQ devices with one ADC+MUX you need to setup just one DAQmx task for all channels.

 

As you setup those task in MAX we cannot examine your settings just from looking at the VI.

(I prefer to define DAQmx task in the VI using plain DAQmx functions!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(1,590 Views)

Hi prosep,

 

now I had a chance to look into your VI…

 

After cleaning up (just a little bit) I get this:

 

  • As said before: put all channels into just one task (atleast all channels per module)to avoid that error message…
  • What's the point of the outer while loop? When the inner loop stops it outputs a TRUE and so the outer loop also stops: you can remove the outer loop without changing the behaviour of your VI! (This is called Rube-Goldberg code!)
  • What's the point of using a wire channel to output the stop condition from inner to outer loop? Why not use a simple wire/tunnel? (Ruge-Goldberg…)
  • Why do you use a "%d" format on the WriteDelimitedSpreadsheet function? Do you know the difference between the format codes "%d" and "%f"?
  • Usually it's not a good UX behaviour when your VI needs upto 2 minutes (!) before it successfully reacts on the stop button click of your users! They might think the VI has crashed…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(1,580 Views)

Hey GerdW,

 

So I deleted the While Loop along the outside and removed the unnecessary tag channels. Do I need to put my DAQmx read functions in series of one another in order for one task to initiate all of them? Or do I just need to connect one task that includes all channels to each one as is. Currently the T1 1001-1003 functions all use the same temp range and are just different terminals on one DAQ card, T1 1004 uses a differrent temp range. Pi 1001-1003 all use the same scale and likewise are just different terminals on a current input DAQ card. Please let me know what you recommend doing.

 

0 Kudos
Message 4 of 8
(1,572 Views)

Hi prosep,

 

I would put all temperature channels into one task: you can define different ranges per channel.

All P channels belong into another task...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(1,567 Views)

Hi GerdW,

 

I have attached my revised VI below, as well as my trial data sheet. My temperature ranges for T1 1001-1003 is 0-150 C and T1 1004 is -20-20 C. Pressure was scaled from 4-20 mA to -30-190 psi for all P1 channels. The DAQ cards are not wired up yet but I am wondering if the data eludes to error in the program. Also do you know how I can get the delimited spreadsheet to denote a date and time stamp when started and create a new file with a certain name each time the program is started?

 

Thanks,

Prosep

Download All
0 Kudos
Message 6 of 8
(1,540 Views)

Hi prosep,

 


@prosep91 wrote:

Also do you know how I can get the delimited spreadsheet to denote a date and time stamp when started and create a new file with a certain name each time the program is started?


  • To create a file you can use the FileOpen function…
  • When you want to "denote" the spreadsheet file are you wanting to use a certain filename? Use any of those string functions to create a filename based on your requirements…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(1,529 Views)

Hi prosep,

 


@prosep91 wrote:

I have attached my revised VI below, as well as my trial data sheet. My temperature ranges for T1 1001-1003 is 0-150 C and T1 1004 is -20-20 C. Pressure was scaled from 4-20 mA to -30-190 psi for all P1 channels. The DAQ cards are not wired up yet but I am wondering if the data eludes to error in the program.


The VI looks much better now!

You still can improve it:

  • implement error handling for both DAQmx tasks and for the file handling
  • implement a better handling of the 1min wait: when you press the stop button the VI will take upto 2mins to actually stop…

When you want to use a different filename for each run of your VI then you should not use a filename constant! Build your filepath using BuildPath and string formatting functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 8
(1,524 Views)