Page 1 of 1

Phidget22 Network server and 1047 High Speed Encoder

Posted: Wed Aug 22, 2018 7:03 am
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.

Re: Phidget22 Network server and 1047 High Speed Encoder

Posted: Wed Aug 22, 2018 9:05 am
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

Re: Phidget22 Network server and 1047 High Speed Encoder

Posted: Thu Aug 23, 2018 12:39 am
by mse_uk
Hi Patrick,

Many thanks, that nailed it!