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 CenterFile Exchange에서 Communications Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by