LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial (RS 232) communication

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.

 

 

Regards
RobinHood
Download All
Message 1 of 16
(8,364 Views)
What error are you getting?  Does it have an error number?  That kind of information can go a long way to being able to help you.
0 Kudos
Message 2 of 16
(8,355 Views)

In comments in the above two VIs in place of TCP you read it as VISA.

Regards
RobinHood
0 Kudos
Message 3 of 16
(8,351 Views)

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.

Regards
RobinHood
0 Kudos
Message 4 of 16
(8,349 Views)

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.

Also, how are you synchronizing the sending and receiving?  Since you only have a timeout of about 10 seconds,  you will need to start your receiver VI on one PC then start your sender VI less than 10 seconds later.
Message Edited by Ravens Fan on 04-14-2009 10:42 AM
Message 5 of 16
(8,330 Views)
hi vipull this is samatha from india i see that you have established serial communication between two PC's using labview could you please help me out in doing the same, I am new to the labview so pls help me out thank you in advance and also if you have time could pls help me out in learning labview i know the basics but i want to learn more pls do the need full thank you in advance.
0 Kudos
Message 6 of 16
(8,289 Views)

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.

 

 

Regards
RobinHood
0 Kudos
Message 7 of 16
(8,279 Views)

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.

Regards
RobinHood
Download All
0 Kudos
Message 8 of 16
(8,269 Views)

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.

 

 

0 Kudos
Message 9 of 16
(8,228 Views)

Hi Ravens

                  I did whatever you said but I couldn't sort out the problem.Can you please rewrite my code.

 

Regards
RobinHood
0 Kudos
Message 10 of 16
(8,182 Views)