<< Chapter < Page Chapter >> Page >

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. .

Capturing and Displaying Video Using the TCP/IP port
  1. Create a new Simulink model
  2. 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
    We now need to create Simulink dedicated block to execute CCS commands.
  3. Drag in an empty subsystem into the model (Simulink->Ports&Subsystem->Subsystem).
  4. Delete its contents
  5. Format it: Give it a name. In our example we use “Bulid / Reload&Run".
  6. 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
  7. Add the "Task" block from the "DSP/BIOS library" group of the "Target Support Package TC6" Blockset.
  8. Add the “Function- Call Subsystem” from the “Ports&Subsystems" group of the "Simulink" Blockset (Please refer to Figure 18).
    The "Function-Call Subsystem" Block
  9. Rename “Function- Call Subsystem” to “R_W Algorithm” and connect it to the “Task” block.
  10. Add the "IP Config" block from "Target Support Package™ TC6->DM6437 EVM Board Support"
  11. Save the model as “RW_dm6437_tcpip.mdl”. Your model should look as follows:
    The " RW_dm6437_tcpip.mdl " Model
  12. Double-click the “Task” block and make the same changes as shown in Figure 20.
    "Task" Configuration
  13. Double-click the “IP Config” block and make the same changes as shown in Figure 21.
    “IP Config” Configuration
  14. Double-click the “R_W Algorithm” block. A new window will be opened.
  15. 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
  16. Connect the blocks as shown in Figure 23.
    The “R_W Algorithm” block
  17. 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
    .
  18. Double-click the “TCP/IP Send” block and configure it as shown in Figure 25:
    "TCP/IP Send" Configuration
  19. Double-click the “Byte Unpack” block and configure it as shown in Figure 26.
    " Byte Unpack " Configuration
  20. Double-click the “Byte pack” block and configure it as shown in Figure 27.
    " Byte Pack " Configuration
  21. Open a new m-file, copy the following code and save it as "RW_tcpip_script.m" at the same directory as the model.
  22. 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.
  23. Configure the " TCP/IP Receive " and " TCP/IP Send " blocks :
    "TCP/IP Receive"
    TCP/IP Send
    "TCP/IP Receive" "TCP/IP Send" Blocks Configuration
  24. 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".
  25. Configure the " From Multimedia File " block
    "TCP/IP Receive"
    TCP/IP Send
    "From Multimedia File" Configuration
  26. Add the “Subsystem” from the “Ports&Subsystems" group of the "Simulink" Blockset as shown before.
  27. 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).
  28. Connect the blocks as follows:
    The "Display" block
  29. Your model should look as follows:
  30. Save it as “RW_pcl_tcpip.mdl”.
  31. Build load and run the project. Double-click the "Build / Reload&Run" block.
  32. 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
  33. This model can be found here .

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  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.

Notification Switch

Would you like to follow the 'From matlab and simulink to real-time with ti dsp's' conversation and receive update notifications?

Ask