ask for library C# use on class 5 motor
The SMIEngine library gets installed with the SMI2 software. The DLL file is IntegMotorInterface.dll and will be installed in your C:Windows subdirectories.
There will be a subdirectory of sample code for some compilers in the C:Program Files (x86)AnimaticsSMIEngine directory. The SMIEngine.chm file explains the DLL.
Do you have simple sample of communication C# interface with Animatics motor?
Do you have simple sample of communication C# interface with Animatics motor?
I'm sorry... but I do not have a C# example.
from animatics VBIO.vb example,
"ErrorHandler:
If Err.Number = &H80004005 Then
UIStatus.SelectedText = "Error:" & Err.Description & Chr(13) & Chr(10)
Else
UIStatus.SelectedText = "Error:" & ErrorToString(Err.Number) & Chr(13) & Chr(10)
End If
End Sub"
may i ask that where get from the value "&H80004005"?
Err.number can refer from any user manual?
Hi,
From Animatics VBIO.vb example,
"ErrorHandler:
If Err.Number = &H80004005 Then
UIStatus.SelectedText = "Error:" & Err.Description & Chr(13) & Chr(10)
Else
UIStatus.SelectedText = "Error:" & ErrorToString(Err.Number) & Chr(13) & Chr(10)
End If
End Sub"
may i ask that where get the value of "&H80004005"?
Err.number can refer from any user manual?
The .chm file in the SMIEngine folder is the best reference. I don't recognize your error. It may have something to do with what Country Code you have selected in Windows. You may want to try setting it to USA to see if you have the same result.
I have a C# example that I did a few weeks ago. I'm not much of a coder, so go easy on me.
Add this to your directives at the top of your .cs file...
using INTEGMOTORINTERFACELib;
Declare these class variables...
Exception COMEx = new System.Runtime.InteropServices.COMException();
public bool CommsConnected;
public int NumMotors;
public int MaxAddress = 3;
public int Flags = 1;
public int RS232Address;
string thePort = "Com4";
SMIHost host = new SMIHost();
Here is the method I wrote to connect a motor to my program...
private void SetComms()
{
try
{
RS232Address = host.DetectRS232(MaxAddress, Flags);
host.OpenPort(thePort);
NumMotors = host.AddressMotorChain();
}
catch (Exception COMEx)
{
string errstring = COMEx.HResult.ToString();
MessageBox.Show("There is a COM issue with the motor.n" + errstring, "Comms Error Message");
return;
}
int numMotorsDetected = host.NoOfMotors;
if (NumMotors == numMotorsDetected && NumMotors>=1)
{
MessageBox.Show("Comms Enabled. There are/is " + Convert.ToString(NumMotors) + " motors on " + thePort + ".","Motor Comm Status");
CommsConnected = true;
}
}
What was the result? Which MessageBox?
If the motor is powered and connected to the com port specified you will get the Comms Enabled message.
The important part is getting the .dll file in the right directory and adding it to the directives list in your program. That way you can access the other methods for moving the motor around and doing stuff.
PS... I'm using Visual Studio 2013.