ask for library C# ...
 
Notifications
Clear all

ask for library C# use on class 5 motor

11 Posts
1 Users
0 Reactions
15 K Views
(@zslim)
Posts: 18
Active Member Guest
Topic starter
 

ask for library C# use on class 5 motor

 
Posted : 14/01/2015 2:47 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

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.

 
Posted : 14/01/2015 9:52 am
(@zslim)
Posts: 18
Active Member Guest
Topic starter
 

Do you have simple sample of communication C# interface with Animatics motor?

 
Posted : 14/01/2015 9:20 pm
(@zslim)
Posts: 18
Active Member Guest
Topic starter
 

Do you have simple sample of communication C# interface with Animatics motor?

 
Posted : 14/01/2015 10:23 pm
(@csearcy)
Posts: 316
Reputable Member Guest
 

I'm sorry... but I do not have a C# example.

 
Posted : 14/01/2015 11:35 pm
(@zslim)
Posts: 18
Active Member Guest
Topic starter
 

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?

 
Posted : 05/02/2015 11:28 pm
(@zslim)
Posts: 18
Active Member Guest
Topic starter
 

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?

 
Posted : 05/02/2015 11:30 pm
(@csearcy)
Posts: 316
Reputable Member Guest
 

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.

 
Posted : 05/02/2015 11:35 pm
(@AClark)
Posts: 2
New Member Guest
 

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;
}
}

 
Posted : 31/08/2015 10:49 am
(@csearcy)
Posts: 66
Trusted Member Guest
 

What was the result? Which MessageBox?

 
Posted : 31/08/2015 10:57 am
(@AClark)
Posts: 2
New Member Guest
 

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.

 
Posted : 31/08/2015 11:10 am
Share: