Filter löschen
Filter löschen

Caught unexpected exception of unknown type TCP/IP device connection

17 Ansichten (letzte 30 Tage)
Senaasa
Senaasa am 17 Jul. 2014
Kommentiert: Andrés Aguilar am 30 Dez. 2021
Hi, I'm trying to connect a Newport XPS motion controller to Matlab via TCP/IP. I'm running 64bit 2012b on win7 64bit. The code is:
loadlibrary('XPS_C8_drivers.dll','xps_load_drivers.h')
% Set connection parameters
IP = '192.168.0.254' ;
Port = 5001;
TimeOut = 10.0 ;
% Connect to XPS
socketID = TCP_ConnectToServer (IP, Port, TimeOut) ;
% Check connection
if (socketID < 0)
disp 'Connection to XPS failed, check IP & Port' ;
return ;
end
% Define the positioner
group = 'GROUP2' ;
positioner = 'GROUP2.POSITIONER' ;
% Kill the group
[errorCode] = GroupKill(socketID, group) ;
if (errorCode ~= 0)
disp (['Error ' num2str(errorCode) 'occurred while doing GroupKill ! ']) ;
return ;
end
% Initialize the group
[errorCode] = GroupInitialize(socketID, group) ;
if (errorCode ~= 0)
disp (['Error ' num2str(errorCode) ' occurred while doing GroupInitialize ! ']) ;
return ;
end
% Home search
[errorCode] = GroupHomeSearch(socketID, group) ;
if (errorCode ~= 0)
disp (['Error ' num2str(errorCode) ' occurred while doing GroupHomeSearch ! ']) ;
return ;
end
% Make a move
[errorCode] = GroupMoveAbsolute(socketID, positioner, 20.0) ;
if (errorCode ~= 0)
disp (['Error ' num2str(errorCode) ' occurred while doing GroupMoveAbsolute ! ']) ;
return ;
end
% Get current position
[errorCode, currentPosition] = GroupPositionCurrentGet(socketID, positioner, 1) ;
if (errorCode ~= 0)
disp (['Error ' num2str(errorCode) ' occurred while doing GroupPositionCurrentGet! ']) ;
return ;
else
disp (['Positioner ' positioner ' is in position ' num2str(currentPosition)]) ;
end
% Close connection
TCP_CloseSocket(socketID)
This script runs fine the first time, but if I try to execute it a second time, I get "Caught unexpected exception of unknown type". If I hover the mouse for the run button after the second attempt Matlab tells me that "Syntax Error: TestXPS cannot run as it appears". I need to restart the computer to run it again. I ran this on a 32bit matlab 2012b and it can be run multiple times in a row with no errors.
Anyone have an idea?
Thanks, Charles
  2 Kommentare
Feng
Feng am 5 Mär. 2015
I run into the same problem when I recently upgrade my computer to 64-bits. Did you find a solution for your problem? Thanks, Feng
Andrés Aguilar
Andrés Aguilar am 30 Dez. 2021
I know this is really old but soemone might find this comment useful: the dll I downloaded from the ftp server on the XPS(Q8) is a 32bit dll. It got it to work on a 32 bit 2015a Matlab on Windows 10 64 bit.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Application Deployment finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by