User`s guide

Using the TCP Implementation
4-27
Creating an External Mode Communication Channel
The Real-Time Workshop provides support for TCP/IP through ext_comm.
When creating your own custom target for a new board, you may choose to use
another communications protocol.
To create your own external mode communication channel, you must:
Create a MEX-file for the external interface
Add a communications protocol to your target
The best way to do this is to use the TCP channel provided with the Real-Time
Workshop as an example. Start by copying the source files in
matlabroot/rtw/ext_comm and looking at the generic real-time target (grt)
source files in
matlabroot/rtw/c/src and matlabroot/rtw/c/grt.
Rebuilding the ext_comm MEX-file
The Real-Time Workshop provides compiled versions of ext_comm,whichare
created from
ext_comm.c for all supported hosts. If you want to rebuild the
MEX-file, you can regenerate it by using MATLAB’s
mex command, provided
that you have an installed compiler supported by the MATLAB API. See the
MATLAB Application Program Interface Guide for more information.
This table lists the form of the commands on PC and UNIX platforms:
Table 4-1: Commands Needed to Rebuild MEX-files
Platform Commands
PC
cd matlabroot\toolbox\rtw
mex matlabroot\rtw\ext_mode\ext_comm.c
matlabroot\rtw\ext_mode\ext_convert.c
–Imatlab\rtw\c\src –DWIN32
compiler_library_path\wsock32.lib
UNIX
cd matlabroot/toolbox/rtw
mex matlabroot/rtw/ext_mode/ext_comm.c
matlabroot\rtw\ext_mode\ext_convert.c
–Imatlab/rtw/c/src