Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication using Serial port using the write and read buffer simultaneously?

Use the VISA Bytes at Serial Port to determine how many bytes are available. The simplest (but not necessarily most effecient way) to use it is to put a small dealy after your write and then check to see how many bytes are available. If your expected data always has a termination character, then you can also just set an arbitrary number since the read will terminate whenever the termination character is detected.
Message 11 of 15
(1,715 Views)
ach,  it works only when i use the debug opions and the time of execution is extremly low.
where can i put a delay?
i tried in the first frame of sequence (3000 msec) but it was not enough.
any advice?
 
thanks
 
i attached the program
0 Kudos
Message 12 of 15
(1,696 Views)
Try this. I put in the delay after the write and got rid of the sequence stucture. Better to use dataflow instead of a sequence structure.
0 Kudos
Message 13 of 15
(1,689 Views)
thanks Dennis for the vi, but unfortunatly it still doesn't work.
i tryed to increase the delay, but sometimes it works sometimes no.
if i turn on the bulb for debug it wirks always.
any ideas?
0 Kudos
Message 14 of 15
(1,673 Views)
Okay, we'll get a little fancier. The attached example puts the VISA Bytes at Serial Port in a loop that exits when the byte count is create then 0. It then does another loop that exits when the byte count is equal to 0. This way, you get rid of the fixed wait time. You'll probably want to add some additional code in the first while loop so that it won't wait forever in case the connection is bad or the instrument doesn't return a value for some reason.
0 Kudos
Message 15 of 15
(1,669 Views)