LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to control power supply (Agilent E3631A) with CVI

Dear,
 
I got a tough problem about controlling (via GPIB) Agilent E3631A power supply with cvi 6.0. After I run my app and start to initialize the power supply, but then my app can not continue to initialize the Base station (R&S CMU200).
 
the relative code is as below:
 
//==========================================================================
   // INIT PS, Reset device
   //==========================================================================
  OutputStatus("Initiating PS Simulator...");   
  HelloPanelOn("PS Operation","Initiating PS simulator...");
 // CheckPsError(hpe363xa_init ("GPIB::5::%d", VI_TRUE, VI_TRUE, &PS_GPIB_ADDR_handle));
  CheckPsError(Power_Supply_Init (g_vPsGpibAddr, VI_TRUE, VI_TRUE, &g_vPsHandle));
  CheckPsError(Power_Supply_OnOff (g_vPsHandle, g_vVoltage, 3.00, VI_TRUE));
  CheckPsError(Power_Supply_Set ( g_vPsHandle, g_vinstrument, 3.8));
  CheckPsError(Power_Supply_Set_Current (g_vPsHandle, g_vinstrument, 3.00));
 
 
  HelloPanelOff();
 
   //==========================================================================
   // INIT BS, Reset device
   //==========================================================================
   OutputStatus("Initiating BS Simulator...");   
   HelloPanelOn("BS Operation","Initiating BS simulator...");
   CheckBsError(BS_Init(g_vBsType,g_vBsGpibAddr, VI_TRUE,VI_TRUE,&g_vBsHandle));
   HelloPanelOff();
 
Actually, I am not so clear about how to control Power supply . Does anybody can share his/her cvi code, which can control power supply?
Thanks a lot!
crystal
0 Kudos
Message 1 of 3
(3,734 Views)
Hi, crystal,
 a few comments and questions concerning your code
//==========================================================================
   // INIT PS, Reset device
   //==========================================================================
  OutputStatus("Initiating PS Simulator...");   
  HelloPanelOn("PS Operation","Initiating PS simulator...");
 // CheckPsError(hpe363xa_init ("GPIB::5::%d", VI_TRUE, VI_TRUE, &PS_GPIB_ADDR_handle));
It seems that  you did try to use the National Instruments Instrument driver for the E363x series here.
But this doesn't work, because you didn't setup the Resource Name right.

  CheckPsError(Power_Supply_Init (g_vPsGpibAddr, VI_TRUE, VI_TRUE, &g_vPsHandle));
  CheckPsError(Power_Supply_OnOff (g_vPsHandle, g_vVoltage, 3.00, VI_TRUE));
  CheckPsError(Power_Supply_Set ( g_vPsHandle, g_vinstrument, 3.8));
  CheckPsError(Power_Supply_Set_Current (g_vPsHandle, g_vinstrument, 3.00));
What driver/library are you using here ? Does it really support the E3631A ? The E3631A is different to the other E363x series supplies, because it has 3 voltage outputs. And this driver seems to lack the ability of setting up more than one output , because these is no option to choose the output.  
 
 
Here a snippet of code were are using build upon a version of the NI Instrument driver. Probably  you want to adapt the error handling to your needs.
 
 
 
 
    // Initialize PS_P24V
    Fmt(resource_id,"GPIB::%d[w2]::INSTR",addr_PS_P24V);
   
 status = hpe363xa_init (resource_id, VI_TRUE, VI_TRUE,
       &Instr_Handle_PS_P24V);
   
   
    if ( status ) {
     error = status ;
  status = hpe363xa_error_message (Instr_Handle_PS_P24V, error, errMsg);
     goto Error;
    }
    
       
    // Specify Output of Power Supply P24V
 
 
    status = hpe363xa_reset (Instr_Handle_PS_P24V);
 
    if ( status ) {
     error = status ;
  status = hpe363xa_error_message (Instr_Handle_PS_P24V, error, errMsg);
     goto Error;
    }
 
 status = hpe363xa_ConfigureVoltageLevel (Instr_Handle_PS_P24V, ps_channel, 24.0);
   
    if ( status ) {
     error = status ;
  status = hpe363xa_error_message (Instr_Handle_PS_P24V, error, errMsg);
     goto Error;
    }
     
    
 // status = hpe363xa_outputOn (Instr_Handle_PS_P24V, hpe363xa_OUTPUT_ON);
 status = hpe363xa_ConfigureOutputEnabled (Instr_Handle_PS_P24V, ps_channel,
             VI_TRUE);
   
    if ( status ) {
     error = status ;
  status = hpe363xa_error_message (Instr_Handle_PS_P24V, error, errMsg);
     goto Error;
    }
    
 status = hpe363xa_Measure (Instr_Handle_PS_P24V, ps_channel,
          HPE363XA_VAL_MEASURE_VOLTAGE,
          &voltage_PS24);
 
 if ( status ) {
     error = status ;
  status = hpe363xa_error_message (Instr_Handle_PS_P24V, error, errMsg);
     goto Error;
    }
    
 status = hpe363xa_Measure (Instr_Handle_PS_P24V, ps_channel,
          HPE363XA_VAL_MEASURE_CURRENT,
          &current_PS24);
 
 
  if ( status ) {
     error = status ;
  status = hpe363xa_error_message (Instr_Handle_PS_P24V, error, errMsg);
     goto Error;
    }

 
Message 2 of 3
(3,719 Views)
Hi
Thanks for your explanation. I will try to change my code regarding your example:-)
crystal
0 Kudos
Message 3 of 3
(3,703 Views)