I am using a motor connected to a serial port (RS-232). I need to use it as part of an automation set-up in a lab. The motor was part of a larger set-up which can be purchased, and it is the only part of the set-up that I am using. The set-up came with a piece of GUI software used for analysis, I can use this application to move the motor manually. There are no serial commands listed in the documentation and the only programmatic method to control the apparatus that the documentation mentions forces you call QT and seems more complex than needed considering the only function I need is movement of this stage. Does anyone know of a way to either find the serial commands, or hack the set-up in order to complete this simple task? It seems to me that if it is connected via serial port they must have internal serial commands used to control when writing their original software.
Details: The motor is a part of this set-up from Thorlabs. The beam profiler that comes with this set-up is not being used in favor of a nicer one which is mounted on the motor stage. E开发者_如何学运维ssentially making this a step motor which moves in one dimension. If it makes any difference I am probably going to use C# on this project (because another apparatus forces me to use .net)
Use another serial port for monitoring. Connect the RX pin on this monitor port to the TX pin on the motor-control port. Connect a terminal app to the monitor port. Move the motor with the GUI. See what is being sent.
Rather than pulling apart the serial cable, is it possible that something like PORTMON would help. That is if you are working with a Windows application. This should show the SERIAL commands going back and forth and perhaps give you some insight in to how they are controlling the motor.
I'm assuming that in a lab using this sort of equipment you have access to an oscilloscope and someone that knows how to use it.
I can think of two ways that they could be controlling the motor:
Serial commands (as you mention). First you'll need to know the speed (baud), number of stop bits, and the parity of the serial port. Hook up the 'scope to the Tx line on the serial port to work these out - then "sniff" the data from their app using another computer running some serial terminal software (like HyperTerminal on Windows)
They are just flipping lines - for example, momentarily raising DTR to step forward, and flipping RTS to step backward. Once again, a 'scope should help you see this.
EDIT
If running under Windows, see Tim K's answer instead.
精彩评论