09-29-2010 09:16 AM
So I have a program that the user can select which instruments connected to the computer they want to use for their program. I search using the VISA controls of Find Resource and Parse. Once they select the instruments they want, I save/have the following data:
Instrument Handle, Device Type, Model Category and Model. (The latter three help me distinguish which .fp to get functions from)
Now what I would like to do is "save a session" so the next time the user wants to run the program, they open a file and all the instruments get connected automatically. Is there a GOOD way to essentially know which instruments to connect?
As I investigate, I seem to have run into some issues such as:
What if the instrument is connected to a different GPIB port? Or USB now instead of GPIB?
Same instrument model, but different instrument?
I would still want to connect to these instruments.
I do not need to cover the cases in which a different type of Model (ex Tektronix instead of Agilent connected) as I would flag this and not proceed.
It seems the easiest would be to save the model and search via an IDN string. this of course is limited to 488.2 or similar standards.
Any advice is appreciated.
Thanks
09-29-2010 10:05 AM
Not specifically related to GPIB environment, but you could save those parameters to a file with the IniFile instrument creating a configuration file to read back at program start; next you can rebuild the IDN string and perform VISA scans to check if the same instrument is connected to the PC.
09-29-2010 10:12 AM
Currently i'm using an xml format because I needed a little more functionality than a .ini. I have all that figured out, just want to be able to safely and correctly connect to devices.
I believe my strategy is heading toward what you mentioned by getting all connected devices, and searching all the idn strings from my model name at a minimum. That way I could at least match up any standard instrument. Others such as COM or non-standard may have to be either assumed or prompted from user.
The next issue that would come of this would be if I had two of the same model connected. In this case, it may be wise to somehow store the address or serial number. Is there a way to get the address of a device from an instrument ID?