Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port

I have two pc connected together via the serial port. I used Visa to communicate (see figure). I tried to end a chain of characters from PC one adn read it from PC two. I thought it could be simple, but it is not the case. No error came out in the writing and reading process, but I was not able to read the chain of characters. Is someone could help me?
 
Thanks a lot
 
fred
0 Kudos
Message 1 of 6
(3,259 Views)

I'm trying to understand how you can have no error but get no data. Because your while loop will only stop if there are 4 bytes read, are you aborting the VI? If so, then this might account for not receiving an error. What type of cable do you have between the two computers? Is it a straight through or null modem type. Have you tried using Hyperterminal at both ends to verify the cable is correct?

When you verify that you have the correct cable, then your code could use some cleanup. Start with fixing the wiring so that it looks something like the code below. Then you want to start using the VISA Bytes at Serial Port in the VI that does the read.

Message Edited by Dennis Knutson on 04-23-2007 11:53 AM

0 Kudos
Message 2 of 6
(3,253 Views)
I have now four chracters in the buffer but not abcd, Ï get those characters ÿÿÿÿ. I don't know why ? Is it a problem of conversion?
I m also surprides, the transmission is not very fast.
 
Thanks
 
Fred
0 Kudos
Message 3 of 6
(3,201 Views)

If you were to right click on the string indicator and select 'Hex Display', you would probably see 'FFFF FFFF'. Something is getting mangled up.

I can't stress enough the need to first test your cable and comm settings with something like hyperterminal.

When that works, you need to modify the VI at the receiving end. Unless you append a carriage return on the sender, you have to disable the termination character in the VISA Initialize Serial Port. After the VISA Initialize Serial Port, you should use the VISA Flush I/O Buffer to clear out any characters that might be in the buffer. Start the VI at the receiver. Use the VISA Bytes at Serial Port to do a read when bytes are greater than 0. The run the VI at the sender.

0 Kudos
Message 4 of 6
(3,195 Views)
the problem comes from the usb to serial converter. It works in one direction.  I can't use the parallel and the serial port ? So it becomes to be difficult. I just want to send a string to pc2 when  the vi on pc1 start in order to synchronize them. Is it possible via the TCP connection, does I will retrieve the information with a googd time resolution?
 
fred
0 Kudos
Message 5 of 6
(3,187 Views)

I can't imagine a usb->RS232 converter that only works in one direction. Every one that I've used will transmit and receive. Maybe yours is defective or the cable you are using is bad.

In any case, yes you can use the TCP/IP functions in LabVIEW to communicate between two pc's. If you have a dedicated NIC in each computer and connect them with a cross-over cable, then I believe the latency is fairly small but I have no numbers to post. If you use an existing network connection, then the overall network traffic is going to have some effect.

0 Kudos
Message 6 of 6
(3,183 Views)