LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

By a sub VI, Writing data countinously to file by a ''Write' button in Main VI??

Good morning...day  to all !
 
I've made a program, where I'm reading data generated by a device connected to a com port. These data are red from the port to an indicator buffer and then, into a file when a button, " write file" are pressed. I've placed the 'WriteDataToFile.VI' in a Sub VI placed in Main VI.
 
When my Main Program starts and I switch a start button, a file dialog box opens, so I can choose an existing file or a new file to write data to!
 
I want to Make a Button named  " Write file" so when pressed , the Dialog box opens and I can choose a file to write to.
In that way I can avoid the Self pop up dialog box.
 
I've spended the hole weekend  trying doing that, but no succes. The biggist problem by that is:
 To write a continously to a file I  also need to continously read the data from the port, And because of that, I got to write the data to a file as quickly as possible when Red from the port. So I gotta put the WriteDataToFile.VI 'sub', in the ReadData:vi 'Sub'. By that I always get the Dialog box poped up, by each while loop iteration. Just because the Software to the open Dialog Box (Write file), is placed in the ReadDataVI, Sub.
 
Please Help me with that Guys , girls, any one, also peoble from Mars To!
 
Attachements !!
Regards
 
H.F.Zamzam    
HFZ
0 Kudos
Message 1 of 6
(2,797 Views)
Hi Zamzam,

I think the point you should work on is the architecture of your whole application, LabVIEW has very well designed templates.
If you go to new >> new... >> vi from template >> frameworks >> design pattern >> user interface event handler

It is a very robust architecture with which you can draw cases for (almost) any kind of event such as a click on a button.
in your application, you could choose the file to write on the first run, then put the file refnum in a shift register and add an event case handled by the "write to file" button that writes the acquired datas.
You could even go further and set that "wite fo file" case on other event, for instance new data from the port com.

wooopps... I tried to be as clear as I could but english is not my natural language Smiley Indifferent, so please tell me you need some more help 😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 6
(2,791 Views)

hi tItOU

wHAT aBOUT tHIS Its not realy working??

Zamzam

 

HFZ
0 Kudos
Message 3 of 6
(2,788 Views)
Here is another version, The last one contained some mistakes.
 
but neither this is working .. why?
 No data are beeing written to the file, meaby Coz the error wire and refnum wire from the open dialog box, contains error when they are transmitted from empty constants from the Event case.!!???
 
....
Zamzam 
HFZ
0 Kudos
Message 4 of 6
(2,782 Views)
I was thinking of something more simple and more readable. Your VI is not really using the power of the event structure, I think mine does 😉

Hope you like it !

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 5 of 6
(2,783 Views)

HI TiTou

Thanks for the help and for the time spended to help.

I thought it would work like this, But it is not.

The problem is that the eventcase, cant read the value change of a global variable. So I planted an indicator to the Global (Create). so I could attach it to the event case by the

"Edit event handled by this case".

But the event case is not responding although the global variable change its value.

About the writing and reading , it must be with this architechture. A deadline is ahed for me and I cant change the code ..that much.

What to do???

Zamzam

HFZ
0 Kudos
Message 6 of 6
(2,777 Views)