Mourad Posted January 21, 2009 Report Share Posted January 21, 2009 Hi, I am new to this forum and I need little help in LV. I installed drivers for HP34401A and I create connection through MAX (I use serial port COM1 as a connection) after that it shows icons in LV functions pallete. My question is how can I read data from the instrument? I tried to Initialize -> Read -> Close but it reads wrong values for example for DC volt it reads 513,123V. Any ideas! //Mourad Quote Link to comment
jcarmody Posted January 21, 2009 Report Share Posted January 21, 2009 QUOTE (Mourad @ Jan 20 2009, 03:17 AM) My question is how can I read data from the instrument? I tried to Initialize -> Read -> Close but it reads wrong values for example for DC volt it reads 513,123V. I think you're missing a step; the example has Initialize -> Configure -> Read -> Close. /Jim Quote Link to comment
Mourad Posted January 21, 2009 Author Report Share Posted January 21, 2009 QUOTE (jcarmody @ Jan 20 2009, 01:06 PM) I think you're missing a step; the example has Initialize -> Configure -> Read -> Close./Jim That is really good but problem is; it gives same wrong readings (523,97 or 33,98 or 679,423....etc), what is confusing me is that there is no error at all just wrong values I think LV does not connect with the HP well or these values are virtual! Quote Link to comment
TobyD Posted January 21, 2009 Report Share Posted January 21, 2009 QUOTE (Mourad @ Jan 20 2009, 07:22 AM) That is really good but problem is; it gives same wrong readings (523,97 or 33,98 or 679,423....etc), what is confusing me is that there is no error at all just wrong values I think LV does not connect with the HP well or these values are virtual! I have used LabVIEW with the HP34401 so I'm sure it works. Can you post your code for us to take a look at? Quote Link to comment
Neville D Posted January 21, 2009 Report Share Posted January 21, 2009 Make sure under Serial settings that the instrument's settings match the ones in your driver.. especially the Baud rate, else you will get back junk data. Neville. Quote Link to comment
Mourad Posted January 22, 2009 Author Report Share Posted January 22, 2009 QUOTE (Neville D @ Jan 20 2009, 07:48 PM) Make sure under Serial settings that the instrument's settings match the ones in your driver.. especially the Baud rate, else you will get back junk data.Neville. I have attached the vi file, thanx in advance. Quote Link to comment
Mark Smith Posted January 22, 2009 Report Share Posted January 22, 2009 QUOTE (Mourad @ Jan 20 2009, 11:58 PM) I have attached the vi file, thanx in advance. The first thing I noticed when I opened your file was that it is pointing to a LLB file in the instrument lib folder for the sub VIs - that means it must be pointing to an older version of the instrument driver - the latest version is a NI plug and play driver. Second I noticed that the resource name is an IVI typed control - this probably means that your version of the driver was converted from an IVI driver (which could be fine) but the first thing I would try is to replace the IVI driver with the LabVIEW plug and play driver. http://sine.ni.com/apps/utf8/niid_web_disp...?p_model_id=978 Third, the default value in the resource name is a GBIP address - are you using serial or GPIB? Next, does the instrument return the correct response string to the *IDN? query in the Initialize? If it does, then you are probably communicating correctly with the instrument - if not, then you first need to figure out how establish communication before you try to make a measurement. Try these things and let us know if it helps. Mark Quote Link to comment
TobyD Posted January 22, 2009 Report Share Posted January 22, 2009 QUOTE (Mourad @ Jan 20 2009, 10:58 PM) I have attached the vi file, thanx in advance. Mark has some excellent points. I just wanted to add that you can also manually send commands in Measurement and Automation Explorer (MAX) using the VISA Test Panel. I've found it to be a useful troubleshooting tool. As Mark suggested, start with the *IDN? command and see if you get valid data back. It should return HEWLETT-PACKARD,34401A,0,XX-XX-XX where XX-XX-XX is the revision number. Also, check the communications setting on the 34401 to make sure the baud rate and parity are set correctly. I think this can only be done from the 34401's menus - not programatically. Quote Link to comment
Mourad Posted January 23, 2009 Author Report Share Posted January 23, 2009 QUOTE (TobyD @ Jan 21 2009, 04:22 PM) Mark has some excellent points. I just wanted to add that you can also manually send commands in Measurement and Automation Explorer (MAX) using the VISA Test Panel. I've found it to be a useful troubleshooting tool. As Mark suggested, start with the *IDN? command and see if you get valid data back. It should return HEWLETT-PACKARD,34401A,0,XX-XX-XX where XX-XX-XX is the revision number.Also, check the communications setting on the 34401 to make sure the baud rate and parity are set correctly. I think this can only be done from the 34401's menus - not programatically. I checked "Find Instument drivers" and nothing under connected inst. but under installed drivers there are two inst. Agilent 34401 and HP 34401. Also under MAX i tried to read from Basic I/O but nothing returns and return status is xBFFF00015 I check serial port setting both under computer and HP and the are all same. Quote Link to comment
Mark Smith Posted January 23, 2009 Report Share Posted January 23, 2009 QUOTE (Mourad @ Jan 22 2009, 02:19 AM) I checked "Find Instument drivers" and nothing under connected inst. but under installed drivers there are two inst. Agilent 34401 and HP 34401. Also under MAX i tried to read from Basic I/O but nothing returns and return status is xBFFF00015I check serial port setting both under computer and HP and the are all same. That error is a VISA timeout, so it means your instrument is not responding (and probably not getting your command string, either). If MAX indicates that your COM port (ASRL1::INSTR as the resource name) is working properly (and that is the one you are using) and you have read the HP34401A manual and you are sure it is configured properly for serial communication then I would next suspect the cable. From the Agilent 34401A Manual "Connection to a Computer or Terminal To connect the multimeter to a computer or terminal, you must have the proper interface cable. Most computers and terminals are DTE (Data Terminal Equipment) devices. Since the multimeter is also a DTE device, you must use a DTE-to-DTE interface cable. These cables are also called null-modem, modem-eliminator, or crossover cables. The interface cable must also have the proper connector on each end " Mark Quote Link to comment
Mourad Posted January 23, 2009 Author Report Share Posted January 23, 2009 QUOTE (mesmith @ Jan 22 2009, 02:50 PM) That error is a VISA timeout, so it means your instrument is not responding (and probably not getting your command string, either). If MAX indicates that your COM port (ASRL1::INSTR as the resource name) is working properly (and that is the one you are using) and you have read the HP34401A manual and you are sure it is configured properly for serial communication then I would next suspect the cable.From the Agilent 34401A Manual "Connection to a Computer or Terminal To connect the multimeter to a computer or terminal, you must have the proper interface cable. Most computers and terminals are DTE (Data Terminal Equipment) devices. Since the multimeter is also a DTE device, you must use a DTE-to-DTE interface cable. These cables are also called null-modem, modem-eliminator, or crossover cables. The interface cable must also have the proper connector on each end " Mark ThanX Mark I got somehow connected when I changed the cable but now when I tried to scan for Connected Instuments it gives me a peeb and Error No. 511 (framing error). I tried to have same configuration as in the manual (9600, 7, Even, 1, Hardware) both sides but same error. Any Idea? Now I got error no. 513 (parity error). Quote Link to comment
Mark Smith Posted January 24, 2009 Report Share Posted January 24, 2009 QUOTE (Mourad @ Jan 22 2009, 08:36 AM) ThanX Mark I got somehow connected when I changed the cable but now when I tried to scan for Connected Instuments it gives me a peeb and Error No. 511 (framing error). I tried to have same configuration as in the manual (9600, 7, Even, 1, Hardware) both sides but same error.Any Idea? Now I got error no. 513 (parity error). These errors sound like communication errors caused by misconfigured serial port settings - if the start and stop bits aren't correct the data frame will be wrong. If you're not using the latest driver from NI (the plug and play one) I would get it because it seems to have the most complete and automated handling of all the possible serial port settings for the host. For instance, it tries to handle whether or not flow control is supported automatically. Also, your cable may still be incorrect - have you tested pin-to-pin to make sure it matches the diagrams in the user manual? Mark Quote Link to comment
Mourad Posted January 27, 2009 Author Report Share Posted January 27, 2009 QUOTE (mesmith @ Jan 23 2009, 04:56 PM) These errors sound like communication errors caused by misconfigured serial port settings - if the start and stop bits aren't correct the data frame will be wrong. If you're not using the latest driver from NI (the plug and play one) I would get it because it seems to have the most complete and automated handling of all the possible serial port settings for the host. For instance, it tries to handle whether or not flow control is supported automatically. Also, your cable may still be incorrect - have you tested pin-to-pin to make sure it matches the diagrams in the user manual?Mark You are right about the cable, I checked it and it was not totally crossover one. So I did new one and now it works fine. Many thanks :thumbup: . Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.