03-24-2020 07:35 AM
I tried with giving fixed number of bytes (39) but in that case , it did not give me data after one loop, so i changed it to bytes at port.
So the correct way to read and write is to read and write in series with no wait. The one i have done in the attached sub VI. Right???
03-24-2020 08:36 AM
The Index array + build array is redundant, just wire the array to Array to cluster.
Well, it depends on your device. You mentioned it should send 39 chars. Does it not? Does it do it sometimes? Do messages use a termination character? Which character?
If there's a termination character you should use that.
/Y
03-25-2020 10:03 AM
@Dushy_11 wrote:
So the correct way to read and write is to read and write in series with no wait. The one i have done in the attached sub VI. Right???
There are hundreds (thousands?) of discussions in thie Forum of reading from a VISA Port, and the problems caused by using "Bytes at Port". In some cases this might be necessary, but it depends on the device sending information to LabVIEW that you are trying to read.
Many (most?) devices communicating by VISA send a text message, and terminate the message with a "Termination Character" (most frequently "Line Feed", \n, 0x0A). In this case, you configure VISA to "Use a Termination Character", and you set your VISA Read to read "many more characters than you ever expect" (most common choices for Number of Characters are 1000 or 1024).
The idea is that VISA will read up to the Termination character and will return all the bytes (39, probably, in your case, assuming your device uses a Termination Character). The VISA Read will wait until either it gets those characters or it times out (the default timeout is 10 seconds). If your sending Device stops sending, and a Time-Out occurs, the VISA Read will exit with Error -1073807339, which you can detect, clear, and take appropriate actions.
Bob Schor
04-05-2020 12:04 PM
Sorry for late reply but I m really thankful to all the suggestions provided. I will surely work on my code and make it much more readable following all the best practices
thanks a lot
Dushyant