Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

file transfer via serial port

Hello all, I have a trouble that transfer a file using a rs232 null modem cable to another PC and store the file. And the data type of file to transfer is mp3, mpeg, rar, avi …etc. Maybe the size of file will over 10MBytes, even more large. Like the “File Receive” and “file send” in HyperTerminal, and don’t consider ZModem or YModem in first.

 

Concept figure below

 
 
 
 
 

My problem is that how to “convert a unknown data into a string type” in write buffer of x PC, then convert the string to initial data type and store in y PC (receive PC). Because I think that if any data will to transfer using serial port, it only know string type.

 

                                            figure 2. file send program
 
 

So hope someone give me a hand.

Thank you very much.

 
file send program:
Message 1 of 6
(6,362 Views)
Hi

The string is alright but simply don't use a termination character. When sending binary data in a string there is no termination character. All characters are data.
Simply send the size of the file first and then send all the data. Best in portions below the timeout.
So when using 100k speed send at most 10 times as much bits (remeber the start and stopbits to add) to prevent the timeout.
100k byte is then the max to send with a 10 second timeout.

good luck
greetings from the Netherlands
Message 2 of 6
(6,354 Views)

Hi friend, i still have a problum that is there any function in vi can convert the binary into ascii ? Than convert the ascii into string.

Gratitude.

Message 3 of 6
(6,296 Views)
Why do you want to convert to ASCII? All you really need to do is typecast to a string. And can I ask why you are using a serial port for file transfer? All you really need to do is have an ethernet connection between the two. You could then let the OS's perform the transfers.

Message Edited by Dennis Knutson on 07-09-2008 09:05 PM
0 Kudos
Message 4 of 6
(6,293 Views)

Hello, I have a similar problem por developed a similar application to rs232, I have two question for the transfer read file in the other pc, ¿What configuration is use for byte count in VISA Read? and in VISA Resource name ¿what port you use for both?

 

Thanks for help me.

0 Kudos
Message 5 of 6
(4,972 Views)

You would use how nany bytes at available and you would select whatever ports are connected. The first is gotten from the VISA Bytes at Serial Port. The VISA Resource Name control has a dropdown menu that allows you to pick from available ports.

0 Kudos
Message 6 of 6
(4,968 Views)