Page 1 of 1

Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 1:59 am
by lotito
Hi all and thanks in advance for your help.
I'm using successfully for a few projects the phidgets boards.
Now I had to drive 10 output relays in the same project and I read that I can connect more than one kit (004 or 008) to the same PC sending commands to each one using the serial number of the device...

But in this way I have to build (java) these S/N directly in the code?!
If I have another instance of my project (it should be a commercial product) with two other IFKits I had to rebuild the code with the new S/N?
Or there is a smarter way to instance the two devices (they do different work so I need to know who is who)?
I hope I explained myself, thanks a lot all!
Domenico

Re: Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 8:37 am
by burley
You can use the Phidget Manager class. It has a getPhidgets() function which returns a list of all Phidgets devices currently connected to the system. This allows you to open Phidgets that are connected to the system dynamically.

Re: Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 8:50 am
by lotito
Yes, I had a look at that function but I'm trying to understand it can help in this case...

I need to make many systems with two 008 IFKit (1017_1) connected and in the single system the two have to do different things.. the first 008 works on a set of output, the second on another (logically different).
If I know the S/N I can make SN1.setouput() or SN2.setoutput() but if I had many systems with this configuration how can I avoid to know the SN to use them building them in the code?
The order of the getphidgets() result is always the same (i.e. from smaller SN to higher)? In this case i can pay attention and wire the smaller SN on the first set of output and the higher on the second one? If this is so I can point the first set as getphidgets()[1].setoutput() and the second as getphidgets()[2].setoutput().
Is this correct?

Re: Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 9:34 am
by burley
Making sure the Phidgets have a consistent ordering with respect to the serial number is one way of accomplishing this. The other way is to use the Label property. Currently labels are not settable under Windows so you would need to use a Mac or Linux machine to flash the labels to the devices prior to installation. Then you can actually just open the device via the label. In this case the label does not have to be unique across systems, you can have the same 2 labels for each pair of devices. This way you can use the same code to open each pair.

Re: Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 9:41 am
by lotito
This is definitely a more consistent way I hadn't noticed before.
So i can once setlabel() the devices before the use to i.e. 'DV1' and 'DV2' (which I suppose are non-volatile) and then address them this way in every system. Were you suggesting this?

Re: Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 10:10 am
by Patrick
Yes, exactly.

Re: Many InterfaceKit with serial number?

Posted: Wed Feb 22, 2012 10:44 am
by lotito
Great!
Thanks for the suggestion and the quick reply, your support is just good as your products.