AnsweredAssumed Answered

U2702A IVI C Init() fails ***SOLVED***

Question asked by Angelillo on Apr 29, 2009
Latest reply on May 8, 2009 by Angelillo
Hello,

I am having problem to connect to my oscilloscope using IVI C. Initialization function fails returning error code 0 and no error description message is provided:

"

** Init() Error: 0,

Done - Press Enter to Exit

"


Looking at Agilent Connection Expert all seem to be OK:

Image

I am able to perform interactive IO, indeed:

Image

Here is the piece of code I wrote:

"

#include <stdio.h>
#include <stdlib.h>
#include <AgU2701A.h>
// Link to: AgU2701A.lib

//Parámetros de la sesión
#define RESOURCE_NAME "USB0::2391::10520::MY48352015::0::INSTR"
#define ID_QUERY VI_TRUE
#define RESET VI_TRUE
#define OPTIONS "RangeCheck=true, QuerytInstrStatus=true, Cache=false, Simulate=false, RecordCoercions=false, InterchangeCheck=false"

//Parámetros de la adquisición
#define TIME_PER_RECORD 0.000001 //1us
#define MIN_NUM_PTS 1000
#define ACQUISITION_START_TIME 0
#define ACQUISITION_TYPE AGU2701A_VAL_NORMAL //AGU2701A_VAL_AVERAGE
#define INTERPOLATION AGU2701A_VAL_NO_INTERPOLATION //AGU2701A_VAL_SINE_X AGU2701A_VAL_LINEAR
#define NUMBER_OF_AVERAGES 16 //Poner ACQUISITION_TYPE a AGU2701A_VAL_AVERAGE

//Parámetros de los canales
#define CHANNEL1_RANGE 1.0     //Voltios pico a pico
#define CHANNEL1_OFFSET 0.0     //Voltios
#define CHANNEL1_COUPLING AGU2701A_VAL_DC //AGU2701A_VAL_AC AGU2701A_VAL_GND
#define CHANNEL1_PROBE_ATTENUATION 10.0     //Factor de atenuación de la sonda
#define CHANNEL1_ENABLED VI_TRUE
#define CHANNEL2_RANGE CHANNEL1_RANGE
#define CHANNEL2_OFFSET CHANNEL1_OFFSET
#define CHANNEL2_COUPLING CHANNEL1_COUPLING
#define CHANNEL2_PROBE_ATTENUATION CHANNEL1_PROBE_ATTENUATION
#define CHANNEL2_ENABLED VI_TRUE

//Parámetros del disparo
#define TRIGGER_SOURCE "Channel1"
#define TRIGGER_LEVEL 2.5
#define TRIGGER_SLOPE AGU2701A_VAL_POSITIVE //AGU2701A_VAL_NEGATIVE
#define TRIGGER_TYPE AGU2701A_VAL_EDGE_TRIGGER
#define TRIGGER_HOLDOFF 0
#define TRIGGER_COUPLING AGU2701A_VAL_DC
#define TRIGGER_MODIFIER AGU2701A_VAL_AUTO //AGU2701A_VAL_NO_TRIGGER_MOD

//Otras definiciones
#define ERROR_DESCRIPTION_BUFFER_SIZE 8192
#define CHANNEL_NAME_BUFFER_SIZE 256
#define MAX_TIME_MILLISECONDS 1000 //Ver AgU2701A_ReadWaveform()

int main(){
     ViStatus status;
     ViSession vi;
         
     ViStatus errorCode;
     ViChar errorDescription[ERROR_DESCRIPTION_BUFFER_SIZE];

     ViChar channelName[CHANNEL_NAME_BUFFER_SIZE];
     ViInt32 channelIndex = 1;

        ViInt32 actualRecordLength;
     ViInt32 sampleMode;
     ViReal64 sampleRate;

     ViReal64* waveformArray1;
     ViReal64* waveformArray2;
     ViReal64 initialX;
        ViReal64 xIncrement;

     FILE* file;

     int i;
     
     //Inicio de sesión
     //status = AgU2701A_init(RESOURCE_NAME, ID_QUERY, RESET, &vi); //Init sin opciones
     status = AgU2701A_InitWithOptions(RESOURCE_NAME, ID_QUERY, RESET, OPTIONS, &vi); //Init con opciones
     if(status)
     {
          //Init failed
          AgU2701A_GetError(vi, &errorCode, ERROR_DESCRIPTION_BUFFER_SIZE, errorDescription);
          printf("** Init() Error: %d, %s\n", errorCode, errorDescription);
          printf("\nDone - Press Enter to Exit");
          getchar();
          return 0;
     }


...
...
...

"


I get the error both with init() and initWithOptions() unless "simulate=true" is passed in initWithOptions()

Hope you can give me some help.

Thanks in advance.  

Outcomes