Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get error message for VISA in CVI?

Hi there,

  I was using labview 2012 to handle GBIP interface with VISA, the VISA write code will return an error cluster if exists. Recently, I switch to CVI and I use viWrite to write to the GBIP, but in this case, how can I get the error cluster?

0 Kudos
Message 1 of 4
(4,004 Views)

Hi dragondriver,

 

There is not an error cluster in CVI in the same way that there are error clusters in LabVIEW. A VISA function should output an integer if there is an error, but it will not include a string and a boolean like LabVIEW does. You can set up a function that acts like an error cluster by creating a struct that has the error integer, a string related to that integer, and a boolean. You would have to use the integer to look up the error string from a library. 

 

-Erik S

0 Kudos
Message 2 of 4
(3,972 Views)

@Erik-S wrote:

Hi dragondriver,

 

There is not an error cluster in CVI in the same way that there are error clusters in LabVIEW. A VISA function should output an integer if there is an error, but it will not include a string and a boolean like LabVIEW does. You can set up a function that acts like an error cluster by creating a struct that has the error integer, a string related to that integer, and a boolean. You would have to use the integer to look up the error string from a library. 

 

-Erik S


Thanks Erik. I found that when I operate the VISA, it actually return a number to tell success or failure only. I wonder how to extract the error message as string in CVI?

0 Kudos
Message 3 of 4
(3,891 Views)

Hi PKM,

 

You can use the "char *GetUILErrorString (int errorNumber);" function to get the error string from the error number.

 

Here is some documentation on the function:

 

http://zone.ni.com/reference/en-XX/help/370051Y-01/cvi/uiref/cvigetuilerrorstring/

 

 

Nick

Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,875 Views)