LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with simple code

Hi,

 

I want to create a triggered acquisition of 16 temperature readings and store this data along with time the data was taken in a log. 

 

My program consists of 1 Analog input that when reaches above 2 Volts starts taking and recording data and stops when below 2 volts.

I also have 16 Analog in Thermocouple readings (9211 module on CompactDAQ).

 

My problem is when I run the code attached only the time measurement gets stored in the .xls file and the temp data doesn't save.  Can someone explain to me why?

 

Thanks,

Chris

 

 

 

 

 

0 Kudos
Message 1 of 7
(3,117 Views)

I am missing a dll and had to ctl-alt-del out of LV when I tried loading your code. Smiley Surprised

PaulG.
Retired
0 Kudos
Message 2 of 7
(3,109 Views)

What dll?

 

I am running Labview 8.6 but nothing out of the ordinary in the code just normal stuff a couple of while loops a daq express vi and a write spreadsheet data vi.

 

Chris

0 Kudos
Message 3 of 7
(3,104 Views)

Your code suffers from a number of issues:

 

  • Too many loops. You have 4 loops. The code can be done with one loop.
  • Potential of never being able to stop the program. Consider this scenario: The voltage gets above 2 Volts. This triggers the innermost loop to start acquiring data. You press Stop. That stops the loop that acquires the voltage measurement, but the "x>y" indicator is left to True. This keeps the innermost loop running, and your outermost loop cannot stop since it's waiting for the inner loop to finish (which it cannot).    Never mind - got lost with all the loops. Smiley Very Happy
  • Unnecessary sequence frames. None of these are necessary, and they simply hide code.
  • Lack of follow-through on error clusters. You are ignoring the error outputs from the File I/O functions. Do not depend on the automatic error handling option.
  • A for-loop that's configured to run once. Why?
  • "Long-way of doing things" code: The manner in which you are creating the header file for the thermocouples can be easily compacted into a for-loop and the use of the Array to Spreadsheet String function.

 

Now, as to your problem: If the file that you want to write does not exist then you are not writing any data to file. In the case structure driven by the Check if File or Folder Exists function, the Write to Spreadsheet File function has no data wired to it.

Message Edited by smercurio_fc on 02-17-2009 02:02 PM
0 Kudos
Message 4 of 7
(3,078 Views)

You are correct I am scrapping this code I found a better way.  It happens

 

Chris

0 Kudos
Message 5 of 7
(3,069 Views)

Well, you need to learn a little bit about code structures. The way the code is now is not the way to code things efficiently in LV. You could get rid of the main outer while loop. it is doing nothing for you. Re stucturing would benefit you quite a bit.

 

As for the not logging the data. you should wire the write to spreadsheet.vi that is in the second frome with the data from the express vi.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 7
(3,050 Views)
False alarm. My dll problem came from something else. Sorry about that.
PaulG.
Retired
0 Kudos
Message 7 of 7
(3,030 Views)