LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial file transfer

I need to transfer a 120kb text file programmatically from one LV PC to another LV PC over the RS232 serial port every couple of hours. There have been a few threads discussing various  parts of this technique, but has anyone accomplished this task? Or more specifically, does anyone have the code for accomplishing this they are willing to share?
 
Steve E.
 
0 Kudos
Message 1 of 9
(5,954 Views)

Hi Steve,

I have some code in CVI that does what you are describing.  However, it is simple to implement in LV.

Basically, you implement vi's to send / receive over serial port.  There are threads that describe this.  Le me know if you have difficulty with this portion. 

Both ends monitor continuously for data over the serial port.  When one is ready to send it transmits a "ready to send message",  which is received at the other end.  The other end acknowledges that it is ready to receive. 

The message looks something like:

{start of message header} {.................. message ...................... } { end of message}

start of message:  contains start character(s) and message length plus encapsulation character (for start)

message :  whatever you want to transmit

end of message: end encapsulation character plus checksum of message

The other end receives all the above and parses it to recover the message and check for validity of message (checksum)

Then the message is passed on for further processing.

This is done between 2 PC.  Message intervals are dynamic, but rarely exceed 1 minute.

There is nothing special as far as setting up the serial ports.

You can even experiment with HyperTerminla sessions opened on the 2 PC's.

Hope this helps,

Ray

Message 2 of 9
(5,932 Views)
I have managed to develop a working routine for the transfer.  I have attached the my two VIs. As I am self taught in LV and probably violate every programming standard possible, I would appreciate any comments concerning the program flow and "gotchas" anyone might see.
 
Thanks,
Steve
 

Message Edited by selmore on 10-19-2005 09:28 AM

Download All
0 Kudos
Message 3 of 9
(5,915 Views)

Hi Steve,

LOL...  It's okay to violate programming standards as long as you're having fun.  😄

I will look at these tonight and provide comments.  Since I did not see it yet, did you get it working?

Ray

Message 4 of 9
(5,878 Views)

Hi Steve,

I have to appologize for not being able to look at your vi's.  Can you convert them to LV7.0?

I do not have ver 7.1.

Sorry,

Ray

Message 5 of 9
(5,866 Views)
I've attached the 7.0 version with a few extra features; the receiving program will add a "b" to the end of the filename if the file already exists and then copy it to a network drive. My biggest concern is with the sending VI. Since it runs within our datalogging VI, I wan't to make sure it won't intefere with the datalogging should there be an computer hiccup.
 
Thanks,
Steve
0 Kudos
Message 6 of 9
(5,853 Views)
The program has been running since yesterday and it successfully transferred 8 140kb+ text files!  It's amazing the lengths we'll go to circumvent the Information Technology overlords Smiley Mad
0 Kudos
Message 7 of 9
(5,831 Views)

Thanks for your replies and advice.

I used the function in your lib,read charact from file.

 

Before this, I send a command to the modem stating that I am downloading a file which is xxx size.

This function below then runs, and once the modem received the file, it will reply with OK, and ERROR if there was a prblem

 

 

undefined

This function(and my previous functions) both work with files I download which are smaller than 7000bytes in size. Modem returns OK and all is good.

 

When  downloading a file bigger, then modem replies with ERROR.

 

I am all out of ideas now.

0 Kudos
Message 8 of 9
(5,169 Views)

As in the your other post what error are you getting? This simple piece of information is crucial in being able to give advice to resolve your problem. I suspect that you are simply timing out on your data transfer. Either you are not giving the receiver enough time to receive the data or you are not allowing enough time for the response. However, without more specifics it will be impossible to give you better advice.

 

I would also recommend that you pick on of the threads, either this one or better yet your original one, and use that instead of bouncing between threads for a solution.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 9 of 9
(5,144 Views)