Igor and LAN port

Hi guys !



So here is my issue, I have an XPS motion controller from newport and 3 moving stages, thoses stages are controlled by the XPS and the XPS is controlled exclusively via the ethernet port. The manual says that I can used TCL script to command the stages.



So my question is the following : do you know how to send information via the ethernet port with IGOR without using XOP VISA because the XPS does not understand it.



Thanks

I found the web page for the device that I think you are using, at http://www.newport.com/store/genproduct.aspx?id=300904&lang=1033&Sectio….

It looks like you might have two options.

The first would be to write your own Igor XOP to control the device. They mention that they can provide interfaces for Matlab and LabView, but they also say they provide instructions for writing your own application, but in Visual Basic. The Igor XOP toolkit only supports C/C++ code, so I'm not sure that it would even be possible to write an XOP to control the device unless Newport could provide C/C++ libraries.

The second option would be to try using Andrew Nelson's SOCKIT XOP, which may be all you need to connect to the device. Andy is pretty active on IgorExchange, so if you have problems with his XOP he may be able to help you out.
aclight wrote:
... It looks like you might have two options ...


Mumbling mostly to myself, I also wonder whether, on the Mac, a third option might be to use TCL scripting run via AppleScript excuted via ExecuteScriptText from Igor Pro -- likely of course only as a last resort should the SOCKIT XOP option prove to be not viable and should you happen to be using Mac OS rather than Windows.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
I got the impression from the web page that the TCL script was run from the device itself, not the user's computer. So I think you'd need to get the script to the server first, and then have some way to execute it, both of which it seems would require SOCKIT or something similar.
I'm pretty sure that SOCKIT will be able to do the job. It does synchronous and asynchronous communication via TCP/IP. It is relatively simple to setup and learn about, but if you want a hand just ask.

Just a quick example below, look at the help file distributed with the XOP for more info .

string IPstr = "127.0.0.1"
variable port = "12345"
variable sockid
make/t buffer
sockitopenconnection sockID, IPstr, port, buffer
sockitsendmsg sockID, "move my motor to 15mm \r\n"
sockitcloseconnection(sockid)



Thanks for your help,

It seems that SOCKIT seems to be the solution, I will try it and later post here if it works.

You're right the TCL is executed on the motion controller and the script must be in the machine HD, the ethernet command just indicates which script to use ( at least that's how Labview handles it ).

Once again thanks for your help guys.
Hi !

So it works like a charm, thank you all.

Now I have another issue but I posted another forum topic ( how to create an XOP from a DLL )

Cheers Mate.

Hi,
I have some issue using SOCKIT with Igor Pro to control an XPS from Newport. The connection/disconnecting works quiet well even functions that doesn't have any arguments but for others I don't know how to send it, especially those which return string. For instance :
- In C/C++ : I use the following functions :
* GetErrorCode(int SocketID, int ErrorCode, string *ReturnedString)
- With Sockit I write it like :
* SockitSendnRecv/TIME=2.0/SMAL SocketNumber,Message,returnedAnswer
with string message = "ErrorStringGet(2,-10,???)"
message is a string which has to contain another string returned by the function we call. I think this induces an error because i use a bad declaration. Should it be a wave, or a pointer, or a local string, i don't know, and i don't even know if this attribute is used because an other answer is returned from SockitSendnRecv...

I'm a little bit lost, so if someone has already solved this problem once it would be a pleasure.

Thanks for your help
VALLEAU wrote:
Hi,
I have some issue using SOCKIT with Igor Pro to control an XPS from Newport. The connection/disconnecting works quiet well even functions that doesn't have any arguments but for others I don't know how to send it, especially those which return string. For instance :
- In C/C++ : I use the following functions :
* GetErrorCode(int SocketID, int ErrorCode, string *ReturnedString)
- With Sockit I write it like :
* SockitSendnRecv/TIME=2.0/SMAL SocketNumber,Message,returnedAnswer
with string message = "ErrorStringGet(2,-10,???)"
message is a string which has to contain another string returned by the function we call. I think this induces an error because i use a bad declaration. Should it be a wave, or a pointer, or a local string, i don't know, and i don't even know if this attribute is used because an other answer is returned from SockitSendnRecv...


As you are probably aware SOCKIT only sends and receives binary data (which could be ascii) to a TCP server. In the Sockitsendnrecv operation you mentioned returnedAnswer is optional, but if specified it should be a string that already exists (it can be local or global). When the reply is received from the server the message is placed into the returnedAnswer string. In IGOR strings can also hold binary data (I just consider them to be byte arrays). If you do not specify the optional parameter the reply is placed into the string variable S_tcp. As you mentioned the Message parameter is a string that contains the data you want to send to the server.
Hopefully this answers your question. All the Sockit is designed to do is send and receive messages from a TCP server. Because it was written to be extremely general one has to have a knowledge of the protocol used for communication (e.g. HTTP, FTP, XPS communication, etc).
Thanks for your answer andyfaff,
In fact when I send a command via SOCKIT to the XPS, it answers that there is an error on one of the attribute. So SOCKIT works with XPS because an error code is returned. I think that the problem is only in the message we send. The XPS doesn't seems to recognize the declaration of a pointer as an attribute or Igor doesn't send the string that the controller expects. But I've read in another topic that you knew someone which can successfully control XPS using SOCKIT. Could you send me an email to discuss with him?
Thanks