OscarJ
2008-06-09 14:10:10 UTC
Hello, I'm new to programming in the LabVIEW environment. And my questions below is probably to be considered as super newbie, I've been studying the "LabVIEW Fundamentals PDF" included with the application for a week now but this "dataflow"-type of programming still makes me confused.
I would really like it if you people could give me comments on how to make the attached code more efficient.
The application I?m trying to build is to be used to acquire data from an event detector on a specific time interval, and save this data to a spreadsheet file on another time interval. Very basic procedure I?m sure, but this is my first try in building this kind of program :robothappy:
I saved the whole thing in an .LLB-file, I hope you all will be able to run it, or at least view the code. The top-level VI is the one called ?testVI.vi? and there is three VIs used as subVIs; ?initANAT?, ?pollANAT? and ?savetable?.
The pollANAT subVI leaves a 1D, 128 elements long array of ones and zeroes, where a value of one equals an event detected on the channel corresponding to that particular element. This array is to be added to another array that keeps track on the total number of events. When it?s time to save, the savetable subVI writes that array to the end of the spreadsheet file together with various other data such as absolute time and date, time in test, cycle number and so on (right now it only saves absolute time though). After this, the array is overwritten with all zeroes and ready to be used again.
When the user runs testVI he first points the path control to a file where he would like to store data, chooses the correct serial-hardware address and enters appropriate polling and saving time, he then executes the VI.
As the program look now, the first ting that happens is that initANAT clears the serial port, to insure that the first real polling receives correct data. Then the program enters two separate while-loops that executes two sequence structures wherein the program first waits the specified time via the ?Wait (ms)?-function. Next frame executes the main task (polling, or saves data to file) and after that it prepares for the next iteration of the while-loops.
OK, what do you all think of this layout? It feels like there should be a more efficient way to execute all these happenings in a more controlled way, for example I don?t know if it?s possible to abort the Wait (ms)-function if you?d like to end the program without waiting the maybe two hours you?ve set the save time input to be. And what happens if the savetable VI saves the total channel events array at the same time the polling sequence updates that array. Is there a fundamentally different way to do all this?
I would like to hear whatever feedback you may have on any aspect of this code!!
testVI.llb:
http://forums.ni.com/attachments/ni/140/30317/1/testVI.llb
I would really like it if you people could give me comments on how to make the attached code more efficient.
The application I?m trying to build is to be used to acquire data from an event detector on a specific time interval, and save this data to a spreadsheet file on another time interval. Very basic procedure I?m sure, but this is my first try in building this kind of program :robothappy:
I saved the whole thing in an .LLB-file, I hope you all will be able to run it, or at least view the code. The top-level VI is the one called ?testVI.vi? and there is three VIs used as subVIs; ?initANAT?, ?pollANAT? and ?savetable?.
The pollANAT subVI leaves a 1D, 128 elements long array of ones and zeroes, where a value of one equals an event detected on the channel corresponding to that particular element. This array is to be added to another array that keeps track on the total number of events. When it?s time to save, the savetable subVI writes that array to the end of the spreadsheet file together with various other data such as absolute time and date, time in test, cycle number and so on (right now it only saves absolute time though). After this, the array is overwritten with all zeroes and ready to be used again.
When the user runs testVI he first points the path control to a file where he would like to store data, chooses the correct serial-hardware address and enters appropriate polling and saving time, he then executes the VI.
As the program look now, the first ting that happens is that initANAT clears the serial port, to insure that the first real polling receives correct data. Then the program enters two separate while-loops that executes two sequence structures wherein the program first waits the specified time via the ?Wait (ms)?-function. Next frame executes the main task (polling, or saves data to file) and after that it prepares for the next iteration of the while-loops.
OK, what do you all think of this layout? It feels like there should be a more efficient way to execute all these happenings in a more controlled way, for example I don?t know if it?s possible to abort the Wait (ms)-function if you?d like to end the program without waiting the maybe two hours you?ve set the save time input to be. And what happens if the savetable VI saves the total channel events array at the same time the polling sequence updates that array. Is there a fundamentally different way to do all this?
I would like to hear whatever feedback you may have on any aspect of this code!!
testVI.llb:
http://forums.ni.com/attachments/ni/140/30317/1/testVI.llb