LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data file from C+ into labview

I am interfacing with a C+ program that will respond to a download command from labview. I want to download a file over a rs-232 connection. The file will be sent over the 232 bus from the C program, and I want to basically use labview to just save the file in its original format(either ascii or binary) for later analysis.

What would be the best way to do this? The data file will be sent with a header to identify the system and data, and with a checksum at the end to ensure a complete file.

Any help would be greatly appreciated
0 Kudos
Message 1 of 4
(2,449 Views)
This should be fairly easy in LabVIEW. You will use VISA to read the from the serial port and write the output string to a file.

I created a quick example that will demonstrate this. First create a loopback cable (short pin 2 to 3 on a DB9 connector). Then run the VI and select a text file to send and save the file you receive. Since you will have another computer doing the sending your VI would be pretty much the same just without the VISA write.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
Message 2 of 4
(2,427 Views)
How could I modify this so it works to xmit/recieve a binary file? My file will be, eventually, about 600MB.

thanks for the help!
0 Kudos
Message 3 of 4
(2,385 Views)
Well, you would use the same method the only difference is you would need to typcast your binary data to a string. I attached another example that shows this. Also if you are sending a 600 MB file this will take a long time. It should still be possible, but you should use the fastest baudrate possible, and you will need to increase the timeout value. You might want to consider splitting up your file into smaller chunks.

Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community
Message 4 of 4
(2,369 Views)