Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5566

How to open an Instrument using it's known USB Serial Number?

$
0
0

Hello,

I write an application to open two the same counters CNT-91 (Pendulum) to be connected to USB of one PC.

These counters have an identical USB VID, PID and are distinguished by Serial Number (SN).

But I can't open the counter using USB SN.

 

My app correctly sends and gets the NI VISA commands because I can open and control one CNT-91 using it's VID (VI_ATTR_MANF_ID==0x14EB) and get the SN.

Here are NI VISA used and correctly worked NI VISA functions, the status after execution and the SN in answer of CNT-91:

 

viOpenDefaultRM(@RM) : OK (Status=0)

    SN1=PChar('USB?*INSTR{VI_ATTR_MANF_ID==0x14EB}')
viFindRsrc(RM, SN1, @findList, @numInstrs, Resource1) : OK

viOpen(RM, Resource1, 0, 0, @CNT1) : OK
viSetAttribute(CNT1, VI_ATTR_TMO_VALUE, 1000) : OK

viWrite(CNT1,'*IDN?\n',b,@RetCount) : OK
viRead(CNT1,buf,MAX_CNT,@RetCount) : OK
   PENDULUM, CNT-91, 976722, V1.21 03 Dec 2007 :Result for '*IDN?\n' request, it contains the Serial Number 976722
viClose(CNT1) : OK
viClose(RM) : OK

 

The SN is 976722 in answer of CNT-91.
I also check this SN in Windows' Device Manager when connecting CNT-91 to USB.

 

But there are errors when I try to open the instrument using SN:

viOpenDefaultRM(@RM) : OK (Status=0)

    SN1=PChar('USB?*RAW{VI_ATTR_USB_SERIAL_NUM==976722}')
viFindRsrc(RM, SN1, @findList, @numInstrs, Resource1)          : VI_ERROR_RSRC_NFOUND (Status=0xBFFF0011)

 

In datasheet for CNT-91 the feasibility to use SN to open the instrument is proclaimed.

 

How one may correctly find and open the instrument using SN?

 

==

I also tried

    SN1=PChar('USB?*INSTR{VI_ATTR_USB_SERIAL_NUM==976722}')     //*INSTR vs *RAW

but with the same error.

 

I read the topic viFindRsrc using VI_ATTR_USB_SERIAL_NUM

but link in the second post for 'How do I Find All VISA Instrument Resources Using LabWindows?' is wrong.

 

 


Viewing all articles
Browse latest Browse all 5566

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>