This page is optimized for mobile devices, if you would prefer the desktop version just
click here
Using the tcp/ip interface
This section will describe a Simulink model used to generate code for capturing and displaying video frames from/to the PC target using the TCP/IP protocol You should allocate an IP address to the DM6437 DVDP, as described in the board documentation. .
- Create a new Simulink model
- Open the Simulink library browser and add the "C6437EVM" from the "Target Support Package TC6" group of the " C6000 Target Preferences" Blockset (Please refer to Figure 16).
The "C6437EVM" Block - Drag in an empty subsystem into the model (Simulink->Ports&Subsystem->Subsystem).
- Delete its contents
- Format it: Give it a name. In our example we use “Bulid / Reload&Run".
- Right click on the Subsystem, choose “Block Properties”. Go to the Callbacks tab, and under OpenFcn* enter: “RW_tcpip_script('RW_pcl_tcpip');”, as shown in the following picture:
Creating the “Bulid / Reload&Run” Simulink block - Add the "Task" block from the "DSP/BIOS library" group of the "Target Support Package TC6" Blockset.
- Add the “Function- Call Subsystem” from the “Ports&Subsystems" group of the "Simulink" Blockset (Please refer to Figure 18).
The "Function-Call Subsystem" Block - Rename “Function- Call Subsystem” to “R_W Algorithm” and connect it to the “Task” block.
- Add the "IP Config" block from "Target Support Package™ TC6->DM6437 EVM Board Support"
- Save the model as “RW_dm6437_tcpip.mdl”. Your model should look as follows:
The " RW_dm6437_tcpip.mdl " Model - Double-click the “Task” block and make the same changes as shown in Figure 20.
"Task" Configuration - Double-click the “IP Config” block and make the same changes as shown in Figure 21.
“IP Config” Configuration - Double-click the “R_W Algorithm” block. A new window will be opened.
- In the new window, add the "TCP/IP Recive", "TCP/IP Send", "Byte Unpack" and "Byte Pack" from the "C6000 DSP Communication Libary" group of the ""Target Support Package TC6" Blockset as shown in Figure 22.
The "TCP/IP Receive" and "TCP/IP Send" blocks - Connect the blocks as shown in Figure 23.
The “R_W Algorithm” block - Double-click the “TCP/IP Receive” block and make the same changes as shown in Figure 24.
Main Screen Data Types "TCP/IP Receive" Configuration - Double-click the “TCP/IP Send” block and configure it as shown in Figure 25:
"TCP/IP Send" Configuration - Double-click the “Byte Unpack” block and configure it as shown in Figure 26.
" Byte Unpack " Configuration - Double-click the “Byte pack” block and configure it as shown in Figure 27.
" Byte Pack " Configuration - Open a new m-file, copy the following code and save it as "RW_tcpip_script.m" at the same directory as the model.
- Create another new Simulink model. Add the "Byte Pack" from the "C6000 DSP Communication Libary" group of the ""Target Support Package TC6" Blockset as shown before and the "TCP/IP Receive", "TCP/IP Send" from the "Instrument Control Toolbox" blockset.
- Configure the " TCP/IP Receive " and " TCP/IP Send " blocks :
"TCP/IP Receive" TCP/IP Send "TCP/IP Receive" "TCP/IP Send" Blocks Configuration - Add the "To Video Display" from the "DM6437 EVM Board Support" group of the ""Target Support Package TC6" Blockset , also add the "From Multimedia File" from " Signal Processing Sources" group of the "Signal Processing blockset".
- Configure the " From Multimedia File " block
"TCP/IP Receive" TCP/IP Send "From Multimedia File" Configuration - Add the “Subsystem” from the “Ports&Subsystems" group of the "Simulink" Blockset as shown before.
- Rename “Function- Call Subsystem” to “Display”.Double-click the “Display” block. A new window will be opened. In the new window, add the "Byte Unpack" and " To Video Display " as shown before, add the "Reshape" from the "Math Operations" grope of the "Simulink" blockset. (Configurations are the same as before).
- Connect the blocks as follows:
The "Display" block - Your model should look as follows:
- Save it as “RW_pcl_tcpip.mdl”.
- Build load and run the project. Double-click the "Build / Reload&Run" block.
- Running the script, you will see the video captured and displayed. A single frame is shown in Figure 32.
The Captured Video The Displayed Video Capturing and Displaying Video Using TCP/IP - This model can be found here .
Read also:
OpenStax, From matlab and simulink to real-time with ti dsp's. OpenStax CNX. Jun 08, 2009 Download for free at http://cnx.org/content/col10713/1.1
Google Play and the Google Play logo are trademarks of Google Inc.