General > General Technical Chat
How to retrieve data back from HP-4140b using AR488 & python
(1/1)
RichardM:
Hi all

I have spent some time trolling the forum but cannot seem to find the answer I am after :)

I am just playing with remote controlling an HP-4140b Pico meter and Voltage Source unit. I have a AR488 GPIB controller and it works pretty well using Test Controller but I though I would try my hand at Python. The code below starts a sweep on the HP-4140B but I am unsure how to retrieve readings from the device without the use of HPBASIC "ENTER" command. The variable datain contains nothing from a serial read. If I set the AR488 to ++auto 1 I do get something back b' LC+000.0E-12,A+010.0\r\n' but I was hoping to be able to query the device instead. Any thoughts much appreciated as always.

import argparse
import serial,os
import time
import sys


port = "COM7"
baud = 115200

#Serial port configuration
com = serial.Serial(port, baud, timeout=1)

if com.isOpen():
    print(com.name + ' is open...')

#Print output
while True:
    cmd = input("Enter to run or 'exit':")
    if cmd == 'exit':
        com.close()
        exit()
    else:
            com.write(b'++addr 19\r\n')
#            com.write(b'++auto 1\r\n')
            time.sleep(1)
            com.write(b'F3RA1I2A1B1L2M3\r\n')
            com.write(b'PS-11.0;PT11.0,PE1.0NPH1;PV1,PB-5\r\n')
            com.write(b'W1\r\n')
            time.sleep(1)
            datain=com.readline()
            print(datain)
Navigation
Message Index
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod