I just got logging via RS-232 working on my 34401A this evening.
While reading through the manual I discovered "talk only" mode, which is by far the easiest way to get started with logging data.
Using the menus, configure the 34401A to use RS-232. Then, configure the 34401A's GPIB address to be 31. This puts the device into "talk only" mode, which allows you to configure and operate the device as you normally would via the front-panel, but it automatically spits out all of the readings to the serial port. This makes it operate similarly to the cheap hand-held DMM's which have a serial data-logging option.
Attached is an example of this working with CuteCom, and I've also attached a simple Python script which will log the values to a CSV file (you'll need to rename the file extension from .txt to .py).
#!/usr/bin/env python
import serial
import sys
import time
ser = serial.Serial(
port = sys.argv[1],
baudrate = 9600,
bytesize=serial.EIGHTBITS,
stopbits = serial.STOPBITS_TWO,
parity = serial.PARITY_NONE,
timeout = 10
)
sys.stdout.write("timestamp,value\n"); sys.stdout.flush()
last_sample_timestamp = time.time()
while True:
line = ser.readline()
now = time.time()
# The FTDI chip seems to buffer up a certain amount of outgoing bytes if
# there is no listener to recieve them. Thus, when we first run this
# script, we will get an initial flood of queued readings. Throw those
# away, because we don't have a timestamp for them.
if now - last_sample_timestamp < 0.1:
continue
last_sample_timestamp = now
microvolts = float(line.rstrip()) * 1000000
sys.stdout.write("%0.3f,%0.1f\n" % (now, microvolts)); sys.stdout.flush()