Multiple controller 1063 on a pc

C, C++, and Visual C++
hierro
Fresh meat
Posts: 3
Joined: Mon Apr 02, 2012 1:38 pm
Contact:

Multiple controller 1063 on a pc

Postby hierro » Wed May 23, 2012 8:35 am

Hi all, actually im developing an application that has to manage 2 stepper motor, actually i just had a board 1063 (that handle only motor), im gonna buy another, is there a way to manage them separately ? i saw that stepper just open and get serial and get data, how can i choose to use one board or another ?

Thanks u all in advance

fraser
Engineering
Posts: 273
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Multiple controller 1063 on a pc

Postby fraser » Wed May 23, 2012 10:14 am

when you call open(), you can specify a serial number as an argument to choose which device you are opening.

so instead of the "-1" used in the sample program like:

CPhidget_open((CPhidgetHandle)stepper, -1);


replace the "-1" with the serial number of the specific stepper.
You will need to use two different stepper handles however, something like:

Code: Select all

CPhidgetStepperHandle stepper1 = 0;
CPhidgetStepperHandle stepper2 = 0;

CPhidgetStepper_create(&stepper1);
CPhidgetStepper_create(&stepper2);


//SETUP HANDLERS HERE


CPhidget_open((CPhidgetHandle)stepper1, serial1);
CPhidget_open((CPhidgetHandle)stepper2, serial2);




Where serial1 and serial2 are the serial numbers of the 2 steppers

hierro
Fresh meat
Posts: 3
Joined: Mon Apr 02, 2012 1:38 pm
Contact:

Re: Multiple controller 1063 on a pc

Postby hierro » Thu May 24, 2012 5:15 am

Thank u a lot, is there anyway to list all the devices connecetd with relatives serials ?

Btw in my program (c#) i m just doing

Code: Select all

timer1.Tick += new EventHandler(timer1_Tick);

            stepper = new Stepper();

            stepper.Attach += new AttachEventHandler(stepper_Attach);
            stepper.Detach += new DetachEventHandler(stepper_Detach);
            stepper.Error += new ErrorEventHandler(stepper_Error);

            stepper.CurrentChange += new CurrentChangeEventHandler(stepper_CurrentChange);
            stepper.PositionChange += new StepperPositionChangeEventHandler(stepper_PositionChange);
            stepper.VelocityChange += new VelocityChangeEventHandler(stepper_VelocityChange);
            stepper.InputChange += new InputChangeEventHandler(stepper_InputChange);

            openCmdLine(stepper);


still didnt get really how CmdLine works and for what, guess for server handling.

i would like to have a way to list all devices connected and then manage them separately to move 2 motors finally, still really thank u

fraser
Engineering
Posts: 273
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Multiple controller 1063 on a pc

Postby fraser » Thu May 24, 2012 8:41 am

For getting a list of attached phidgets, there is a Manager class that you can create that keeps track of every phidget attached to the computer.

There is a C# example program showing how to use it. You can use attach/detach events that list device names, serial numbers, versions and status.

If you dont want events to track it, the manager stores an array of the attached phidgets where you can grab the same data as stated above.

hierro
Fresh meat
Posts: 3
Joined: Mon Apr 02, 2012 1:38 pm
Contact:

Re: Multiple controller 1063 on a pc

Postby hierro » Thu May 24, 2012 11:22 am

Than u a lot, i didnt see it within Examples, works perfectly, aslo if still waiting second board :D thank you a lot indeed


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 11 guests