Using GUI to interact between xPC Target and host machine?

1 vue (au cours des 30 derniers jours)
Justin Liang
Justin Liang le 30 Avr 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);
  1 commentaire
Matt Kindig
Matt Kindig le 1 Mai 2013
After your xpc() function, add
xpctargetping();
What does this function output?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Communications Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by