LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve data from file on a remote system running linux

I"m running labview v 8.0 on a windows PC and would like to create a vi that can connect remotely via ethernet to  a machine running Linux( ARM processor).I have perused the Data Server and Data Client  examples  provided with labview, and i understand how to establish the TCP/IP open/close connections. I would like to know:
 
1) Would I have to install labview on the linux machine for  it to communicate  with the windows machine?
 
2) Once the TCP/IP connects and opens the specified port, what functions do i need to call  to retrieve my file data( stored in the root directory). Pls elaborate.
3) Can I configure labview to update data in file on a continuous basis?
4) If i am able to retrieve file, i would need to transfer this file to the Access database for sorting. can i use the retrieving/Send data to Access.vi? If so how?
 
Thanks for your help,
 
K
 
 
0 Kudos
Message 1 of 12
(4,580 Views)

Hi Kdog,



1) Would I have to install labview on the linux machine for  it to communicate  with the windows machine?
 
2) Once the TCP/IP connects and opens the specified port, what functions do i need to call  to retrieve my file data( stored in the root directory). Pls elaborate.
3) Can I configure labview to update data in file on a continuous basis?
4) If i am able to retrieve file, i would need to transfer this file to the Access database for sorting. can i use the retrieving/Send data to Access.vi? If so how?

1) I'd look at using telnet or FTP to pull a file off a Linux box  These services are typicaly trivial to setup.  Even easier (from the Windows PC) would be to run Samba (a file-server program) on the Linux box - then your Windows PC would see it simply as a network drive!

2) (Assuming you run a LabVIEW "server" on the Linux-box anyway)  Once a TCPIP connection is established, you could have the Linux box wait to receive a Path-string from Windows app., then have the Linux-box read the file and send it as string.  I always prefix data-strings with their length - the side expecting data (whichever) reads four bytes first, then reads that many [more] characters.

3) Probably, LabVIEW can do practically anything Smiley Happy - though I'm not sure what you mean. Smiley Wink

4) You certainly can write to an Access database, but I'm not familier with the VI you mentioned - i wrote my own tools.

 

Cheers!
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 12
(4,571 Views)
Thanks for your help , I was able to configure labview to transfer live data from linux to windows via HTTP . I used  the datasocket read.vi  and a while loop to do this. The type(variant) option on the datasocket was set to "string", so labview can display it and then used the "write to text file.vi" to save data to local file. However , im having problems reading the file into MS Access 2003.
Essentially what i want to do is import this file into Access, sort data using a specified query and then have labview take the sorted data and display to screen.Im using the "Sending data to Access .vi"( ships with lv8.0) to accomplish this. For some reason when i import the file into Access, all it sees is garbage. I tried opening the text file itself and view it using notepad, and i see my data there. But Access can not see it. I think it might be some encoding /formatting issue (ANSI,Unicoding,UTF-8).Is there a way I can save the text file in labview such that Access can recognize it automatically?

 Sample data in file
  -->    First line                                E0070000192AC8FE 00:32:30                       
   -->  Second line                               E0070000192AC8FF 00:32:31                        
  
NB: Each line  has a first part as a hex ID # while  the second part is a time stamp        
Thanks
Kdog
0 Kudos
Message 3 of 12
(4,533 Views)
There are a lot better ways to write to access without using this very old example and DDE. Since the example requires that you create a macro in access and you haven't provide that or the access database itself, I have no idea what could be the problem. I'm actually a little surprised that DDE is still supported in access as it has long been an obsolete technology. Instead of DDE, you can get the Database Connectivity Toolkit. This is based on a technology called ADO. You also can look at the freeware LabSQL. This is also based on ADO and requires that you be familiar with the SQL language.

Message Edited by Dennis Knutson on 03-04-2007 08:48 AM

0 Kudos
Message 4 of 12
(4,521 Views)

i have downloaded and installed labSQL; there's an example of of inserting data into a table. How do i configure this vi to insert data directly from a text file into a table?

Sample data file

 

E0070000192AC8FF 00:32:30
E0070000242179B7 00:32:33
E007000001BC7E8C 00:32:35
E0070000242179B8 00:19:04
E0070000192AC8FE 00:32:30

I have no control over the contents(format) of this file , as its been transferred from a linux box via http. Is there a way to read this data line by line and insert into a table , with  each line parsed into 2 fields( TAGID, READ TIME) .so for example, for the first line, i want to store E0070000192AC8FE in TAGID field and 00:32:30 in the READ TIME field.How do i do this?

Thanks

 

 

 

0 Kudos
Message 5 of 12
(4,502 Views)

There is no reason to read the file line by line. You should read it all at once with either Read From Spreadsheet File or Read Characters from File. If you have 8.2, the Read From Spreadsheet can be set to read and output text. Otherwise, the instructions for modifying the existing VI are on the block diagram. If you do this, then you can insert one line at a time. Something like the code below should help you get started.

Message Edited by Dennis Knutson on 03-05-2007 07:34 AM

0 Kudos
Message 6 of 12
(4,500 Views)
I have lv 8.0 and im  using the 'read from spreadsheet'.vi  file to read my text file and then i passed the data into the 'array to spreadsheet string'.vi  before parsing into a table in my database. However, when i view the output, all i see is a bunch of zeros. Can you tell me how to format my data so that it will appear  similar to the text file? Thanks
 
 
 
 
0 Kudos
Message 7 of 12
(4,469 Views)
You should place a probe on the output of the Read From Spreadsheet file. I'll bet that the data is all zero's there. You have 8.0 and the Read From Spreadsheet in that version does not read strings. That was a feature added in 8.2 as I mentioned. If you open the Read From Spreadsheet vi, you should see instructions on the block diagram on how to modify it in order to read strings in a file and return data that way instead of dbls. The information in your file cannot be converted to dbls like you show on your block diagram.
0 Kudos
Message 8 of 12
(4,461 Views)

thanks dennis for your help so far. I have modified the read from spreadsheet vi to ouput a 2D -array of strings , then i used the index array  to split the array from 2D to 1D array ( one array containing the tag ID  and the other 1D-array containing the read time). Then  converted the 1D-arrays into string and parsed them into the 'format into string'.vi  as inputs. For some reason , when i run the INSERT  command , it can only input the first line to my table , none of the other lines show up . I get the error:

" Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression '''. in ADO Connection Execute.vi"

I have connected probes to my data, , the for loop works OK, since it sends the INSERT command(with the right data appended in string) correctly. I'm not sure what the problem is.

Sample data

E007000001BC7E8B 13:06:33 ---> first line entered correctly to table
 E0070000242179B7 13:06:33-->Error
 E0070000242179B8 13:06:33-->Error
 

Note: The indent in the second/third line came with the data like that.i dont know if that might be the problem.how can i remove it ?I've tried %-s , but it doesnt seem to work.I also want to confirm if I need to enable indexing  on the for loop connection between the ADO SQL Execute and ADO close Conn.  blocks. I get an error everytime i try to do this.

I have attached my block diagram

Thanks

 

0 Kudos
Message 9 of 12
(4,437 Views)
sorry about that, heres my block diagram.
thanks
0 Kudos
Message 10 of 12
(4,435 Views)