10-15-2007 12:15 PM
10-16-2007
01:35 PM
- last edited on
08-25-2025
08:43 AM
by
Content Cleaner
Hi,
The function you are using, ibdev, opens and initializes any unused devices on the GPIB bus. If there aren't any devices on the bus, or the devices on the bus are in use, ibdev will return -1. Is this what ibdev is returning in your case? If so, make sure the devices on the bus are not being used. Also, using ibdev in a loop will return the device desciptor after the first iteration, but each iteration afterward will return -1 (if there is just one device on the bus) as the device on the bus is already initialized and in use. Why do you need to run this code multiple times in a loop?
I have attached a link to the both the NI-488.2M Software Reference Manual, https://www.ni.com/docs/en-US/bundle/370950a/resource/370950a.pdf, and the NI-488.2 User Manual, https://www.ni.com/docs/en-US/bundle/ni-488.2-user-manual/resource/370428w.pdf, both of which detail the ibdev function. I hope this helps.
Ted
10-16-2007 07:49 PM
10-17-2007
01:56 PM
- last edited on
08-25-2025
08:44 AM
by
Content Cleaner
Hi,
How are you sending your device hand to the ibsrp() function? If you are getting an invalid handle error, you will need to make sure you are passing the correct device desciptor in the correct format to the ibsrp() function. The device desriptor should be in the form "UDX" where X is an integer returned by the ibdev() function.
A very useful tool when debugging GPIB issues is NI Spy. NI Spy is a utility that shows all commands sent over the GPIB bus, and will let you see the ibdev, ibsrp and all other GPIB commands sent to your device. NI Spy can be found from Measurement and Automation Explorer under Tools>>NI-488.2>>NI Spy or from Start>>All Programs>>National Instruments>>NI Spy. I have attached a link to an online KnowledgeBase detailing how to use NI Spy: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHdrCAG&l=en-US. I hope this information helps.
Ted