07-23-2011 05:20 AM
Hi everybody,
I am trying to detect the externally connected comport to the pc,automatically.
I am unable to detect the correct port. Some port which is not required is being shown.
Can anyone of u all suggest me something.
07-23-2011 10:40 AM
How are you trying to detect it? With the VISA Find Resource? After finding all of the ports, what do you do to detect a specific instrument is connected to one of them?
Attach your code.
07-26-2011 01:17 AM
Hello,
First of all thank you for the reply. I have developed a small vi through which we can detect on which port the data has been written,may be the application may be wrong but here the problem is it is detecting the wrong port.
07-26-2011 01:24 AM
hi,
Here i am attching my code to detect the port automatically once it is connected. Suggest me if there are any mistakes.
07-26-2011 09:22 AM
Several things.
07-26-2011 09:48 AM
Also, you will want to add a small delay in the while loop. You can put the delay between the write and read VI functions. This will give the com port time to receive the data, plus add a needed wait to the while loop.
Your first Visa resource name is Com 0. So it is checking COM 0-9. Is this what you want?
07-28-2011 06:52 AM
hi everybody,
Thanks for the reply. Actually what i am trying to do is,the vi which i sent before,i am using it only to detect the port number to which the port is connected externally. And ofcourse i used the delay inbetween the read and write,but i still dont find any difference in the outcome. Secondly after the port has been correctly configured then the output of this is being connected to the serial port read and write resource name(which is there in the example finder).
So finally i am trying to figure out to detect the port number correctly by sending 3 bytes of data and trying to match to which port it is been written to.
07-28-2011 07:07 AM - edited 07-28-2011 07:11 AM
@dtwtwetw wrote:
[...]...
So finally i am trying to figure out to detect the port number correctly by sending 3 bytes of data and trying to match to which port it is been written to.
Once your program has found existing com ports, try sending 3 bytes to each one consecutively, then Visa Read exactly 3 bytes, but use a very short timeout. The port that does not timeout is the winner.
BTW, here's a VI example that'll find the ports using ASRL names - been working fine for me these last 6 years or so.
03-25-2015 04:11 AM
Your example seems to do pretty much what I want to do 🙂