All,
I want my application to support either an Agilent 856X spectrum analyzer (VISA commands) or an Agilent PSA-E44XX spectrum analyzer (IVI commands) programmatically, I don't want the user to have to decide the analyzer type. My first idea was to query the analyzer for its identification. However, the 856X command for identification query is (ID?) and the PSA-E44XX's is (*IDN?). The problem is sending the wrong command to either instrument generates an error condition. For example:
Step 1) Send *IDN? to 856X: This creates error code 112 and the READ command times out.
Send *IDN? to PSA-E44XX: Good to go. Can READ back results.
Step 2) Send ERR? to 856X: Clears error code 112 and can READ back 112 so I know which instrument I have by default. Carry on with instrument type 856X.
Send ERR? to PSA-E44XX: Causes instrument to hang and eventually times out.
It seems like what you do to get around error condition with one instrument type makes the other instrument type unusable. Also, I did think to use the GPIB READ and WRITE VIs instead of the VISA and IVI so both instruments will respond.
Is there a cleaner way to handle having the program figure out which analyzer it is talking to without relying on timeouts to ocurr?
Thanks,
-Scott