Products for USB Sensing and Control
It is currently Thu Jun 20, 2013 6:30 am

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Phidget Motor Control HC
PostPosted: Tue Feb 08, 2011 12:31 pm 
Offline
Phidgetsian

Joined: Fri Jan 07, 2011 1:58 pm
Posts: 5
I am programming a Phidget Motor Control HC to control a DC motor using .NET 3.5. The code is working fin, I can set the motor velocity and acceleration and it responds correctly. I am not, however, getting any notifications back (such as Current and Velocity change). Here is my initialization code:

public new void Start()
{
try
{
//Initiallize the MotorControl object
motoControl = new MotorControl();

//Hook the basic event handlers
motoControl.Attach += new AttachEventHandler(motoControl_Attach);
motoControl.Detach += new DetachEventHandler(motoControl_Detach);
motoControl.Error += new ErrorEventHandler(motoControl_Error);

//Hook the phidget specific event handlers
motoControl.CurrentChange += new CurrentChangeEventHandler(motoControl_CurrentChange);
motoControl.InputChange += new InputChangeEventHandler(motoControl_InputChange);
motoControl.VelocityChange += new VelocityChangeEventHandler(motoControl_VelocityChange);

//open the object for MotorControl device connections
motoControl.open();

// Register Events with Instrument Observer
RegisterSubjectEvent(EventName.MOTOR_VELOCITY_UPDATE_EVENT);
RegisterSubjectEvent(EventName.MOTOR_CURRENT_UPDATE_EVENT);
MessageHandler.Start();

}
catch (PhidgetException ex)
{
MessageBox.Show(string.Format("{0}. Phidget Exception: {1}", Name, ex.Description));
}
catch (Exception ex)
{
MessageBox.Show(string.Format("{0}. Exception: {1}", Name, ex.Message));
}
}

Any idea why?


Top
 Profile Send private message  
 
PostPosted: Wed Feb 09, 2011 10:22 am 
Offline
Lead Developer
User avatar

Joined: Mon Jun 20, 2005 8:46 am
Posts: 2359
Location: Canada
Are you getting the attach event?

I'm not sure what the RegisterSubjectEvent lines are supposed to be doing, I'm not familiar with that method.

-Patrick


Top
 Profile Send private message  
 
PostPosted: Wed Feb 09, 2011 11:57 am 
Offline
Phidgetsian

Joined: Fri Jan 07, 2011 1:58 pm
Posts: 5
Thank you for your response.
Placing a breakpoint in the attach event handler never breaks. However, I know that the device is attached since I can send velocity and acceleration commands and the device is responding (I also added a waitForAttachment and it is not blocking). It is simply that none of the events I am registering to receive are being issued.
The RegisterSubjectEvent has nothing to do with this. I commented this code out, place breakpoints in all the event handler and none of them break).


Top
 Profile Send private message  
 
PostPosted: Wed Feb 09, 2011 3:56 pm 
Offline
Lead Developer
User avatar

Joined: Mon Jun 20, 2005 8:46 am
Posts: 2359
Location: Canada
If you open/run the c# example, do you get events?

Is there anything unique about your project which is different from the examples?

-Patrick


Top
 Profile Send private message  
 
PostPosted: Wed Feb 09, 2011 5:56 pm 
Offline
Phidgetsian

Joined: Fri Jan 07, 2011 1:58 pm
Posts: 5
I got it resolved. I had the Phidget library referenced (by mistake) on another project in the solution and it created this problem.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group