Maker Pro
Maker Pro

Controlling Agilent 8510C with Matlab

awanha

May 5, 2023
6
Joined
May 5, 2023
Messages
6
I want to control Agilent 8510C with Matlab. It is connected through GPIB-USB with my laptop. I have tried below code to set the start frequency and to change the Marker 1 position, but i am unable to commicate. Please advice if code is ok or do i need to change something.

omPortName = 'COM3';
sport = serial(ComPortName);
sport.Terminator = 'CR/LF';

% Set Timeout
sport.Timeout = 10.0;

% Open virtual serial port
fopen(sport);

fprintf(sport, '++ver');
ver = fgets(sport);
disp(ver);

fprintf(sport, '++auto 0');
fprintf(sport, '++eos 0');

fprintf(sport,'CORRON'): %Turn on calibration
fprintf(sport,'CALS1') ; %Select calibration #1
fprintf(sport,'STAR 6E9');
%fprintf(sport,'MARK1 6E9');

% Close port
fclose(sport);
 

Delta Prime

Jul 29, 2020
1,915
Joined
Jul 29, 2020
Messages
1,915
You again. A belated welcome to maker pro.:)
Do you have the appropriate driver?
Agilent 8510C Analyzer
Certified LabVIEW Plug and Play (project-style) Instrument Driver
 

awanha

May 5, 2023
6
Joined
May 5, 2023
Messages
6
You again. A belated welcome to maker pro.:)
Do you have the appropriate driver?
Agilent 8510C Analyzer
Certified LabVIEW Plug and Play (project-style) Instrument Driver
Thank You for your support.
Got trapped in doing this stuff. Found out the port was wrong. Now i can send commands to NW analyzer but still trying to read S-Parameters or Marker position.
 

bidrohini

Feb 1, 2023
165
Joined
Feb 1, 2023
Messages
165
The code you provided seems to have a minor issue with the variable name. You define the serial port name as omPortName but later refer to it as ComPortName when creating the serial object.

To fix this issue, you can update the code as follows:

comPortName = 'COM3';
sport = serial(comPortName);
sport.Terminator = 'CR/LF';

% Set Timeout
sport.Timeout = 10.0;

% Open virtual serial port
fopen(sport);

fprintf(sport, '++ver');
ver = fgets(sport);
disp(ver);

fprintf(sport, '++auto 0');
fprintf(sport, '++eos 0');

fprintf(sport,'CORRON'); % Turn on calibration
fprintf(sport,'CALS1'); % Select calibration #1
fprintf(sport,'STAR 6E9');
%fprintf(sport,'MARK1 6E9');

% Close port
fclose(sport);





Make sure that the COM port number (COM3 in this case) matches the one assigned to your GPIB-USB adapter. Also, ensure that you have the required drivers installed and configured for the adapter.

Additionally, please note that the commands CORRON, CALS1, STAR, and MARK1 are specific to the Agilent 8510C network analyzer. Double-check the documentation for the analyzer to ensure you are using the correct commands and syntax for your desired functionality.
 

awanha

May 5, 2023
6
Joined
May 5, 2023
Messages
6
The code you provided seems to have a minor issue with the variable name. You define the serial port name as omPortName but later refer to it as ComPortName when creating the serial object.

To fix this issue, you can update the code as follows:

comPortName = 'COM3';
sport = serial(comPortName);
sport.Terminator = 'CR/LF';

% Set Timeout
sport.Timeout = 10.0;

% Open virtual serial port
fopen(sport);

fprintf(sport, '++ver');
ver = fgets(sport);
disp(ver);

fprintf(sport, '++auto 0');
fprintf(sport, '++eos 0');

fprintf(sport,'CORRON'); % Turn on calibration
fprintf(sport,'CALS1'); % Select calibration #1
fprintf(sport,'STAR 6E9');
%fprintf(sport,'MARK1 6E9');

% Close port
fclose(sport);





Make sure that the COM port number (COM3 in this case) matches the one assigned to your GPIB-USB adapter. Also, ensure that you have the required drivers installed and configured for the adapter.

Additionally, please note that the commands CORRON, CALS1, STAR, and MARK1 are specific to the Agilent 8510C network analyzer. Double-check the documentation for the analyzer to ensure you are using the correct commands and syntax for your desired functionality.
Thank You. There was port issue, in Agilent 8510C we have two HP-IB ports and I was using the wrong one. Now, I can send the commands to the VNA but when it comes to getting values from the VNA, its not working. I want to read S21 parameters or just Marker1 value to be sure that i can read from NA. Below is the code snippet, Please any advice on it.


fprintf(sport, '++auto 1');
fprintf(sport, '++eos 0');

fprintf(sport,'FORM4');
fprintf(sport,'MARK1;OUTPDATA');
%fprintf(sport,'OUTPRAW1');
%fprintf(sport,'S21;OUTPDATA');;

pause(10)
fprintf(sport, '++read eoi');

d=fgets(sport);
disp(d);
fclose(sport);
 

awanha

May 5, 2023
6
Joined
May 5, 2023
Messages
6
Thank You. There was port issue, in Agilent 8510C we have two HP-IB ports and I was using the wrong one. Now, I can send the commands to the VNA but when it comes to getting values from the VNA, its not working. I want to read S21 parameters or just Marker1 value to be sure that i can read from NA. Below is the code snippet, Please any advice on it.


fprintf(sport, '++auto 1');
fprintf(sport, '++eos 0');

fprintf(sport,'FORM4');
fprintf(sport,'MARK1;OUTPDATA');
%fprintf(sport,'OUTPRAW1');
%fprintf(sport,'S21;OUTPDATA');;

pause(10)
fprintf(sport, '++read eoi');

d=fgets(sport);
disp(d);
fclose(sport);
Finally i am able to get one S21 value but i want for a whole sweep. I am using below code, first of all this POIN command does not seem to be working as even i reduce its value, the number of S21 parameters shown does not reduce. Also i am getting below warning. Please any advice on how to calculate S21 for a whole sweep with defined numbers of points.

Code:

fprintf(sport,'CHAN1;S21;LOGP;POIN51;');
fprintf(sport,'SING;');
fprintf(sport,'FORM4;OUTPFORM;');

Warning: The input buffer was filled before the Terminator was reached.
 
Top