Code: Select all
Dim as string resp 'resp = response
Dim volt as Single
dim J as integer
open com "/dev/ttyUSB0:9600,e,7,2,rs,cd0,cs0,ds0" for input as #1
sleep 300
'print #1, ":SYST:BEEP;:DISP:TEXT 'HELLO WORLD'"
'sleep 200
Print #1, ":SYST:REM"
print #1, "*IDN?"
sleep 100 '***ESSENTIAL DELAY***
for j=1 to 4
Print #1, ":READ?"
sleep 400 '***ESSENTIAL DELAY***
Input #1,resp
Print resp
next
Print #1,":CONF:VOLT:DC 10,.001;:SAMP:COUN 1" 'init meter
For j = 1 to 10
Print #1, ":READ?"
sleep 100 '***ESSENTIAL DELAY***
Input #1,resp
volt = Val(resp)
locate 5+j,1
print using "##.###";volt
locate 5+j,20
print "*" & resp & "*"
next
HEWLETT-PACKARD
34401A
0
4-1-1
3.871 *+3.87080000E+00*
3.870 *+3.86970000E+00*
3.870 *+3.86970000E+00*
3.870 *+3.86970000E+00*
3.870 *+3.86970000E+00*
3.870 *+3.86970000E+00*
3.870 *+3.86970000E+00*
3.869 *+3.86870000E+00*
3.869 *+3.86870000E+00*
3.869 *+3.86870000E+00*
HP Manual
/home/mark/Desktop/2020-01-17-0002.jpg
Addendum:
1) The code that worked with PC-DB-9 to HPmeter-RS-232 has to be altered for PC-USB to HPmeter-RS-232.
2) The key to getting properly working code was altering the Open Com parameters. Specifically, adding "ds0" and eliminating "lf" or line feed.
3) There is still some improvement needed in the code whereby I can send a message to the display and not have it foul the following the code which follows. Some form of clear needs to be sent after the display message - minor problem. Sending to the display is just kinda fun.
4) The "*IDN" parameter will not be used for my FB "equipment" programs. From the HP manual, I expected the return for "*IDN?" to be a single string, but it turns out that each of the meter I.D. parameters it reports are treated separately. Thus my For Next loop for 4 reads of the *IDN? return.
Looks like I do not know how to get a .jpg from Desktop into post?
And Joshy, thanks for clearing my mistake wherein I locked myself out from editing.