Igor VISA Control of Instrument

Hello,

I'm trying to control a Chroma 62012P-600-8 power supply through Igor and USB. The manual claims that it should work with NI-VISA which it does when I open the instrument through NI-MAX. It shows up as USB0:. I'm able to open the VISA test panel and get a value return string from a *IDN? call.

However, when I try to connect to the instrument through Igor, I am unable to get a valid response from the IDN call. It just gives me an empty string return because of timeout error on viRead. Below is my code, pretty simple, just trying to connect and verify connection to instrument.

Function ConnectChroma600()
    Variable defaultRM, instr
    String resourceName = "USB0::XXX::XXX::XXX::INSTR"
    viOpenDefaultRM(defaultRM)
        viOpen(defaultRM, resourceName, 0x4, 0, instr) 
    // Do something with instr
    string str="*IDN?",readstr
    VISAWrite instr, str
    VISARead instr, readstr
    print "IDN: ",readstr
    viClose(instr)
    viClose(defaultRM)
End


After running the code in Igor, I need to reset the power on the instrument to get MAX to work again so it seems like it locks up the instrument somehow. I've used NI I/O Trace to see all the commands being sent over the bus through both NI-MAX and Igor. They look to be pretty much the same. MAX does a few viGetAttribute commands to populate there interface with the numbers. I've also tried putting these in the igor code to no results.

<br />
MAX I/O Trace<br />
1.  viParseRsrc (0x0252C990, "USB0::0x1698::0...00000103::INSTR", 7, 0)<br />
2.  viOpen (0x0252C990, "USB0::0x1698::0...00000103::INSTR", 4, 0, 0x1027D988)<br />
3.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), RSRC_NAME, "USB0::0x1698::0...00000103::INSTR")<br />
4.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), INTF_TYPE, 7)<br />
5.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), INTF_TYPE, 7)<br />
6.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), RSRC_CLASS, "INSTR")<br />
7.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), RSRC_NAME, "USB0::0x1698::0...XXX::INSTR")<br />
8.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), MANF_NAME, "Chroma ")<br />
9.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), MANF_ID, 5784)<br />
10.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), MODEL_NAME, "USB-62000P")<br />
11.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), MODEL_CODE, 2103)<br />
12.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), USB_SERIAL_NUM, "XXX")<br />
13.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), TMO_VALUE, 2000)<br />
14.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), TERMCHAR_EN, VI_FALSE)<br />
15.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), TERMCHAR, 10)<br />
16.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), SEND_END_EN, VI_TRUE)<br />
17.  viGetAttribute (USB0::0x1698::0x0837::00... (0x1027D988), IO_PROT, 1)<br />
18.  viWrite (USB0::0x1698::0x0837::00... (0x1027D988), "*IDN?.", 6, 6)<br />
19.  viRead (USB0::0x1698::0x0837::00... (0x1027D988), "CHROMA,62012P-600-8,0...", 1024, 37)<br />
20.  viClose (USB0::0x1698::0x0837::00... (0x1027D988))<br />
<br />
IGOR I/O Trace<br />
1.  viOpenDefaultRM (0x08440628)<br />
2.  viOpen (0x08440628, "USB0::0x1698::0...00000103::INSTR", 4, 0, 0x0842A1B8)<br />
3.  viWrite (USB0::0x1698::0x0837::00... (0x0842A1B8), "*IDN?", 5, 5)<br />
> 4.  viRead (USB0::0x1698::0x0837::00... (0x0842A1B8), 0x0802DF18, 1, 0)<br />
> Status: 0xBFFF0015 (VI_ERROR_TMO)<br />
5.  viClose (USB0::0x1698::0x0837::00... (0x0842A1B8))<br />
6.  viClose (0x08440628)<br />


Apart from the get commands, it seems like these two programs should behave the same. Not sure what's going on here. Is there any hidden or referenced information that Igor is not addressing here? Any help would be great as our machine only has USB or RS-232. Once I can talk to the instrument, the rest of the programming should be fairly simple.

Thanks,
I notice that the NI-MAX viWrite command is sending 6 bytes whereas the Igor viWrite command is sending 5.

I suspect you need to send an LF character. Change to:

String lfStr = "\n"
VISAWrite instr, str+lfStr

Wow, can't believe I missed that one.

I checked and that was the issue, no line feed. Though not sure why it froze the machine up because of this but anyways. Everything works now.

Thanks