AnsweredAssumed Answered

reading nwa errortermsVRf- reading nwa errorterms

Question asked by VRFuser on Jul 21, 1996

Russ McCrory mentioned some problems about reading error terms from the hp8720
network analyzer. I also had some strange effects with direct I/O objects doing
the same for hp8753* and hp8719/20 networkanalyzers. In the end I started changing
a driver that was available for the hp8753c in the id-language. All hp nwa's
act nearly the same over hpib. So I added an 'identity' component and based upon
that value I added some CASE statements in those rare places where hp8753a, -b,
-c, -d or hp8719c differ in command sytax. (In this way I made also a driver available
for the hp8719c since it is not supplied by Hewlett-Packard's VEE, that's why I
mention it.)

I have also added, among other features, more functionality to the 'Active_trace'
component in the driver to support the transfer of errorterms to/from the instrument.
That seems to work very well, at least I have not yet encoutered any problems compared
to direct I/O. I have encluded part of the driver in an 'un-documented' fashion. It
are the 'Data_Array' component and the 'Get_Data_Array' actions block. There you can
see how the '#A' blocktransfer is decoded. You could make a dedicated driver just
for the purpose of errorterm transfer based upon these components (?)

Regards

Remi Tuijtelaars
  Philips Semiconductors, Dev. T&D, Building BY2.021,
  Gerstweg 2, NL-6534 AE Nijmegen, Netherlands.
  tel/fax: + 31 24 353 - 2812 / 3160.
  email: Remi.Tuijtelaars@nym.sc.philips.com
  (seri: nytuijte@nyhp02)
 
===================================================================================


COMPONENT Data_Array NOTSAVED NOGEN NOERRCHECK;
  TYPE RARRAY 2,1602;
  INITIAL INVALID;
  SET ACTIONS;
!    SELECT Channel;
!    CASE Channel1;
!      GET Number_of_points1;
!     CASE Channel2;
!      GET Number_of_points2;
!    END SELECT;
    SELECT Active_Trace;
    CASE (Active_Trace) Data;
      OUTPUT STRING "HOLD;FORM3;INPUDATA;";
      GOSUB Set_Data_Array;
      GOSUB Set_sweep_mode;
    CASE (Active_Trace) Form;
      OUTPUT STRING "HOLD;FORM3;INPUFORM;";
      GOSUB Set_Data_Array;
      GOSUB Set_sweep_mode;
    CASE (Active_Trace) Raw_1;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;  ! Need to turn correction ON to write raw data arrays
        NOTIFY "Turn Correction ON To Write Raw Data Arrays.";
      ELSE;
        OUTPUT STRING "HOLD;FORM3;INPURAW1;";
        GOSUB Set_Data_Array;
      END IF;
      GOSUB Set_sweep_mode;
    CASE (Active_Trace) Raw_2;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;
        NOTIFY "Turn Correction ON To Write Raw Data Arrays.";
      ELSE;
        OUTPUT STRING "HOLD;FORM3;INPURAW2;";
        GOSUB Set_Data_Array;
      END IF;
      GOSUB Set_sweep_mode;
    CASE (Active_Trace) Raw_3;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;
        NOTIFY "Turn Correction ON To Write Raw Data Arrays.";
      ELSE;
        OUTPUT STRING "HOLD;FORM3;INPURAW3;";
        GOSUB Set_Data_Array;
      END IF;
      GOSUB Set_sweep_mode;
    CASE (Active_Trace) Raw_4;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;
        NOTIFY "Turn Correction ON To Write Raw Data Arrays.";
      ELSE;
        OUTPUT STRING "HOLD;FORM3;INPURAW4;";
        GOSUB Set_Data_Array;
      END IF;
      GOSUB Set_sweep_mode;
    CASE (Active_Trace) Memory;
      OUTPUT STRING "DISPMEMO;HOLD;FORM3;INPUDATA;";
      GOSUB Set_Data_Array;
      OUTPUT STRING "WAIT;DATI;";
      GOSUB Set_Display_Type;  ! Reset the display back where it was    ! check
      GOSUB Set_sweep_mode;
    CASE ELSE;    !  Correction Arrays
      ! To save cal sets into the instrument requires knowledge of what
      ! cal kit and cal types are available.  This is a difficult problem
      ! given that the calibration may be redefined by the user.
!      ! Therefore, it's not implemented in this version of the driver.
!      NOTIFY "Sorry, storing calibration arrays is not supported.";
!       OUTPUT STRING "HOLD;CORROFF;FORM3;";
                               
                SELECT Active_Trace;
                CASE (Active_Trace) Calc_01;
                  OUTPUT STRING "FORM3; INPUCALC01;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_02;
                  OUTPUT STRING "FORM3; INPUCALC02;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_03;
                  OUTPUT STRING "FORM3; INPUCALC03;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_04;
                  OUTPUT STRING "FORM3; INPUCALC04;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_05;
                  OUTPUT STRING "FORM3; INPUCALC05;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_06;
                  OUTPUT STRING "FORM3; INPUCALC06;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_07;
                  OUTPUT STRING "FORM3; INPUCALC07;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_08;
                  OUTPUT STRING "FORM3; INPUCALC08;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_09;
                  OUTPUT STRING "FORM3; INPUCALC09;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_10;
                  OUTPUT STRING "FORM3; INPUCALC10;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_11;
                  OUTPUT STRING "FORM3; INPUCALC11;";
                  GOSUB Set_Data_Array;
                CASE (Active_Trace) Calc_12;
                  OUTPUT STRING "FORM3; INPUCALC12;";
                  GOSUB Set_Data_Array;
                CASE ELSE;
                  NOTIFY "Bad CASE for Active_Trace in Data_Array";
                END SELECT;
!     GOSUB Set_sweep_mode;
    END SELECT;
  END ACTIONS;
  GET ACTIONS; 
    MATSCALE 0 0 Data_Array;       ! Zero out the array first.
    SELECT Active_Trace;
    CASE (Active_Trace) Data;
      FETCH (Sweep_mode1) hold; FETCH Sweep_mode1; NE;
      IF STACK THEN;
       GOSUB Take_sweep;
      END IF;
      OUTPUT STRING "FORM3;OUTPDATA;";
      GOSUB Get_Data_Array;
    CASE (Active_Trace) Form;
      FETCH (Sweep_mode1) hold; FETCH Sweep_mode1; NE;
      IF STACK THEN;
       GOSUB Take_sweep;
      END IF;
      OUTPUT STRING "FORM3;OUTPFORM;";
      GOSUB Get_Data_Array;
    CASE (Active_Trace) Raw_1;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;  ! Need to turn correction ON to read raw data arrays
        NOTIFY "Turn Correction ON To Read Raw Data Arrays.";
      ELSE;
        GOSUB Take_Sweep;
        OUTPUT STRING "FORM3;OUTPRAW1;";
        GOSUB Get_Data_Array;
      END IF;
    CASE (Active_Trace) Raw_2;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;
        NOTIFY "Turn Correction ON To Read Raw Data Arrays.";
      ELSE;
        GOSUB Take_Sweep;
        OUTPUT STRING "FORM3;OUTPRAW2;";
        GOSUB Get_Data_Array;
      END IF;
    CASE (Active_Trace) Raw_3;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;
        NOTIFY "Turn Correction ON To Read Raw Data Arrays.";
      ELSE;
        GOSUB Take_Sweep;
        OUTPUT STRING "FORM3;OUTPRAW3;";
        GOSUB Get_Data_Array;
      END IF;
    CASE (Active_Trace) Raw_4;
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;
        NOTIFY "Turn Correction ON To Read Raw Data Arrays.";
      ELSE;
        GOSUB Take_Sweep;
        OUTPUT STRING "FORM3;OUTPRAW4;";
        GOSUB Get_Data_Array;
      END IF;
    CASE (Active_Trace) Memory;
        OUTPUT STRING "DISPMEMO;FORM3;OUTPMEMO;";
        GOSUB Get_Data_Array;
        GOSUB Set_Display_Type;  ! Reset the display back where it was  !check
    CASE ELSE;    !  Must be Correction Arrays
      GET Correction_Off_On;
      FETCH (Correction_Off_On) Off;
      FETCH  Correction_Off_On; EQ;
      IF STACK THEN;  ! Need to turn correction ON to read correction arrays
        NOTIFY "Turn Correction ON To Read Correction Arrays.";
      ELSE;
        GET Correction_type;
        SELECT Correction_type;
        CASE None;
          NOTIFY "No data to output";
        CASE Response;
                SELECT Active_Trace;
                CASE (Active_Trace) Calc_01;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC01;";
                  GOSUB Get_Data_Array;
                CASE ELSE;
            NOTIFY "No data to output";
          END SELECT;
        CASE Resp_and_isoln;
                SELECT Active_Trace;
                CASE (Active_Trace) Calc_01;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC01;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_02;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC02;";
                  GOSUB Get_Data_Array;
                CASE ELSE;
            NOTIFY "No data to output";
          END SELECT;       
        CASE S11_1port;
                SELECT Active_Trace;
                CASE (Active_Trace) Calc_01;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC01;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_02;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC02;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_03;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC03;";
                  GOSUB Get_Data_Array;
                CASE ELSE;
            NOTIFY "No data to output";
          END SELECT;               
        CASE S22_1port;
                SELECT Active_Trace;
                CASE (Active_Trace) Calc_01;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC01;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_02;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC02;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_03;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC03;";
                  GOSUB Get_Data_Array;
                CASE ELSE;
            NOTIFY "No data to output";
          END SELECT;
        CASE ELSE;
                SELECT Active_Trace;
                CASE (Active_Trace) Calc_01;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC01;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_02;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC02;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_03;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC03;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_04;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC04;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_05;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC05;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_06;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC06;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_07;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC07;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_08;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC08;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_09;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC09;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_10;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC10;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_11;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC11;";
                  GOSUB Get_Data_Array;
                CASE (Active_Trace) Calc_12;
                  OUTPUT STRING "HOLD;FORM3;OUTPCALC12;";
                  GOSUB Get_Data_Array;
                CASE ELSE;
                  NOTIFY "Bad CASE for Active_Trace in Data_Array";
                END SELECT;
        END SELECT;
!             GOSUB Set_sweep_mode; ! Why ??
      END IF;
    END SELECT;
  END ACTIONS;
END COMPONENT;    !  Data_Array

===================================================================


ACTIONS Get_Data_Array;
  ENTER STACK FORMAT "#,W";      ! Header = ( '#', 'A' )
  DROP;                          ! Remove Header from top of stack
  ENTER STACK FORMAT "#,W";      ! Number of bytes to follow
  FETCH 16; DIV; DUP;                    ! Stack contains number of points
  STORE Number_of_points;                                ! check no_of_data_points
  FETCH 1; FETCH 1602; STORE Data_array;         ! Store number of points in last element
                                           ! for easy arrat-cutting in VEE
  FETCH Number_of_points; DUP;
  SELECT Channel;
   CASE Channel1;
    STORE Number_of_points1;
   CASE Channel2;
    STORE Number_of_points2;
  END SELECT;
 
====================================================================

Outcomes