LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

HP34401A Help ?

Hi

 

I am currentlytrying to communicate with the HP34401A Multimeter.

I cant seem to talk with the device with out any errors.

I have downloaded the HP34401 instrument on the NI website and have got the connection going.

 

 

hp34401_init (Description, VI_FALSE, VI_FALSE,&viSession); if (viSession==VI_NULL) { ErrorCheck(Status); } else { hp34401_reset (viSession); hp34401_func (viSession,hp34401_FUNC_VOLT_DC); hp34401_voltDcNplc (viSession, hp34401_NPLC_100_0); hp34401_autoZero (viSession, VI_TRUE); }

 

 

 

Can someone please help me out by showing how to start communication, any source code will be very helpful ?

 

Thanks.

Help share your knowlegde
0 Kudos
Message 1 of 21
(5,976 Views)

Hi Shako,

 

What is the interface you are using to connect to the instrument (gpib, ethernet, serial, etc...) ?

 

Which instrument did you download, can you provide the link?

 

What is the value of "Description" ? Can you send a more complete code?

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 21
(5,965 Views)

Here you go.

I am connecting via the serial.

I have attached the instrument that i am using.

 

This is the code i use to connect to the device

 

ViSession viSession;

ViStatus Status;

 

void ErrorCheck(ViStatus Status)

{

  ViChar ErrorMessage[600];

 

if (Status!=VI_SUCCESS)

{

hp34401_error_message (viSession, Status, ErrorMessage);

}

}

void ConnectAndConfigDevice(void)

{

hp34401_init ("ASRL2:INSTR", VI_FALSE, VI_FALSE,&viSession);
if (viSession==VI_NULL)
{
ErrorCheck(Status);
}
else
{
hp34401_reset (viSession);
hp34401_func (viSession,hp34401_FUNC_VOLT_DC);
hp34401_voltDcNplc (viSession, hp34401_NPLC_100_0);
hp34401_autoZero (viSession, VI_TRUE);
}

}

This is what i got so far for the reading

 

ViInt64 Value[100];
ViInt32 NumOfReadings;
ViStatus Status;

void ReadValue(void)
{
hp34401_read_Q (viSession,Value,&NumOfReadings);
if (NumOfReadings>0)
{
ErrorCheck(Status);
SetCtrlVal (panelHandle, PANEL_NUMERIC,Value[0]);
}
}

 

 

 

 Could you please show me how to setup the device and retrieve values from it with out any errors ?

 

 

 

Message Edited by Shako on 02-19-2010 08:25 AM
Help share your knowlegde
0 Kudos
Message 3 of 21
(5,948 Views)

Shako,

 

You told that you were not able to make a measurement. Where is the problem exactly?

Do you get an unexpected error from one of the functions (if yes what are the error codes/messages), or the reading result is not what you expected? 

 

Here is what I see from the code that can be corrected: 

 

1- The descriptor should be "ASRL2::INSTR"

2- I recommend setting the 2nd and 3rd parameters of hp34401_init to VI_TRUE

3- You do not set the value of Status during initialization, but you use it to retrieve error information, maybe you should say:

Status = hp34401_init (...)

 

 

4- Is your probes connected to the point you want to measure during hp34401_autoZero? If yes, are you sure that is your intention?

You will measure almost 0 (zero) from that point and you get a 'shifted' reading from other points until you reset the device. You probably should auto-zero when your probes are floating, or better shorted to each other.

 

S. Eren BALCI
IMESTEK
0 Kudos
Message 4 of 21
(5,943 Views)

Btw, don't you have the user manual of the instrument?

 

I'm remember that there are simple examples in the manual in different languages.

Could you please check?

S. Eren BALCI
IMESTEK
0 Kudos
Message 5 of 21
(5,942 Views)

If i set either to VI_TRUE "hp34401_init (Description, VI_TRUE, VI_TRUE,&viSession);"

I get an error message "unexpected error"from the pc and from the device 511 error - Rs-232 framing error.

 

The main problem is that when i read the values the device beeps indicating an error "550 - Command not allowed in local".

No error message form the pc.

I receive the values but the error is still there.

 

But i also get the following :

NON-FATAL RUN-TIME ERROR:   "hp34401.c", line 11344, col 20, thread id 0x000016CC:   Function viScanf: (return value == -1073807339 [0xbfff0015]). Timeout expired

before operation completed.

This is from the read command.

 

The Auto zero was supposed to be commented out. My mistake.

Help share your knowlegde
0 Kudos
Message 6 of 21
(5,938 Views)

I did check the example but they all use triggers which i dont want and the hp34401_init() give the same errors.

as well as the read command.

Help share your knowlegde
0 Kudos
Message 7 of 21
(5,939 Views)

Hi, I'm not familiar with serial communications in Visa so I don't know where and how exactly the serial port is opened, but the framing error should indicate some incorrect parameter is used between data and stop bit parameters. You should search in instrument documentation which parameters to use and check with system settings.

 

To bypass the "Command not allowed in local" error you may need to turn on remote communications mode either with a hard key on the instrument or with a software command, possibly hp34401_systRemote ().



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 21
(5,924 Views)

Ok i have tried that already to not luck.

And i Created the hp34401_systRemote () in that instrument driver.

 

I have tried to send the Remote command before i send the read command but is still gave me the same error.

 

If you know anyone who knows about serial communications,please tell them about this forum.

 

Thanks for your help.

Help share your knowlegde
0 Kudos
Message 9 of 21
(5,917 Views)

Hi Shako,

 

I am using a large variety of serial instruments...

In my experience, the major obstacle usually is to set all the communication parameters correctly, i.e. open the port, set the baud rate, number of data bits, stop bits, parity and flow control.

 

Second comment: a good assistant is the Measurement Explorer. You can use it to comunicate with the instrument using a given port, sending commands as you would do programmatically. This speeds thing up a lot. Once you've got an answer from the instrument, you can go back to CVI.

 

Hope this helps,

 

Wolfgang

0 Kudos
Message 10 of 21
(5,914 Views)