INTRODUCTION I'm reteaching myself C++ after having taken a college class. I recently acquired an Arcus Performax PMX-4EX-SA-TB9 stepper motor controller that has a USB connection which I plan to use. The company provides software to control the stepper manually using their proprietary code and also provides a terminal within their software where you can send single lines of code to the controller to control the stepper. You can control acceleration and top speed and all kinds of stuff. This was fun to play with but now I want to go further. The online manual talks about using C++ to write your own programs for the stepper and I downloaded the files I believe I need. I have a DLL file, a lib file, and a header file. I have thus learned that the DLL file is a Dynamic Link Library which is used during runtime of the executable. I have read through the lib file and the header file and found what I think are some function declarations in the header file that resemble some of the motor commands. I will insert the header file below.
MY QUESTION
Can I use the DLL file along with the lib and header to control this device using what I can see of the functions in the header file? How do I load this all up? Would anyone be willing on writing a short little example using the fnPerformaxComDoMove function included down below? So that I may go from there? I am using Visual Studio C++ 2013 and I've done online tutorials on creating and using a DLL I've made myself but those all seem so simple compared to this one.
MY MEAGER UNDERSTANDING
I believe since I'm being provided with a DLL, header, and lib file, that I will be using the _declspec(dllexport) definition and not the import version. All the function declarations start like "BOOL" then "PERFORMAXCOM_API" then "_stdcall" and I'm only used to seeing a type then a function name then the arguments in parentheses. What does "PERFORMAX_API" and "_stdcall" mean, in front of all the different functions? I understand that DWORD is double word and is a 32bit integer but some of the arguments ask for an axis, like x,y, and z...why would they want a number when they could've just asked for a char? Thank you so much to anyone that can help me with any information. I want so badly to learn how to use this.
HEADER
#ifdef PERFORMAXCOM_EXPORTS
#define PERFORMAXCOM_API __declspec(dllexport)
#else
#define PERFORMAXCOM_API __declspec(dllimport)
#endif
extern PERFORMAXCOM_API int nPerformaxCom;
#ifdef __cplusplus
extern "C" {
#endif
PERFORMAXCOM_API int fnPerformaxCom(void);
//USB reset
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComUSBReset(IN HANDLE pHandle);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComFlush(IN HANDLE pHandle);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComGetNumDevices(OUT LPDWORD lpNumDevices);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComGetProductString(IN DWORD dwNumDevices, OUT LPVOID lpDeviceString, IN DWORD dwOptions);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComOpen(IN DWORD dwDeviceNum, OUT HANDLE* pHandle);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComClose(IN HANDLE pHandle);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetTimeouts(IN DWORD dwReadTimeout, DWORD dwWriteTimeout);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSendRecv(IN HANDLE pHandle, IN LPVOID wBuffer, IN DWORD dwNumBytesToWrite,IN DWORD dwNumBytesToRead,OUT LPVOID rBuffer);
signed int PERFORMAXCOM_API _stdcall fnPerformaxMove(IN HANDLE pHandle,
IN int commandCode,
IN int axes,
IN int moveDir,
IN long *value,
IN int modelCode);
signed int PERFORMAXCOM_API _stdcall fnPerformaxCommandReply(IN HANDLE pHandle,
IN char *command,
IN char *reply);
signed int PERFORMAXCOM_API _stdcall fnPerformaxIO(IN HANDLE pHandle,
IN int commandCode,
IN int bitNumber,
IN long *value,
IN int modelCode);
signed int PERFORMAXCOM_API _stdcall fnPerformaxMotorStat(IN HANDLE pHandle,
IN int commandCode,
IN int axes,
IN long *value,
IN int modelCode);
signed int PERFORMAXCOM_API _stdcall fnPerformaxSpeedAccel(IN HANDLE pHandle,
IN int commandCode,
IN int axes,
IN long *value,
IN int modelCode);
signed int PERFORMAXCOM_API _stdcall fnPerformaxGeneral(IN HANDLE pHandle,
IN int commandCode,
IN int axes,
IN long *value,
IN int modelCode);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetAxisStatus(IN HANDLE pHandle,DWORD dwAxisNumber);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetPulseSpeed(IN HANDLE pHandle,DWORD dwAxisNumber);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetPulsePos(IN HANDLE pHandle,DWORD dwAxisNumber);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetPulsePos(IN HANDLE pHandle,DWORD dwAxisNumber, DWORD pos);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetEncoderPos(IN HANDLE pHandle,DWORD dwAxisNumber);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetEncoderPos(IN HANDLE pHandle,DWORD dwAxisNumber, DWORD pos);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetPolarity(IN HANDLE pHandle,DWORD dwAxisNumber,DWORD dwPolarity);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetPolarity(IN HANDLE pHandle,DWORD dwAxisNumber);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetDIOSetup(IN HANDLE pHandle);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetDIOSetup(IN HANDLE pHandle, DWORD dio_setup);
long PERFORMAXCOM_API _stdcall fnPerformaxComGetDIO(IN HANDLE pHandle);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComGetDIOBit(IN HANDLE pHandle,DWORD bitn);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetDIO(IN HANDLE pHandle,DWORD dio_value );
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComSetDIOBit(IN HANDLE pHandle,DWORD bitn,DWORD bitv );
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComDoHome(IN HANDLE pHandle,
DWORD axis,
DWORD dir,
DWORD low_speed,
DWORD high_speed,
DWORD accel_time,
DWORD decel_time,
DWORD search_mode,
DWORD ramp_mode);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComDoMove(IN HANDLE pHandle,
DWORD axisn,
DWORD target,
DWORD low_speed,
DWORD high_speed,
DWORD accel_time,
DWORD decel_time);
BOOL PERFORMAXCOM_API _stdcall fnPerformaxComStop(IN HANDLE pHandle,
DWORD axisn,
DWORD ramp_stop);
#ifdef __cplusplus
}
#endif