LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save data with automatically stop

Hello 2 everyone.firstly i hav no problem bout how to build a waveform from the string using RS232 serial comm.I'm using instrument I/O assistant (IIOA) to communicate with message-based my hardware and graphically parse the response.The list of numbers below shown from ASCII of my microcontroller. After I configure my hardware using IIOA, i can build the string V n I easily.so,my problem is how to write to measurement file and save into one file with timer.Such a example like...emm... let's say if I want to start save data into file form now.and then i want to stop in 3 minutes later without controlled by me.so it will be automatically stop in 3 minutes...like a timer.so now, i'm using a function like write to measurement file to save data. n I don't think that this is the best way.or maybe I'm wrong.so..I hope you guys can help me to fix this prob .here, i attach the vi. file to you guys n i hope that you guys can fix me the prob of this.thank u......



V= 2, I = 4
V= 3, I = 5
V= 4, I = 6
V= 5, I = 7
V= 6, I = 8
V= 7, I = 9
V= 8, I = 10
V= 6, I = 8
V= 7, I = 9
V= 8, I = 10
V= 9, I = 11
V= 10, I = 12
V= 2, I = 4
V= 3, I = 5
V= 4, I = 6
V= 5, I = 7
V= 6, I = 8
V= 7, I = 9
V= 8, I = 10
V= 9, I = 11
V= 10, I = 12
0 Kudos
Message 1 of 9
(3,651 Views)
Your first step is to modify the program so that it runs more than once. You need to put the VISA Read/parsing/file write code inside a while loop. then you can use the Elapsed Time function inside the loop. Set a target time and the Time Has Elaspsed out put will go true when this time has been reached. Wire this to the while loop's termination terminal. You might also want to OR this with a front panel Boolean stop control in case you want to terminate the loop early.
Message 2 of 9
(3,629 Views)
Hi Dennis..

Emm..I'm not sure about what u said before.Refer to the vi file, I have converted the express VI of IIOa into standard subVI. Then, the VISA Read code has put inside the while loop already. So, I'm just little bit confuse right now. That mean, should I add another Visa Read code into  the different while loop or else.According to the hardware n ASCII, This program runs more than once n repeat again n never stop. And I can modify it if i want too...So, in labview, I don't know how to stop it.Can u give me any other example....Thank u very much.....
0 Kudos
Message 3 of 9
(3,602 Views)
Your program cannot run more than once unless you are using the run continuous button on the toolbar and that is not a correct way to run. The VISA Read loop doesn't run forever does it? If it does, is that because the serial instrument is constantly sending data?
Message 4 of 9
(3,593 Views)
Hii...It's me again...

ooo....thanks dennis...now i know that i'm wrong from the first step.you're right..
This program cannot run more than once unless I click the run continuous button on the toolbar..so..refer to the while loop at 'perform at visa read'.Should I replace this VISA Read one with any other fuction like VISA Read/parsing/file write code....n what about the function of match pattern.should I change the delimeters...I need to learn from step by step...thank u very much
0 Kudos
Message 5 of 9
(3,577 Views)
No. You put the majority of the existing code (the read/parse/write) inside a while loop. Something like the attached. It has a front panel stop button. If yuo want it to automatically stop after a certain time, OR this stop button with the Elapsed Time function.
Message 6 of 9
(3,585 Views)
Hi Dennis...
 
Thank u very much dennis...u give me a big help...emm...actually i'm not  expert how to use a while loop correctly....so, what a different between while loop n time loop...just now....i have replaced the write to measurement file function to write to text file code...so, I use a format into string function to get a data list in text file from the index array and convert into string.so..my problem is when it start to run, the file open will appear in the window.after i  select  the file, an error occurs such as "Possible reason(s):
LabVIEW:  Duplicate path.
=========================
NI-488:  Asynchronous I/O operation in progress.

Before that, I had using the write to spreadsheet file code to save the data into file.But every time I click the run button, It seems like to appear the file open in the window repeatedly after choose the file and its not follow the elapsed time code.so could you show me about the mistakes when wiring the connections. I want to save this file once and not repeated after its requested. And after the target time, it will stop write the data into file.Here, I send the attachment below.Thank U...Smiley Happy
 

 
0 Kudos
Message 7 of 9
(3,522 Views)
0 Kudos
Message 8 of 9
(3,520 Views)
You are getting this error because you are trying to create a file that is already created.  Instead of using "create" for the operation type, use "open or create".  This should solve your problem.
0 Kudos
Message 9 of 9
(3,498 Views)