04-21-2016 09:23 AM
Hi guys, i just started using labview 2009 one week ago and am trying to wirte a simple program which can read a .txt file in real time. The .txt file is writen in real time by another program. My program functions but from time to time the value jumps suddenly and produce a weird graph or the graph "black out". My best guess is that there is a collision of data when i try to read the file through labview, at the same time the file is being written by the other programm.
Any idea i can prevent this from happening? i did not find any helpful post though, would be glad if anyone has an idea or point me to a solution.
04-21-2016 09:52 AM
Where did this other program come from? In general, it is a really bad idea to pass data around via a file continuously. Are you able to alter the other program to communicate over TCP instead? Another option is to lock the file so that only one program can access it at a time.
04-21-2016 10:01 AM
Are you really using a real time Operating System? On a PXI chassis?
It's not a good ideal to read and display data in real time. That's usually a task for the host computer running Windows OS.
04-21-2016 10:25 AM
Check data if they are valid before displaying them, otherwise read on the next iteration from the previous position. You can control file read position with Advanced file functions -> Set position and number of bytes to read.
For example, get file size and assume that the last chunk (point or number of points source writes at one time) of data is not valid and do not read it.
04-22-2016 02:18 AM
@crossrulz wrote:Where did this other program come from?
Are you able to alter the other program to communicate over TCP instead?
The other programm is something like one working with arduino projekt. Its saves data to the .txt file and i wanna interpret and display the data in graph. I am trying to get in touch with the person who wrote it.
And no. Its not PXI Chassis, i am not sure what that is though.
04-22-2016 02:59 AM
@Alexander_Sobolev wrote:Check data if they are valid before displaying them, otherwise read on the next iteration from the previous position. You can control file read position with Advanced file functions -> Set position and number of bytes to read.
For example, get file size and assume that the last chunk (point or number of points source writes at one time) of data is not valid and do not read it.
i've tried both of the function. The same problem exist too. too bad.
04-22-2016 05:09 AM
@WeiZhuang wrote:And no. Its not PXI Chassis, i am not sure what that is though.
Who said anything about PXI? I said TCP. It is the bottom software layer of the internet. But you can use TCP to have two programs on the same computer communicate with each other.
@WeiZhuang wrote:The other programm is something like one working with arduino projekt. Its saves data to the .txt file and i wanna interpret and display the data in graph. I am trying to get in touch with the person who wrote it.
If you could get the command structure to the Arduino, you could just do it all on your own (recieve the data and plot it).
04-22-2016 06:09 AM
Who said anything about PXI? I said TCP. It is the bottom software layer of the internet. But you can use TCP to have two programs on the same computer communicate with each other.
sorry, i mistaken urs with the other comment.
If you could get the command structure to the Arduino, you could just do it all on your own (recieve the data and plot it).
Yea. that is my plan b for now. But it will be much easier i think if i can just do it (plan a) in labview. Is there another better solution?