Hi All! A bit of a problem getting an instrument to understand what I am passing it, any advice would be very much appreciated!
Background:
- I am sending commands to a semiconductor analyzer from Agilent
- I am connecting via a USB-to-GPIB interface
Symptoms:
- A connection tool verifies that I have a successful connection
- a connection tool also provides a console in which I can enter texts commands (the same as the ones I pass through matlab), and this works perfectly.
- when I connect to the instrument via matlab with the Instrument Control Toolbox, using code like the below, the connection seems to be successful (see next bullet), but the commands that I deliver are not.
- When I send a command (via fprintf()), I get no immediate error in the matlab window, but using the console I can query the instrument for errors, and I get a "command not understood" error. So the instrument is receiving something, but it isnt understanding it
- When I query the instrument (via fscanf()), I get a VISA timeout error in the matlab window, and the same error as usual from the instrument.
An example of the code that I use is the following; I believe it is correct syntax because this code and others have been provided by the manufacturer, and because similar code that I have written based on these examples and those in the instrument control API have been verified to be correct syntax by the manufacturer:
newobjs = instrfind;
if (length(newobjs)~=0)
fclose(newobjs);
delete(newobjs);
end
instrument = visa('agilent', 'GPIB0::17::INSTR');
fopen(instrument);
fprintf(instrument,'*IDN?');
idn = fscanf(instrument)
fclose(instrument);
delete(instrument);
clear instrument idn newobjs A