Using GUI to interact between xPC Target and host machine?
1 view (last 30 days)
Show older comments
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 Comment
Matt Kindig
on 1 May 2013
After your xpc() function, add
xpctargetping();
What does this function output?
Answers (0)
See Also
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!