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 would like to synchronize them to get a reference by creating a pulse (trigger signal) and sending to one pc while the other one ekeep it in memory. Is it possible? How could I do to creat the pulse ?
 
  Thanks
 
 Labo
0 Kudos
Message 1 of 6
(3,823 Views)
You don't mention which programming language you are using. Whichever one it may be, you should have control over the control lines. If you use VISA, you can assert RTS at one end and look for CTS to be asserted at the other (assuming you wire up the serial cable that way).
0 Kudos
Message 2 of 6
(3,814 Views)

Hi

Sorry, Im new in programming

Im using labview 6.0. As I mentioned, I have two Pc linked by a serial port that run independant system. I want to synchronise them. But one pc is only reading i have no access to the software of this one. So I have only  posible action on one pc, from where  I want to send a pulse or a marker.

First Is it possible to create a pulse in labview and to transmit it to the serial port?

Secondly,  How make sure that the second PC has received the message, if I used the action Read from the PC 1, is that correct that i ll read what I wrote on the PC2 or not. How to get the exact time at which the pulse was received by the PC2?

Thanks

 

 

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

I already told you how to send a pulse. It is with VISA. Drop a VISA property node on the block diagram, right click on it and select Properties>Serial Seettings>Modem Line Settings>Line RTS State. Right click on the property again and select Change to Write. Right click on the input and select Create Constant. The constant value is either Unknown, Asserted, or Unasserted. At the other pc, you will have to have a VI running that monitors the CTS line with a similar property node.

I'm not sure I understand your comment about "one pc is only reading i have no access to the software of this one". If you can't install a LabVIEW program on this pc, then it won't do any good to send a pulse from the other pc. The only way the sending pc would know that the receiving pc got the pulse would be for it to have software running there and send back an acknowledgement that it was received. If you want to send messages back and fort, then you don't have have to do any of this stuff with the control lines. Just send a defined message from pc 1 to pc 2 with a VISA Write. On pc 2, do a continuous check for bytes at the serial port and when the byte count is greater than zero, read the bytes and check to see if the message is valid. You wound then send a message back to pc 1, saying 'message received'. You could inlcude a timestamp in the message. 'Exact' time on a pc is a nebulous term. It's not much more accurate than 10's of milliseconds.

0 Kudos
Message 4 of 6
(3,793 Views)
ok thanks
 
  the second solution works, but the Pc 2 has only an executable software and no labview. So PC2 has the reference now, but in PC1 could I get the time when I send the message,? is it possible to monitor it.? I know that it will exist a timedelay between the writing and reading of the message.
 
 
 
Thanks
0 Kudos
Message 5 of 6
(3,775 Views)
Getting a timestamp on would be just a matter of using the Get Date Time in Seconds function. If you want it as a string, wire the result of that function to Format Date/time String. Both of these functions are on your Time & Dialog palette.
0 Kudos
Message 6 of 6
(3,771 Views)