Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how to install a instrument driver in labview.

Just place a VISA Resource Name control on the front panel.

 

What type of USB resource are you talking about?

0 Kudos
Message 21 of 34
(2,399 Views)

HI, Dennis

 

I want to get resource name by program, don't ask user to select,  I think it is better for user.

 

I can init device during program is starting.

 

Can it be implemented by program?

 

For usb, it is another device, digital oscilloscope.

 

thanks.

 

br

 

 

0 Kudos
Message 22 of 34
(2,393 Views)

If you know that the VISA Resource will stay the same (i.e. Com1), then you can just use a block diagram constant. Otherwise, you would need to use the VISA Find Resource function. This will return an array of available resources. Pass the array to a for loop and for each resource, do a write and read of some known query. When you get an expected response, you have found the resource for that particular instrument.

 

If the scope is USBTMC and you have the appropriate driver installed for it, the device will appear in MAX whenever it is plugged in and you will have it as a VISA resource.

Message 23 of 34
(2,377 Views)

Hi, Dennis,

 

Tha's very good answer. I will try it.

 

thank your very much.

 

MY USB  visa rource name is :USB0::0x1AB1::0x0588::DS1K00005888::INSTR.

 

What is the meaning of USBTMC?

 

Thanks.

  

0 Kudos
Message 24 of 34
(2,374 Views)

As for adding serial support to the driver, you could take a look at the existing DC Power IVI drivers which already implement the code and try to reuse that code in Chroma driver. An example could be Agilent E364XA IVI driver:

 

http://sine.ni.com/apps/utf8/niid_web_display.download_page?p_id_guid=E3B19B3E90F3659CE034080020E748... 

 

Here is the code related to serial support found in the IviInit function:

 

/* Configure VISA Serial I/O */
        viCheckErr( viGetAttribute (io, VI_ATTR_INTF_TYPE, &interface_type));
        if (interface_type == VI_INTF_ASRL)
  {
            viCheckErr( viSetAttribute (io, VI_ATTR_TERMCHAR, '\n'));
            viCheckErr( viSetAttribute (io, VI_ATTR_TERMCHAR_EN, VI_TRUE));
            viCheckErr( viSetAttribute (io, VI_ATTR_ASRL_END_IN, VI_ASRL_END_TERMCHAR));
            viCheckErr( viSetAttribute (io, VI_ATTR_ASRL_END_OUT, VI_ASRL_END_TERMCHAR));
  }

 

Once you update the .c file, you need to rebuild the DLL. Also, your serial settings on the instrument, in MAX, and in the driver have to fully match.

Message 26 of 34
(2,356 Views)

hi, gagi1

 

thanks.

 

I will read that code. thanks your help.

0 Kudos
Message 27 of 34
(2,350 Views)

hi, Dennis

 

If i want to create a  driver by myself, Should i use VISA interface to implement it?

 

Sending command and waiting for resposne, just like that right? 

 

In general, how long should i wait for response and how long interval should be set

 

between command? Can you give me a basical instruction?

 

thanks.

 

Happy new year!

 

br.

 

 

帖子被mmm2006在 12-30-2009 07:27 PM
时编辑过了
0 Kudos
Message 28 of 34
(2,349 Views)

Yes, VISA is the recomended API. In fact, that is your only option if you use LabVIEW for serial.

 

You may not need any delays at all. Probably the reason that the IVI driver fails is that it does not send a termination character and my guess is that instrument sends a termination character with it's response. If so, you just have to enable termination character in the VISA Configure Serial Port and set some large number of bytes to read with the VISA Read. The VISA Read will automatically terminate when it detects the termination character. What that means is that you can often follow the VISA Write with a VISA Read. Any necessary delay will be handled by the VISA Read function waiting for the termination character.

 

Even if you need a delay somewhere, a more sophisticated approach would be use a while loop with the VISA Bytes at Serial Port in it. The loop would be exited when the number of bytes is greater than 0. This would then pass to another loop with a VISA Bytes at Serial Port and a VISA Read. This loop would exit when the number of bytes is 0. You would also need a timeout function in at least the first loop. Fixed delays have a habit of coming back to haunt you. Made to long, they just waste time. On the other hand, you can easily set a delay tha might work fine on one pc or one instrument and require a longer delay on a different pc/instrument.

0 Kudos
Message 29 of 34
(2,342 Views)

Dear All

 

looking for Help

 

I have programmable power supply Chroma Model 62012P-40-120. I write RS232 communication based on the protocol from the manufacturer to set volatge ,current to the supply and measure the volatge and current output from the power supply. I have no problem with the communication . i can set the volatge and the current to the power supply and i can remotelly control (ON/OFF) the DC ouput of the supply. But when i try request volatge and current output of the power supply and connect them in series i can read the measure output either the volatge or the current but not both.

if the measure volatge request is 1st i can read it but no the current request and vise versa. But i can see the volatge and current ouput in the screen of the Power supply. Here i have attached the screent shoots of my labview programs. The status message is OK in both cases.

 

 

Thank u inadvance

0 Kudos
Message 30 of 34
(1,515 Views)