For a school project, my group and i are thinking of buying K8097 (velleman.eu/products/view/?id=386156) to control 3 stepper motors. A reason for our choice was the inclusion of a dll file. But, as the head programmer, i wonder if the dll works with C++. I have downloaded the file, and it tells me that it needs Visual .NET. So, if any of you have any experience with it, can you tell me if the dll works with C++ code and with Visual C++ compiler?
During install you will be asked what components you want to install. There is the native DLL file ‘mtrapi32.dll’ that you can use in C/C++. And then there is the .NET assembly file ‘MotorLibNET.dll’ that is a wrapper around the native DLL.
These are the declarations in borland pascal:
procedure SMCDisconnect; stdcall;
function SMCConnect(Port: PChar; Motors: DWORD): BOOL; stdcall;
function SMCGetMotorCount: DWORD; stdcall;
function SMCGetInputCount: DWORD; stdcall;
function SMCGetOutputCount: DWORD; stdcall;
function SMCConnected: BOOL; stdcall;
procedure SMCSetDemo(Enabled: BOOL); stdcall;
procedure SMCMove(Motor, Steps: DWORD; Direction: DWORD; Speed: DWORD); stdcall;
procedure SMCStop(Motor: DWORD); stdcall;
function SMCGetMoving(Motor: DWORD): BOOL; stdcall;
function SMCGetDirection(Motor: DWORD): DWORD; stdcall;
procedure SMCSetTorque(Motor: DWORD; Enabled: BOOL); stdcall;
function SMCGetTorque(Motor: DWORD): BOOL; stdcall;
function SMCGetInput(Input: DWORD): BOOL; stdcall;
procedure SMCSetOutput(Active: BOOL); stdcall;
function SMCGetOutput: BOOL; stdcall;
They should be easy to understand and convert to C. If you need a lib file, you can generate one from the DLL using the tools available in Visual Studio.
but that doesn’t work. Even when I wait a certain time with a Sleep() funkction to check the motor status the GetMoving() function returns 0 despite the motor running.
The same thing goes with the GetTorque() function - it always returns 0.
On the contrary, the function GetInputCount() returns the proper value of 6.