Connecting WJ-S4 and S8 Motor Controllers

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

My code. (1.88 KB) It has the API, but couldn't figure out how to use it. (12.32 KB) user manual for WJ-S4 controller.pdf (168.64 KB) Excuse me putting the Chinese version but for this model I couldn't find a comprehensive source. (1.12 MB)

I'm puzzled by this statement in the "user manual for WJ-S4 controller.pdf" ("the manual" for short):

From figure 2, one can see that the controller use a serial port or USB port to communicate with the PC. The OS on the PC can be Windows or Linux. If one chooses the serial port, the driver program should be installed before using the controller. Typical USB to serial port driver is ch340 or PL2303.

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:

Function Test()
    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.