It looks like the port is connected however the tcp_write fails:
ret = tcp_write(dmm,’*IDN?’)
error: Invalid call to tcp_write. Correct usage is:
– Loadable Function: N = tcp_write (TCP, DATA)
Additional help for built-in functions and operators is
available in the online version of the manual. Use the command
'doc ’ to search the manual index.
I am guessing that I don’t have the correct port identified for the TCP Client and I copied port ‘80’ from the online examples. How can I verify that port connection? Any other reasons that the connection fails?
Note: I can access the DMM webpage using the IP address so I know the IP address is correct and the hardware is functioning.
Looking at the source repository, I see that tcp_write expects a tcp object not a tcpclient object as first argument, hence the invalid call error. So you should either build a tcp object to use with tcp_write, or use tcpclient_write.
Im guessing that port 80 is using the web interface to the device.
Try connecting using a webbrowser to http://169.254.4.10
if that shows a webpage, then you are trying to send non HTTP commands to a webserver.
There will likely be another port that allows communication the command set you are trying to use - port 5025 ?
You maybe also need to send the ‘\n’ as part of the command.
The original port setting of 80 was indeed incorrect. After doing some digging I was able to confirm that the suggested port setting of 5025 will work with the Agilent instruments that I am trying to program. I was able to successfully establish a connection.
Admittedly, through my debugging I found that I cannot use Ethernet. Some of the PCs that need to support the script do not have Ethernet port. I will need to migrate to USB and it appears that the USBTMC is not supported with Windows.
Nonetheless, I appreciate everyone’s help to get me to this point!