You write your command to the port, then immediately check the bytes
at port and read those. Now since the time delay between these two
operations are 0 no bytes have yet arrived at the port and so the read
function is asked to read 0 bytes...

If you know how many bytes the reply will consist of do not check the
bytes at port but wire that number of bytes to the read, it will then
wait up to 20 seconds (if I recall the VISA behaviour correct) for
that number of bytes to be available. OR continously check the number
of bytes and do a read when it reports the correct number of bytes
(then you can make your own timeout...). If the reply has a
termination character VISA can be set up to return when it has
received that.If you do not know the length of the reply nor have a
termination character to rely on you can define a rpely timeout and an
interbyte time limit, check the number of bytes every interbyte time
and if the bytes starts to come in but there is a halt longer than the
defined limit you assume the whole reply has arrived and do the
read...

Reply via email to