Igor and LAN port
neogin
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
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.
November 16, 2009 at 08:49 am - Permalink
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
November 16, 2009 at 09:57 am - Permalink
November 16, 2009 at 11:58 am - Permalink
Just a quick example below, look at the help file distributed with the XOP for more info .
variable port = "12345"
variable sockid
make/t buffer
sockitopenconnection sockID, IPstr, port, buffer
sockitsendmsg sockID, "move my motor to 15mm \r\n"
sockitcloseconnection(sockid)
November 16, 2009 at 12:14 pm - Permalink
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.
November 17, 2009 at 02:20 am - Permalink
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.
November 18, 2009 at 01:47 am - Permalink
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
January 20, 2011 at 06:56 am - Permalink
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).
January 20, 2011 at 03:24 pm - Permalink
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
January 21, 2011 at 12:36 am - Permalink