Encoder count

Legacy support with Phidget21
gcarlson
Fresh meat
Posts: 4
Joined: Mon Apr 07, 2008 3:13 pm

Encoder count

Postby gcarlson » Mon May 16, 2011 4:49 pm

Can anyway give me a snippet to find the encoder count (number of encoders, not position)? I am trying to determine whether a 1052 or 1047 encoder board has attached.

Thanks, Gregg

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

Re: Encoder count

Postby Patrick » Tue May 17, 2011 11:47 am

The 'EncoderCount' property. Alternatively, you could look at the 'Name' property.

-Patrick

gcarlson
Fresh meat
Posts: 4
Joined: Mon Apr 07, 2008 3:13 pm

Re: Encoder count

Postby gcarlson » Tue May 17, 2011 4:48 pm

OK Patrick, that works, and I see I have to enable some encoders to get the OnPositionChange event working.

phidgetEnc.Enabled(0) = True

works on the first channel (True is -1 in VB6)

phidgetEnc.Enabled(1) = True

but this causes the board to disconnect, reconnect repeatedly. Setting to 1 does the same thing - the second statement doesn't work. I can also swap the lines but only enable one channel.

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

Re: Encoder count

Postby Patrick » Wed May 18, 2011 9:24 am

Try waiting a bit between enabling channels - maybe 250ms. Probably the voltage drop caused by enabling encoders is causing the Phidget to reset.

-Patrick

gcarlson
Fresh meat
Posts: 4
Joined: Mon Apr 07, 2008 3:13 pm

Re: Encoder count

Postby gcarlson » Wed May 18, 2011 11:00 am

Thanks Patrick,

That's it! I have a new 10-port powered USB hub, but it is "greying" out some of my devices! For what it's worth:

http://www.amazon.com/gp/product/B00475WJEY

Assuming the "power" isn't all it's cracked up to be!

Thanks.

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

Re: Encoder count

Postby Patrick » Wed May 18, 2011 12:41 pm

Well, you do get what you pay for. A 10-port USB hub should technically have at least a 5V, 5A power supply - 500mA for each port. This hub only has a 2A power supply, so if you have more then 4 high power devices plugged in, you'll overload the power supply. It drives me nuts to see these huge hubs with insufficient power supplies...

-Patrick

gcarlson
Fresh meat
Posts: 4
Joined: Mon Apr 07, 2008 3:13 pm

Re: Encoder count

Postby gcarlson » Wed May 18, 2011 2:31 pm

Haha - right!

The hub actually has only a 1000ma wart on it, but I've only got one other device attached, which is *probably* not high-power. But, the cube isn't warm either; I don't think the hub is really supplying power.

The power supply reads 5.35 V at rest, and then 3.7 V after you plug it into an active strip (on the USB ports themselves), with no devices plugged in. So, the power cube probably isn't even regulated in addition to being too small.

Wow!


Return to “VB 6.0”

Who is online

Users browsing this forum: No registered users and 1 guest