The code used for following discussion is,
Code: Select all
Dim resp as string *35 'resp = response
Dim volt as Single
dim J as integer
open com "/dev/ttyUSB0:9600,e,7,2,rs,cd,ds,lf,pe" as #1
Print #1, ":SYST:REM" 'initialize HP meter
sleep 500 'sleep essential
'print #1, ":SYST:BEEP;:DISP:TEXT 'HELLO WORLD'" 'causes interference with IDN reporting
'sleep 200
print #1, "*IDN?" 'gens error -101, invalid char in cmd string
sleep 200
input #1, resp
sleep 200
print "*IDN? returned: ", resp
sleep 200
Print #1,":CONF:VOLT:DC 10,.001;:SAMP:COUN 1" 'initialize HP meter
sleep 200 'delay is essential this ln
For j = 1 to 15
Print #1, ":READ?" 'generates error -101
Input #1,resp
sleep 500
volt = Val(resp)
locate 3+j,1
print using "##.###";volt
locate 3+j,20
print "*" & resp & "*"
next
I have isolated in the code lines where the problem (or at least a problem is taking place). The meter displays error code -101 when "*IDN?" (query for meter identification) is sent to the meter. The manual says this error is "An invalid character was found in the command string. You may have inserted a character such as #, $, or % in the command header or within a parameter." The HP manual says to use "*IDN?" and "READ?". The return for the *IDN command is "meter name, model, 0, firmware revisions". It should read in one line: "HEWLETT-PACKARD,34401A,0,04-01-01". After remming out the *IDN? command, the "Read?" command will also throw the same error.
Information and data is returned by these two commands, but lines may be: 1) correct, 2) incorrect, or 3) missing, as seen below. Note that some of the IDN data flows into the FOR NEXT loop, which it should not, but the total lines displayed remains at 15.
Code: Select all
*IDN? returned: HEWLETT-PACKARD
%34401.000 *34401A*
0.000 *0*
4.000 *4-1-1*
0.000 **
3.868 *+3.86773020E+00*
0.000 **
3.867 *+3.867+3.86777600E+00*
0.000 **
3.868 *+3.86779890E+00*
0.000 **
3.868 *+3.86779890E+00*
0.000 **
0.000 **
0.000 **
0.000 **
------------------
(program exited with code: 0)
The manual also states that the string variable must contain at least 35 characters. Not sure of syntax, but added "*35" to the resp string variable.
So, at this point, I believe the problem is the sends to the meter. Please note that with the same code there are no problems with the PC talking to the meter via DB-9 to DB-9 connections.
From what I have described are there some more ideas as to what might work?