Hello,
The scope is connected by ethernet in a local managed network but i have tried a direct connection using a crossover ethernet cable and it still froze. (I havnt tried serial because the whole point is to not use libraries.)
I mainly code and run the script on a windows computer but we do use Ubuntu to run the code overnight and it still hangs on those computers. (Havnt tried Mac but would expect the same results.)
Im interested too if its my code or something wrong with the scope (At this point i think both, but leaning more towards it being a problem with the scope because im missing something in my code they dont have listed.)
I have used their basic python code as a test and just replaced it with the waveform command instead of *IDN? and it still hangs. (
https://siglentna.com/application-note/open-socket-lan-python/). This code collects the waveform of the first channel 100 times.
#!/usr/bin/env python
#-*- coding:utf-8 โ*-
#-----------------------------------------------------------------------------
# The short script is a example that open a socket, sends a query,
# print the return message and closes the socket.
#
#No warranties expressed or implied
#
#SIGLENT/JAC 05.2018
#
#-----------------------------------------------------------------------------
import socket # for sockets
import sys # for exit
import time # for sleep
#-----------------------------------------------------------------------------
remote_ip = "192.168.55.121" # should match the instrumentโs IP address
port = 5025 # the port number of the instrument service
#Port 5024 is valid for the following:
#SIGLENT SDS1202X-E, SDG2X Series, SDG6X Series
#SDM3055, SDM3045X, and SDM3065X
#
#Port 5025 is valid for the following:
#SIGLENT SVA1000X series, SSA3000X Series, and SPD3303X/XE
count = 0
def SocketConnect():
try:
#create an AF_INET, STREAM socket (TCP)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error:
print ('Failed to create socket.')
sys.exit();
try:
#Connect to remote server
s.connect((remote_ip , port))
except socket.error:
print ('failed to connect to ip ' + remote_ip)
return s
def SocketQuery(Sock, cmd):
try :
#Send cmd string
Sock.sendall(cmd)
Sock.sendall(b'\n')
time.sleep(1)
except socket.error:
#Send failed
print ('Send failed')
sys.exit()
reply = Sock.recv(4096)
return reply
def SocketClose(Sock):
#close the socket
Sock.close()
time.sleep(1)
def main():
global remote_ip
global port
global count
# Body: send the SCPI commands C1:WF? DAT? 100 times and print the return message
s = SocketConnect()
for i in range(100):
qStr = SocketQuery(s, b'C1:WF? DAT2')
time.sleep(0.5)
print (str(count) + ":: " + str(qStr))
count = count + 1
SocketClose(s)
print('Query complete. Exiting program')
sys.exit
if __name__ == '__main__':
proc = main()
If you know Julia i can also send a Pluto notebook but i think python is much more universal.