05-18-2020 06:39 AM - edited 05-18-2020 06:42 AM
@Laian wrote:
solved just by adding Visa close function to my while loop!!
I dont know why but I need to close and again reopen the port each time I read the bytes in my while loop
Thanks
And the text I highlighted above is a good reason for me to believe that does NOT fix your problem, but merely hides it. Any time you cannot explain why something fixed it, it's probably not really fixed. This "solution" will eventually come back to bite you in the behind. Your next post might be, "I'm missing bytes from my message". No, let's fix the problem, not hide it.
Hint: Issues of the type, "There's an extra byte", and similar things are usually due to an incomplete understanding of how to communicate with the instrument. If you could upload the manual for this thing, maybe we can help you fix the problem for real.
05-18-2020 06:46 AM
@billko wrote:
@Laian wrote:
solved just by adding Visa close function to my while loop!!
I dont know why but I need to close and again reopen the port each time I read the bytes in my while loop
Thanks
And the text I highlighted above is a good reason for me to believe that does NOT fix your problem, but merely hides it. Any time you cannot explain why something fixed it, it's probably not really fixed. This "solution" will eventually come back to bite you in the behind. Your next post might be, "I'm missing bytes from my message". No, let's fix the problem, not hide it.
I agree with Bill. This "solution" does not fix the underlying problem. There's no reason that you should have to open and close on every iteration of the loop. There is something wrong with your protocol, but since we don't have your instrument (and you've not shared the documentation as Eric1977 asked) it's difficult to help you with that.