Using GUI to interact between xPC Target and host machine?

1 visualización (últimos 30 días)
Justin Liang
Justin Liang el 30 de Abr. de 2013
I used the code from Mathworks (<http://www.mathworks.com/support/solutions/en/data/1-18QFF/>) and changed the address and ports to the actual values. I then ran the GUI just to test the connection and I noticed that even when my host machine is not connected to the target PC, pushing the "Connect To Target" button showed a successful connection. This does not makes sense and implies that the feedback is not working correctly? Does anyone know what it wrong? For those who don't want to run MATLAB, here is the "Connect To Target" code they used in the GUI:
function connect_Callback(hObject, eventdata, handles)
set(handles.Status,'String', 'Status: Connecting.......'); drawnow;
% Set TCP/IP connection settings
address = get(handles.ipadd,'String');
port = get(handles.port,'String');
setxpcenv('TcpIpTargetAddress',address,'TcpIpTargetPort',port);
try
handles.tg = xpc('TcpIp',address,port); % Create xPC target object
set(handles.download,'Enable','on') % Enable the Download push button
set(handles.Status,'String', 'Status: Target connection established'); drawnow;
catch
set(handles.Status, 'String', 'Error: Target connection could not be established'); drawnow;
errordlg(lasterr);
end
% Update handles structure
guidata(hObject, handles);

Respuestas (0)

Categorías

Más información sobre Communications Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by