04-14-2009 07:49 AM
Hi,
I want to send a file from one system to the other using serial communication(RS232).I've written two VIs for this. One is sender,which sends the file over RS232 and the other is the receiver, which receives the file.But I am getting an error.I've attached the code for both the sender and the receiver.Please find it.can anyone help me out.
04-14-2009 08:05 AM
04-14-2009 08:06 AM
In comments in the above two VIs in place of TCP you read it as VISA.
04-14-2009 08:10 AM
Hi ,
Error -1073807346.I am unable to receive the file that I am sending at the receivers end.You can check it out by connecting two systems with RS232 cable.
04-14-2009 09:33 AM - edited 04-14-2009 09:42 AM
If you check the error message using Explain Error, you will see it says.
"Error -1073807346 occurred at an unidentified location
Possible reason(s):
VISA: (Hex 0xBFFF000E) The given session or object reference is invalid."
So your reference defined in the VISA resource name control is invalid.
You say you are trying to do this with a serial port, but yet you refer to TCP/IP and have error message subVI's derived from a TCP/IP example. Why is that?
You may want to double check your Serial port settings. In your receiver VI, you have the termination character enabled by default. It is very likely that the termination character of LF will show up in your normal data stream. If that happens, then you won't get all of your file.
Also, what kind of serial cable are you using? If you are connecting two PC's, you should be using a null modem cable.
04-15-2009 12:02 AM
04-15-2009 01:13 AM
Hi
I'm also from India.You can undergo training at National Instruments.It is a 13 day program scheduled into three phases.In the 1st phase you will be taught basics 1 & basics 2.For serial communication refer to NI example finder for examples.mail me at Vipulnandan@gmail.com. First of all let me know what doubts are you getting?If you want to learn on your own see NI help for material.All the best.
04-15-2009 01:34 AM
Hi Ravens,
My VI has nothing to do with TCP/IP.I've removed the comments and attached the new VIs Plz find them.Also have you checked this by connecting two PCs with RS232 cable.I'm unable to transfer a file from one PC to the other.The Receiver PC is not getting the file sent by the sender PC.
04-15-2009 09:45 AM
I've done data communication before using 2 PC's and a null modem cable, so I know it works. I'm not going to do it with your VI's because I don't have that much time to dedicate to solving your problem.
Both your sender and receiver VI's still have stuff mentioning TCP/IP in it., however I don't think that is really hurting you.
You are not going to be able to make any serial communication work until you figure out why you are getting the error message about an invalid resource. Turn on execution highlighting or put probes on you error wires. I bet you'll find that error is occurring right at your first Serial or VISA subVI's. Make sure your Com ports exist in Windows device manager. Then check to see that they exist in MAX.
Your receiver VI doesn't make much sense. In your sender VI, you send the name size, name, file size, and the actual file. All that is logical. But in your receiver VI, you receive 1024 bytes, (rather than the 4 that should represent the name size) convert that to some # of bytes to read (which won't make much sense since the conversion of 1024 bytes won't mean anything). Then receive another 1024 bytes (again rather than the 4 that should represent the file size), then convert that corrupted number to some # of bytes to read.
You may need to do some hardware handshaking if the files are so large they overflow the buffer before the receiver gets a chance to read all the bytes out. And you still have to disable the termination character. As I said, it is very likely that a normal file would contain the default termination character LF (hex 0A) which would cause a VISA read to end prematurely.
Before worrying about files, just try to use the Basic serial read and write examples on each PC to know you can send data between the two PC's.
04-17-2009 01:21 AM
Hi Ravens
I did whatever you said but I couldn't sort out the problem.Can you please rewrite my code.