Communication between the PC and Commander core is done using the Windows-compatible DLL API function calls shown below. Windows programming languages that use a DLL, such as Visual BASIC, Visual C++, Java, Python, LabVIEW, etc. can be used to communicate with the CMD-4EX-SA motion core.

Typical communication transaction time for sending a command from the PC and getting a reply from the controller using the SendReceiveCommanderHID API function is in single-digit milliseconds. This value will vary with the CPU speed and type of command requested.  The Nippon Pulse terminal program can be used to measure this exact time for your system. 

The DLL file CMDHidApi.dll (32bit) or  CMDHidApi64.dll (64 bit) is needed to access these API functions. These DLL files are not included with this product; please download them from our website.

For HID communication, the following DLL API functions are provided:


VC Function name

VB Function name

Description

GetCommanderHIDnumber()

GetCommanderHIDnumber Lib "CMDHidApi" () As Integer

Return the number of Commander core devices connected to the host

GetCommanderHIDName(int index, char* name)

GetCommanderHIDName Lib "CMDHidApi" (ByVal HidIndex As Integer, ByVal HidName As String) As Integer

Obtain the device name string of a device connected to host

GetCommanderHIDversion(int * mainVer_i, int * minVer_i, int * build_i) 


GetCommanderHIDversion Lib "CMDHidApi" (ByVal HidmainVer_i As Integer, ByVal HidminVer_i As Integer, ByVal Hidbuild_i As Integer,) As Integer

Returns the version information for the DLL

OpenCommanderHID(HANDLE* pHandle, char* name)

OpenCommanderHID Lib "CMDHidApi" (ByRef HidHandle As IntPtr, ByVal HidName As String) As Integer

Obtain the HANDLE to operate a device

CloseCommanderHID(HANDLE pHandle)

CloseCommanderHID Lib "CMDHidApi" (ByVal HidHandle As IntPtr) As Integer

Close the specified HANDLE

SendReceiveCommanderHID(HANDLE pHandle, char* command, char* reply);

SendReceiveCommanderHID Lib "CMDHidApi" (ByVal HidHandle As IntPtr, ByVal command_Renamed As String, ByVal reply As String) As Integer

Communication between the host and the device


How to use

  1. Obtain the number of Commander core HID devices connected to the PC with GetCommanderHIDnumber.
  2. Get the device name string of the number (index) specified by GetCommanderHIDName.
  3. Get the HANDLE to manipulate the Commander core with the device name string specified by OpenCommanderHID.
  4. Communicate with the Commander core using SendReceiveCommanderHID by specifying the acquired HANDLE.
  5. After sending the command string, the reply string will return.
    1. For the command definition and the returned serial number string, refer to the Command Reference.
  6. Close the HANDLE with CloseCommanderHID when finished with all operations.

<  Topic Home | Home |  Next Section | First SubSection >


This section is broken into the following subsections;


<  Topic Home | Home |  Next Section | First SubSection >