Page 1 of 1

Setting port and channel - C language

Posted: Thu Dec 21, 2017 5:25 am
by satsriakal
Hi everybody,

I'm using a VintHub device with this code (C language):

Phidget_setHubPort((PhidgetHandle)x->ch, 2);
Phidget_setIsHubPortDevice((PhidgetHandle)x->ch, 1);
Phidget_setChannel((PhidgetHandle)x->ch, 2);

If I comment the third line, I got the console message with the port and the channel number set (the channel is always set to 0). The device works but for all ports, channel number is 0.
If I uncomment the third line, I don't get any message, and the device doesn't work at all.

What should I change?
Best regards
BB

Re: Setting port and channel - C language

Posted: Thu Dec 21, 2017 11:26 am
by mparadis
If you are trying to use the ports of the VINT Hub on their own (i.e. in DigitalInput, DigitalOutput, VoltageInput or VoltageRatioInput mode), you need to use IsHubPortDevice (set to "true" or 1) and setHubPort to choose which VINT Port to use. Calling setChannel with a non-zero argument will cause open to fail in this case, since the VINT Hub ports are considered to each only have one channel themselves.

If you are trying to use a VINT Device (such as the DAQ1500 or TMP1200) connected to one of the ports on the VINT Hub, you'll want to use setHubPort to specify which port of the VINT Hub it's connected to, and setChannel to specify which port on the VINT device you want to open.

Have a look at this video, which shows an example to clarify the difference between these two cases.

Re: Setting port and channel - C language

Posted: Fri Dec 22, 2017 8:51 am
by satsriakal
Thanks a lot!