Using GUI to interact between xPC Target and host machine?

1 回表示 (過去 30 日間)
Justin Liang
Justin Liang 2013 年 4 月 30 日
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 件のコメント
Matt Kindig
Matt Kindig 2013 年 5 月 1 日
After your xpc() function, add
xpctargetping();
What does this function output?

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCommunications Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by