Concurrent function calls with multiple stepper motors

Supporting Visual Studio on Windows
EPR
Fresh meat
Posts: 2
Joined: Fri Feb 26, 2016 9:09 am
Contact:

Concurrent function calls with multiple stepper motors

Postby EPR » Fri Feb 26, 2016 9:15 am

Hi

What is the recommended way of making concurrent calls to 2 steppers using TargetPosition?

I will have 2 motors, X & Y and want the axis to move simultaneously to position to achieve faster motion. Was thinking of using threads, maybe tasks or Parallel.Invoke, e.g. Parallel.Invoke(setPosX( ... ), setPosY(...))

Will the event handlers be happy with this? Unable to test yet as do not have hardware 1067_0 controller.

Thanks

Ted

User avatar
Patrick
Lead Developer
Posts: 3064
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Concurrent function calls with multiple stepper motors

Postby Patrick » Fri Feb 26, 2016 9:44 am

You should just call the two setTargetPosition calls one after the other from the same thread - the calls are actually send out to the hardware from dedicated device write threads. There isn't any way to guarantee a sync between multiple controllers (this would require a connection between them), but generally these messages will be delivered within ms of each other.

-Patrick

EPR
Fresh meat
Posts: 2
Joined: Fri Feb 26, 2016 9:09 am
Contact:

Re: Concurrent function calls with multiple stepper motors

Postby EPR » Fri Feb 26, 2016 9:46 am

Patrick wrote:You should just call the two setTargetPosition calls one after the other from the same thread - the calls are actually send out to the hardware from dedicated device write threads. There isn't any way to guarantee a sync between multiple controllers (this would require a connection between them), but generally these messages will be delivered within ms of each other.

-Patrick



Thanks for reply. Just to clarify they don't need to be synchronised as each controls a different axis, but is the function call blocking? I don't want to invoke a call to stepper X and then wait for it to complete before Y starts to move.

Cheers

User avatar
Patrick
Lead Developer
Posts: 3064
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Concurrent function calls with multiple stepper motors

Postby Patrick » Fri Feb 26, 2016 3:43 pm

The calls are non-blocking.


Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 1 guest