12-20-2021 04:24 AM
Hello,
I'm trying to create a VI to auto detect the USB port were I have my PSU connected and control the PSU output.
There is no issue with the output control if I select the connected port manually. Nevertheless, if I use my VI to detect the port and forward it to the PSU control it does not work.
The VI detects the correct usb port but it's not forwarding the correct information to the next step of the VI.
The issues is on the "Find the correct instrument handle Resource Name" part.
Can you guys help me find the issue?
Thank you.
Best regards,
Luis P.
12-20-2021 07:41 AM
DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (still not enough emphasis)
You are sending a command and instantly expecting a full response. That does not happen. It takes time for things to be sent, processed, and reply. Instead of using the Bytes At Port, just tell the VISA Read to read more bytes than you ever expect in the response. I tend to use 50 or 100. The instrument's termination character will stop the read.
There is also no need for the Coerce To Type functions in there. Just let the string auto coerce to the VISA Session. And you definitely do not need to convert to a string just to instantly convert back to a VISA session.
12-20-2021 09:00 AM
Hello Crossrulz,
Thank you for the reply.
I'm new programming on LabVIEW, so I'm expecting a lot of mistakes in this VI 😉
Regarding this suggestion "There is also no need for the Coerce To Type functions in there."
This was a desperate attempt to have a correct format. Leaving it to auto coerce gives this error (please see the image):
Regarding this suggestion:
"Instead of using the Bytes At Port, just tell the VISA Read to read more bytes than you ever expect in the response"
I think that I didn't understood your suggestion correctly I'm now getting this error:
Can you point me in the right direction?
thank you.
12-20-2021 09:24 AM
@lcspereira wrote:
Regarding this suggestion:
"Instead of using the Bytes At Port, just tell the VISA Read to read more bytes than you ever expect in the response"
I think that I didn't understood your suggestion correctly I'm now getting this error:
Can you point me in the right direction?
thank you.
You will get a timeout error if you are trying to talk to a port with nothing on the other side or an instrument that does not understand the *IDN? command. I would just clear that error as we know that port will not be what we are looking for.
Now to your real issue: You are using an IVI driver. I'm not a fan of using IVI and do not use it. VISA resources will not be the same as an IVI session. I would have to do some digging to figure out how to initialize the IVI session.