Phidget22 Network server and 1047 High Speed Encoder

Supporting 2.6 and up
Post Reply
mse_uk
Phidgetsian
Posts: 5
Joined: Mon May 08, 2017 9:21 am
Contact:

Phidget22 Network server and 1047 High Speed Encoder

Post by mse_uk »

Hi Guys,

I wonder if you could possibly offer advice please.

We are in the process of upgrading from Phidget21 to Phidget22 and for the most
part it's going well. When a phidget is attached locally we can easily comminicate
and control them no problem.

Our problems are only when we are communicating with a High Speed Encoder over the
network.

We can successfully communicate with 1014 Interface kit 0/0/4, 1045 Temperature and
1019 Interface kit 8/8/8 getting expected results. Our problem comes when we are
trying to access a 1047 High Speed encoder. We are getting

"PhidgetException 0x00000034 (Device not present)"

Our primary network target is a Raspberry Pi as our network solution is built around
these. We have tried using a Phidget 1019 Interface kit 8/8/8 with the USB hub connected
to the Pi, a Linux PC and a Phidget SBC4 running as servers. We have also tried multiple
encoder units.

We are connecting to phidget.NET.dll version 1.1.0.20 and our minimum reproduceable code is:-

Code: Select all

procedure TfrmTestEncoder.FormCreate(Sender: TObject);
begin
  //Create interface to the .NET Framework
  Console:=CoConsole.CreateInstance;
  ClrHost:=ClrHostManager;

  netIntf:=TNetHelper.Create;
  netIntf.EnableServerDiscovery(stDeviceRemote);

end;

Code: Select all

procedure TfrmTestEncoder.btnTestClick(Sender: TObject);
begin
  Try
   enc:=tEncoder.Create();
   enc.DeviceSerialNumber:=344046;
   enc.IsLocal:=False;
   enc.IsRemote:=True;
   enc.Channel:=0;
   enc.Open;

   Timer1.Enabled:=True;

  Except
   on E: Exception do
    ShowMessage(E.ClassName + ': ' + E.Message);
  End; {Try}

end;

Code: Select all

procedure TfrmTestEncoder.Timer1Timer(Sender: TObject);
begin
  Try
   [b]lblEncoderPos.Caption:=intToStr(enc.Position);[/b]
  Except
   On e:Exception Do
    Begin
     Timer1.Enabled:=False;
     ShowMessage(E.ClassName + ': ' + E.Message);
    End;

  End; {Try}

end;
Our error is being thrown in TfrmTestEncoder.Timer1Timer when we try to read enc.position.

Any suggestions, comments or pointers would be most greatly appreciated.

Regards,

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

Re: Phidget22 Network server and 1047 High Speed Encoder

Post by Patrick »

Probably the attach has not completed yet. You should either be using the attach event, or the blocking open with timeout before trying to access the device. Probably you don't want to block in a button handler, so I'd advise registering the attach event and starting the timer from there.

-Patrick
mse_uk
Phidgetsian
Posts: 5
Joined: Mon May 08, 2017 9:21 am
Contact:

Re: Phidget22 Network server and 1047 High Speed Encoder

Post by mse_uk »

Hi Patrick,

Many thanks, that nailed it!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests