Discussion Forums are temporarily in read only mode. All forums are visible but posting is not possible. Please check back shortly.

Thread: agilent34410a IVICom wrong return


Permlink Replies: 14 - Pages: 1 - Last Post: Apr 24, 2012 8:55 AM Last Post By: hognala
gumanist

Posts: 9
Registered: 04/03/12
agilent34410a IVICom wrong return
Posted: Apr 3, 2012 5:18 AM
Click to report abuse...   Click to reply to this thread Reply
Hi,

I'm trying to connect with 34410 through usb using latest IVICom driver_ivicom_ivic_Agilent34410_1_0_22_0.msi, but it return wrong value "9,9E37" on all functions, though it changes function voltage, resistance e.t.c, however it return right value when IO Monitor is runned. With driver_ivicom_ivic_Agilent34410_1_0_19_0.msi all work fine.

Thanks in advance.
hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 3, 2012 10:59 AM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
Can you post some code that shows this behavior?
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 3, 2012 9:21 PM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
//Function create the driver
void __fastcall CreateDRV()
{
HRESULT hr;
IIviDriver *pInknown = NULL;
// IAgilent34405 pAg34405 = NULL;

const int tmp_size = 1024;
char ch_temp1 tmp_size = {0};
char ch_temp2 tmp_size = {0};
wchar_t wchProgID tmp_size = {0};
wchar_t wchResource tmp_size = {0};
wchar_t wchLN tmp_size = {0};
wchar_t *pwcDrvSetup = L"QueryInstrStatus=false, Simulate=false, Cache=false";
wchar_t *pwcRDes = NULL;
short shInit;

CLSID clsid;
bool bUseLogicalName;

bUseLogicalName = CheckBoxUseConfigStore->Checked;

EditLogicalName->Text.WideChar( wchLN , tmp_size );

try
{
if( pIviDmm )
{
pIviDmm->Close();
pIviDmm->Release();
}

if( bUseLogicalName )
{
hr = spFactory->CreateDriver( wchLN , (IUnknown**)&pInknown );
hr = pInknown->QueryInterface( IID_IIviDmm , (void**)&pIviDmm );

if( !SUCCEEDED( hr ) )
{
TraceError( Handle );
}
}
else
{
//Create through ProgID
EditProgID->Text.WideChar( wchProgID, tmp_size );
hr = CLSIDFromProgID( wchProgID , &clsid );

hr = ::CoCreateInstance(
clsid,
NULL,
CLSCTX_ALL,
IID_IIviDmm,
(void**)&pIviDmm);

if( !SUCCEEDED( hr ) )
{
TraceError( Handle );
}
}

if( pIviDmm )
{
IIviDriverIdentity *pDI = NULL;
wchar_t *pCroupCpb = NULL;

EditResource->Text.WideChar( wchResource , tmp_size );
if( bUseLogicalName )
{
hr = pIviDmm->Initialize( wchLN , VARIANT_TRUE , VARIANT_TRUE , pwcDrvSetup );
if( !SUCCEEDED( hr ) )
{
TraceError( Handle );
}
hr = pIviDmm->get_Initialized( &shInit );
}
else
{
//wchResource
EditResource->Text.WideChar( wchResource , tmp_size );
hr = pIviDmm->get_Initialized( &shInit );
hr = pIviDmm->Initialize( wchResource , VARIANT_TRUE , VARIANT_TRUE , pwcDrvSetup );
hr = pIviDmm->get_Initialized( &shInit );
}

hr = pIviDmm->QueryInterface( &pDI );
TraceError2( hr , Handle );
hr = pDI->get_GroupCapabilities( &pCroupCpb );
TraceError2( hr , Handle );

if( SUCCEEDED(hr) )
{
ListBoxGroupCap->Items->Clear();
ListBoxGroupCap->Items->CommaText = pCroupCpb;
}

if( pDI )
pDI->Release();

if( pInknown )
{
pInknown->Release();
pInknown = NULL;
}

hr = pIviDmm->get_DriverOperation( &pDriverOp );

if( SUCCEEDED(hr) )
{
hr = pDriverOp->get_IoResourceDescriptor( &pwcRDes );

hr = pRM->Open( pwcRDes , NO_LOCK, 200 , NULL , &pVSession );

if( SUCCEEDED(hr) )
{
hr = pVSession->QueryInterface( IID_IMessage , (void**)&pMess );
long lTimeOut;
pMess->get_Timeout( &lTimeOut );
pMess->set_Timeout( 5000 );

hr = fmioPtr->_set_IO(pMess);
ThrowError( hr );
}
if( pDriverOp )
{
pDriverOp->Release();
pDriverOp = NULL;
}
}

ButtonRead->Enabled = true;
}
}
catch( _com_error e )
{
sprintf( ch_temp1 , "Add HardwareAsset failed.\n");
sprintf( ch_temp2 , "Error description is: %s\n",(char*)e.Description());
MessageBox( Handle , ch_temp1, ch_temp2, MB_ICONERROR|MB_OK );
}

}

//----------------------------------
//Getting the result
//----------------------------------
void __fastcall TForm1::ButtonReadClick(TObject *Sender)
{
HRESULT hr;

double dResult;
BSTR pwchError = NULL;
long lErrCode;

IIviDmmMeasurement *pIviDmmMeas = NULL;
IIviDriverUtility *pIviDU = NULL;

// if( RadioGroupFunction->ItemIndex == )
try
{
try
{
// Set the measure function
// IviDmmFunctionDCVolts,
// IviDmmFunctionACVolts,
// IviDmmFunctionDCCurrent, etc

hr = pIviDmm->set_Function( DmmFuncArr RadioGroupFunction->ItemIndex );
ThrowError( hr );

hr = pIviDmm->get_Measurement( &pIviDmmMeas );
ThrowError( hr );
hr = pIviDmmMeas->Read( EditTimeOut->Text.ToInt() , &dResult );
ThrowError( hr );

hr = pIviDmmMeas->Abort();
ThrowError( hr );

EditResult->Text = dResult;
}
catch(HRESULT &hr2)
{
TraceError( Handle );
}
}
__finally
{
if(pIviDmmMeas)
pIviDmmMeas->Release();
}

}

hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 4, 2012 4:47 PM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
Attachment Example1Cpp.cpp (2.0 KB)
Attachment Example1.zip (3.0 MB)
I've attached the simplest example using the 34410A IVI-COM driver (read a DC voltage). Its built with Visual Studio 2010, and the latest 34410A IVI-COM driver. I've also attached the .cpp file separately, if you don't have VS2010.

Try it out with your driver and see if it works correctly. If IO Monitor is changing the behavior, I'd say it might be a timing issue. You might want to set your Timeout to a higher value.

I couldn't compile your code, so I couldn't see where your problem was. It would be helpful if you shared a simple console example, send me all of the project files to build it and tell me what version of Visual Studio I need to build it it in.
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 4, 2012 11:43 PM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
I've tryed your example, it works. But i would like to get interchangibility so i use IID_IIviDmm end it dont work with 1.0.11.0 version. I use C++Builder so it better i'll try create a simple console application in VisualStudio and check it if don't work i'll send you.

I agree, it seems that problem in timeout, but which? It dont react on timeout in IIviDmmMeasurement::Read( long MaxTimeMilliseconds,
double* retval);
I tryed up to 10000 ms timeout for IIviDmmMeasurement::Read and the instrument even dont try to measure, return value is "9,91E37, but it changes functions.
If i execute programm step by step the instrument make the measuring but the returning result in programm is "9,91E37" though on display of 34410 appear righr result. It seems that IIviDmmMeasurement::Read dont wait DMM.
hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 5, 2012 9:57 AM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
I updated my example to use the IIviDMM interface, and it seems to work ok. One thing I noticed was that in your code you were only setting the Measurement function, you weren't setting things like resolution, or range. So, you could be seeing a problem with the range?

I've attached my latest example. I use the Configure method to set the measurement parameters.
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 5, 2012 11:00 PM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
Thank you for an operative reply.Yes it works with manual ranges, But I supposed that functions in autorange by default, and I need autorange. How to set AutoRange?

HRESULT Configure(
IviDmmFunctionEnum Function,
double Range,
double Resolution
);

Range
The measurement range. Positive values represent the absolute value of the maximum measurement expected. The driver coerces this value to the appropriate range for the instrument. Negative values represent the Auto Range mode.

If the value of the Range parameter is Auto Range On, then the Resolution parameter is ignored.

I try to set the range to negative value,

pIviDmm->Configure( IviDmmFunctionDCVolts, -1, 1);

but occure error 311, "Not able to specify resolution with Auto range". Where's my wrong?

Edited by: gumanist on Apr 5, 2012 11:08 PM

hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 6, 2012 3:54 PM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
This looks like a bug in the 34410A driver. It should know its own limitations and ignore the resolution parameter when using Auto Range (I'll submit a bug).

WORKAROUND:
So, rather than use Configure, use the following:

pIviDmm->Function = IviDmmFunctionEnum::IviDmmFunctionDCVolts;
pIviDmm->Range = -1;
//don't set the resolution when using Auto Ranging
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 8, 2012 9:08 PM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
Ok, so in this case (autorange) the driver return "9.91E37" (however DMM measures) it does not wait DMM, it is bug too?
hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 8, 2012 10:05 PM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
I think that value means "Overload". What signal are you supplying to the DMM?
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 9, 2012 4:16 AM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
for example i measure resistance, the test leads are shorted, autorange is set,

double dResult;
IIviDmmMeasurement *pIviDmmMeas = NULL;
IIviDriverUtility *pIviDU = NULL;
HRESULT hr;

hr = pIviDmm->set_Function(IviDmmFunction2WireRes );
hr = pIviDmm->set_Range(-1);
hr = pIviDmm->get_Measurement( &pIviDmmMeas );
hr = pIviDmmMeas->Read( 1000 , &dResult );

in this case on DMM display appears: "000.205 OHM"
pIviDmmMeas->Read( 1000 , &dResult ); return dResult = 9.91e+37

measuring VDC with shorted leads and autorange:
dmm: 000.009 mVDC
driver: 9.91e+37

measuring ACV line voltage, autorange:
dmm: 0,217.850 VAC
driver: 9.91e+3

if I set range 100V for VDC:

hr = pIviDmm->set_Function( IviDmmFunctionDCVolts );
hr = pIviDmm->Configure( IviDmmFunctionDCVolts, 100, 1);
hr = pIviDmm->get_Measurement( &pIviDmmMeas );
hr = pIviDmmMeas->Read( 1000 , &dResult );

dmm: 0,000.01 VDC
driver: 0.0120981252 it works!

slow functions dont work with range too (VAC, Frec for example), only fast function like VDC or 2WRES have time to return value to the driver. And all this work with old driver.
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 23, 2012 2:26 AM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
Have you read my previous post?
hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 23, 2012 4:36 PM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
Sorry, I missed your last post.

It appears to be a bug in the driver. I can see correct behavior in the old driver and I see broken behavior in the new driver.

The workaround at this point is to use the Agilent-specific interface.

I'll submit this as a defect on the driver, AND update this post when the updated driver has been released.

Edited by: hognala on Apr 23, 2012 4:56 PM
gumanist

Posts: 9
Registered: 04/03/12
Re: agilent34410a IVICom wrong return
Posted: Apr 24, 2012 3:27 AM   in response to: hognala in response to: hognala
Click to report abuse...   Click to reply to this thread Reply
Ok, i'll use the old driver in this case, because i need an interchangeability. And one more question, is there interchangeability for the functions: diod, continuity, capacitance?
hognala

Posts: 199
Registered: 04/09/07
Re: agilent34410a IVICom wrong return
Posted: Apr 24, 2012 8:55 AM   in response to: gumanist in response to: gumanist
Click to report abuse...   Click to reply to this thread Reply
Based on the IviDmm spec at www.ivifoundation.org, I'd say no.

Point your RSS reader here for a feed of the latest messages in all forums