I have old Hewlet Packard 33120A function generator (it should be the same type as Agilent 33120A) and I would like to control it with MCU (ATMega). The generator has RS232 and use SCPI commands.
I made simple RS232 to TTL converter with MAX232, just with RX and TX lines. According to User's guide (chapter 4, section DTR/DSR Handshake Protocol) I tied the DSR to logic TRUE (negative voltage) and DTR is not connected. This configuration should disabled hardware handshake.
Now, I can connect converter to MCU or to computer. For my first experiment I used computer and this Python script:
import serial, sys, time if __name__ == '__main__': if len(sys.argv) < 2: print 'Usage: %s <serial_port>' % sys.argv sys.exit(1) s = serial.Serial(port=sys.argv, baudrate=2400, bytesize=8, parity='N', stopbits=2, timeout=None, xonxoff=0, rtscts=0) time.sleep(0.5) s.write('\n*CLS\n') time.sleep(0.5) s.write('SYST:REM\n') time.sleep(0.5) s.write('APPL:SIN 30E+3, 0.1\n') s.close()
This works without any problem. The generator set its output to 30kHz as expected. The problem is, when I try to read some response from generator. For example, this should return device name:
s.write('*IDN?\n') print s.realine()
I am pretty sure the response is stored in generator's output buffer but no data are actually transmitted.
Is there any command to trigger transmitting data from buffer? Or do I need enable hardware handshake?
Is there anyone who has this generator? Do you use it with RS232 and SCPI?