Connecting WJ-S4 and S8 Motor Controllers
ejkeskinoglu
Dear All,
I am trying to connect the WJ-S4 and WJ-S8 motor controllers to Igor Pro. I have written the code, which is attached, but I have been unable to get the motor running. To troubleshoot, I attempted to communicate with the motor controller using functions such as QueryAxisParam()
, but this was also unsuccessful and is giving me an overtime error.
Could you please help me understand what might be going wrong with my code?
Thank you in advance!
Sincerely,
E. J. Keskinoglu
I'm puzzled by this statement in the "user manual for WJ-S4 controller.pdf" ("the manual" for short):
I don't understand why you need to install a driver program to use the serial port. I think most PC's come with a serial driver installed.
Possibly, by "if one chooses the serial port", it really means "if you use the serial protocol over USB". In that case, you would need a serial-to-USB driver. Such drivers usually come with USB-to-Serial adapters. For a discussion of such adapters, execute:
DisplayHelpTopic "VDT2 Hardware Issues"
I don't see anything in the manual about the cable needed to use the serial port or the serial communication parameters (e.g., baud rate, stop bits, parity). You would need to know these parameters and use the VDT2 command to set the serial port parameters on the PC accordingly. However, if the manual really means "if you use the serial protocol over USB", then you just need a USB cable and possibly the serial communication parameters don't matter.
Assuming those issues were solved, I would create the simplest possible Igor function to test the ability to communicate with the device. For example:
VDT2 KillIO // Start from a clean state
VDTOperationsPort2 COM2
VDT2 baud=9600,databits=7,stopbits=2,parity=0 // These are a guess
String cmd = "M01 3200 3200 3200 3200" // Make motor move
String terminator = "\r\n" // Assume device wants CRLF
VDTWrite2 cmd+terminator
End
Until you can get that to work, there is no point in trying anything else.
August 1, 2024 at 10:02 am - Permalink