Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Visa Reads/Writes Problem

Solved!
Go to solution

In your first VI, you were appending a line feed. In the latest, we have no idea what you are appending if anything at all. If all you are entering into the string control is "pin 1 state", then that is much different than the first VI you posted and almost certainly wrong. I'll say it again that you need to check for '\' Codes Display if you type in \n. You also need to understand the difference between \n and /n. The /n you have in your code is NOT a line feed. You just can't freely mix up \n and /n. Pay a little more attention.

0 Kudos
Message 11 of 14
(1,432 Views)
Solution
Accepted by Banjo_B

Sorry for the confusion. I guess I was messing myself up in the process.

 

I have tidied up my code and I have solved my problem. It will now write and read for both pins without error. Hopefully the attached images will show what I was intending.

 

Thanks for all your help guys.

 

Download All
0 Kudos
Message 12 of 14
(1,430 Views)

I'm glad it's working but now you need to do some cleanup. The VISA Configure Serial Port and the VISA Close should not be inside the loop. As mentioned several times, you don't need the VISA Bytes at Serial Port (or the wait). Since the returned data is terminated, as long as the termination character you set with the VISA Configure Serial Port is the same, you can just use a high number of bytes to read. The VISA Read will wait and then terminate all by itself when the termination character is detected.

Message 13 of 14
(1,421 Views)

I have did as you said and everything works perfectly. The code now instantly updates without the need for the waits. 

 

Once again, many thanks for your help. I'm slowly but surely getting my head around serial communication.

0 Kudos
Message 14 of 14
(1,417 Views)