LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't catch error when using ibdev and ibwrt with device not powered

Trying to implement some error handling in my program.
 
Using ibdev to get the instrument handle but it gives same result whether or not the device is powered.
Both ibsta and iberr are the same after this call.
 
Once I use ibwrt, I get a non-fatal run-time error (iberr==2[0x2]) when debugging except then my program crashes.
 
Something seems weird, I need to be able to catch the error without the program crashing.
 
Thanks
0 Kudos
Message 1 of 8
(4,354 Views)
 
Hi hillb,
 
If you are using NI-VISA to communicate with the instrument you should be able to monitor all the driver calls using NI-Spy.  I would also suggest taking a look at ni.com/idnet to see if there is an instrument driver available for your instrument. 
 
Regards,
 

Message Edited by Andy L on 09-28-2007 03:08 PM

Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(4,341 Views)

Thanks, not sure if I'm misunderstanding but I'm trying to do this within a labwindows/cvi exceutable.  It appears that the instrument only has a llb file for labview so I'm out of luck.

Brian

0 Kudos
Message 3 of 8
(4,329 Views)
Hi Brian,
 
I did some research and error (iberr==2[0x2]) looks to be a GPIB timeout error.  I have attached a knowledgebase article that explains more about the error2 and lists common solutions.  It looks like the error is most commonly a result of the primary address not being configured correctly. 
Regards,
Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 8
(4,307 Views)

Thanks for your  help, but my problem is not the error itself, but that I can't catch the error.  

I'm causing the error to happen by not turning the device on. 

I'm trying to figure out what I can do to catch the problem before my program crashes.   The get handle function seems to act the same even with  the device off. 

0 Kudos
Message 5 of 8
(4,298 Views)

Hello,

 

I am not sure anymore why, but I replaced (many years ago) the call to ibdev with a call to OpenDev (and an arbitrary unique name) and subsequently changed the primart address (ibpad) of this device to the one I needed for the instrument.

  *Device = OpenDev ("", DeviceName);
  if (*Device <= 0)
  {
   .... ....
  }
  if (ibpad (*Device, address) < 0)
  {
   .... ....
  }

 

Succes, Jos

 

 

0 Kudos
Message 6 of 8
(4,291 Views)
Thanks Jos, but even these functions  dont' give me an error when the device is off!
0 Kudos
Message 7 of 8
(4,283 Views)

I was finally able to catch the error inside of the ibwrt.  Don't know why I couldn't do it with any of the open functions but thanks for everyone's help.

Brian

0 Kudos
Message 8 of 8
(4,280 Views)