Skip to Main Content Skip to Search
Product Documentation

IDE Automation Interface

Getting Started with IDE Automation Interface

Introducing the IDE Automation Interface Tutorial

Embedded Coder provides a connection between MATLAB software and a processor in CCS. You can use objects to control and manipulate a signal processing application using the computational power of MATLAB software. This approach can help you debug and develop your application. Another possible use for automation is creating MATLAB scripts that verify and test algorithms that run in their final implementation on your production processor.

Before using the functions available with the objects, you must select a processor to be your processor because any object you create is specific to a designated processor and a designated instance of CCS IDE. For multiprocessor boards or multiple board configurations of CCS, select the specific processor.

When you have one board with a single processor, the object defaults to the existing processor. For the objects, the simulator counts as a board; if you have both a board and a simulator that CCS recognizes, you must specify the processor explicitly.

To get you started using objects for CCS IDE software, Embedded Coder includes a tutorial that introduces you to working with data and files. As you work through this tutorial, you perform the following tasks that step you through creating and using objects for CCS IDE:

  1. Select your processor.

  2. Create and query objects to CCS IDE.

  3. Use MATLAB software to load files into CCS IDE.

  4. Work with your CCS IDE project from MATLAB software.

  5. Close the connections you opened to CCS IDE.

The tutorial provides a working process (a workflow) for using Embedded Coder and your signal processing programs to develop programs for a range of Texas Instruments processors.

During this tutorial, you load and run a digital signal processing application on a processor you select. The tutorial demonstrates both writing to memory and reading from memory in the "Working with Projects and Data" portion of the tutorial.

You can use the read and write methods, as described in this tutorial, to read and write data to and from your processor.

The tutorial covers the object methods and functions for Embedded Coder. The functions listed in the first table apply to CCS IDE independent of the objects — you do not need an object to use these functions. The methods listed in the second and third table requires a ticcs object that you use in the method syntax:

Functions for Working With Embedded Coder.  The following functions do not require a ticcs object as an input argument:

FunctionDescription
ccsboardinfoReturn information about the boards that CCS IDE recognizes as installed on your PC.
ticcsConstruct an object to communicate with CCS IDE. When you construct the object you specify the processor board and processor.

Methods for Working with ticcs Objects.  The methods in the following table require a ticcs object as an input argument:

MethodDescription
addAdd files to active project in IDE.
addressMemory address and page value of symbol in IDE.
buildBuild or rebuild current project.

display (IDE Object)

Display the properties of an object to CCS IDE and RTDX.

halt

Terminate execution of a process running on the processor.

info

Return information about the processor or information about open RTDX channels.
insertInsert debug point in file.

isrtdxcapable

Test whether your processor supports RTDX communications.
isvisibleDetermine whether IDE appears on desktop.

isrunning

Test whether the processor is executing a process.

list

Return various information listings from Code Composer Studio software.
loadLoad program file onto processor.

read

Retrieve data from memory on the processor.
regreadRead values from processor registers.
regwriteWrite data values to registers on processor.
removeRemove file, project, or breakpoint.

restart

Restore the program counter (PC) to the entry point for the current program.

run

Execute the program loaded on the processor.

visible

Set whether CCS IDE window is visible on the desktop while CCS IDE is running.

write

Write data to memory on the processor.

Running Code Composer Studio Software on Your Desktop — Visibility.  When you create a ticcs object , Embedded Coder starts CCS in the background.

When CCS IDE is running in the background, it does not appear on your desktop, in your task bar, or on the Applications page in the Task Manager. It does appear as a process, cc_app.exe, on the Processes tab in Microsoft Windows Task Manager.

You can make the CCS IDE visible with the function visible. The function isvisible returns the status of the IDE—whether it is visible on your desktop. To close the IDE when it is not visible and MATLAB software is not running, use the Processes tab in Microsoft Windows Task Manager and look for cc_app.exe.

If a link to CCS IDE exists when you close CCS, the application does not close. Microsoft Windows software moves it to the background (it becomes invisible). Only after you clear all links to CCS IDE, or close MATLAB software, does closing CCS IDE unload the application. You can see if CCS IDE is running in the background by checking in the Microsoft Windows Task Manager. When CCS IDE is running, the entry cc_app.exe appears in the Image Name list on the Processes tab.

When you close MATLAB software while CCS IDE is not visible, MATLAB software closes CCS if it started the IDE. This happens because the operating system treats CCS as a subprocess in MATLAB software when CCS is not visible. Having MATLAB software close the invisible IDE when you close MATLAB software prevents CCS from remaining open. You do not need to close it using Microsoft Windows Task Manager.

If CCS IDE is not visible when you open MATLAB software, closing MATLAB software leaves CCS IDE running in an invisible state. MATLAB software leaves CCS IDE in the visibility and operating state in which it finds it.

Running the Interactive Tutorial.  You have the option of running this tutorial from the MATLAB software command line or entering the functions as described in the following tutorial sections.

To run the tutorial in MATLAB software, click run ccstutorial. This command opens the tutorial in an interactive mode where the tutorial program provides prompts and text descriptions to which you respond to move to the next portion of the lesson. The interactive tutorial covers the same information provided by the following tutorial sections. You can view the tutorial file by clicking ccstutorial.m.

Selecting Your Processor

Links for CCS IDE provides two tools for selecting a board and processor in multiprocessor configurations. One is a command line tool called ccsboardinfo which prints a list of the available boards and processors. So that you can use this function in a script, ccsboardinfo can return a MATLAB software structure that you use when you want your script to select a board without your help.

  1. To see a list of the boards and processors installed on your PC, enter the following command at the MATLAB software prompt:

    ccsboardinfo
    

    MATLAB software returns a list that shows you all the boards and processors that CCS IDE recognizes as installed on your system.

  2. To use the Selection Utility, boardprocsel, to select a board, enter

    [boardnum,procnum] = boardprocsel
    

    When you use boardprocsel, you see a dialog box similar to the following. Note that some entries vary depending on your board set.

  3. Select a board name and processor name from the lists.

    You are selecting a board and processor number that identifies your particular processor. When you create the object for CCS IDE in the next section of this tutorial, the selected board and processor become the processor of the object.

  4. Click Done to accept your board and processor selection and close the dialog box.

    boardnum and procnum now represent the Board name and Processor name you selected — boardnum = 1 and procnum = 0

Creating and Querying Objects for CCS IDE

In this tutorial section, you create the connection between MATLAB software and CCS IDE. This connection, or object, is a MATLAB software object that you save as variable IDE_Obj.

You use function ticcs to create objects. When you create objects, ticcs input arguments let you define other object property values, such as the global timeout. Refer to the ticcs reference documentation for more information on these input arguments.

Use the generated object IDE_Obj to direct actions to your processor. In the following tasks, IDE_Obj appears in all function syntax that interact with CCS IDE and the processor:

  1. Create an object that refers to your selected board and processor. Enter the following command at the prompt.

    IDE_Obj=ticcs('boardnum',boardnum,'procnum',procnum)
    

    If you were to watch closely, and your machine is not too fast, you see Code Composer Studio software appear briefly when you call ticcs. If CCS IDE was not running before you created the new object, CCS starts and runs in the background.

  2. Enter visible(IDE_Obj,1) to force CCS IDE to be visible on your desktop.

    Usually, you need to interact with Code Composer Studio software while you develop your application. The first function in this tutorial, visible, controls the state of CCS on your desktop. visible accepts Boolean inputs that make CCS either visible on your desktop (input to visible = 1) or invisible on your desktop (input to visible = 0). For this tutorial, use visible to set the CCS IDE visibility to 1.

  3. Next, enter display(IDE_Obj) at the prompt to see the status information.

    TICCS Object:
      Processor type   : Cxx
      Processor name   : CPU
      Running?         : No
      Board number     : 0
      Processor number : 0
      Default timeout  : 10.00 secs
    
      RTDX channels    : 0
    

    Embedded Coder provides methods to read the status of a board and processor:

    • info — Return a structure of testable board conditions.

    • display — Print information about the processor.

    • isrunning — Return the state (running or halted) of the processor.

    • isrtdxcapable — Return whether the hardware supports RTDX.

  4. Type linkinfo = info(IDE_Obj).

    The IDE_Obj link status information provides information about the hardware as follows:

    linkinfo = 
    
           procname: 'CPU_1'
        isbigendian: 0
      isrtdxcapable: 0
             family: 320
          subfamily: 103
          revfamily: 11
         targettype: 'simulator'
         siliconrev: 0
            timeout: 10
          boardname: 'Cxxxx Device Simulator'
          
  5. Check whether the processor is running by entering

    runstatus = isrunning(IDE_Obj)
    

    MATLAB software responds, indicating that the processor is stopped, as follows:

    runstatus =
    
         0
    
  6. At last, verify that the processor supports RTDX communications by entering

    usesrtdx = isrtdxcapable(IDE_Obj)
    usesrtdx =
    
         1
    

Loading Files into CCS

You have established the connection to a processor and board and have created and queried objects. Next, the processor needs something to do.

In this part of the tutorial, you load the executable code for the processor CPU in CCS IDE. Embedded Coder includes a CCS project file. Through the next tasks in the tutorial, you locate the tutorial project file and load it into CCS IDE. The open method directs CCS to load a project file or workspace file.

After you have executable code running on your processor, you can exchange data blocks with it. Exchanging data is the purpose of the objects provided by Embedded Coder software.

  1. To load the project file to your processor, enter the following command at the MATLAB software prompt. getdemoproject is a specialized function for loading Embedded Coder demo files. It is not supported as a standard Embedded Coder function.

    demopjt= getDemoProject(IDE_Obj,'ccstutorial')
    
    demopjt.ProjectFile
    
    ans =
    
    C:\Temp\EmbIDELinkCCDemos_v4.1\ccstutorial\cxx\cxxx\ccstut.pjt
    
    demoPjt.DemoDir
    
    ans =
    
    C:\Temp\EmbIDELinkCCDemos_v4.1\ccstutorial\cxx\cxxx
    

    Your paths may be different if you use a different processor. Note where the software stored the demo files on your machine. In general, Embedded Coder software stores the demo project files in

    EmbIDELinkCCDemos_v#.#

    Embedded Coder creates this folder in a location where you have write permission. There are two locations where Embedded Coder software tries to create the demo folder, in the following order:

    1. In a temporary folder on your C drive, such as C:\temp\.

    2. If Embedded Coder software cannot use the temp folder, you see a dialog box that asks you to select a location to store the demos.

  2. Enter the following command at the MATLAB command prompt to build the processor executable file in CCS IDE.

    build(IDE_Obj,'all',20)

    You may get an error related to one or more missing .lib files. If you installed CCS IDE in a folder other than the default installation folder, browse in your installation folder to find the missing file or files. Refer to the path in the error message as an indicator of where to find the missing files.

  3. Change your working folder to the demo folder and enter load(IDE_Obj,'projectname.out') to load the processor execution file, where projectname is the tutorial you chose, such as ccstut_67x.

    You have a loaded program file and associated symbol table to the IDE and processor.

  4. To determine the memory address of the global symbol ddat, enter the following command at the prompt:

    ddata = address(IDE_Obj,'ddat')
    ddata =
    
      1.0e+009 *
    
        2.1475         0
    

    Your values for ddata may be different depending on your processor.

      Note   The symbol table is available after you load the program file into the processor, not after you build a program file.

  5. To convert ddata to a hexadecimal string that contains the memory address and memory page, enter the following command at the prompt:

    dec2hex(ddata)

    MATLAB software displays the following response, where the memory page is 0x00000000 and the address is 0x80000010.

    ans =
    
    80000010
    00000000
    

Working with Projects and Data

After you load the processor code, you can use Embedded Coder functions to examine and modify data values in the processor.

When you look at the source file listing in the CCS IDE Project view window, there should be a file named ccstut.c. Embedded Coder ships this file with the tutorial and includes it in the project.

ccstut.c has two global data arrays — ddat and idat — that you declare and initialize in the source code. You use the functions read and write to access these processor memory arrays from MATLAB software.

Embedded Coder provides three functions to control processor execution — run, halt, and restart.

  1. To demonstrate these commands, use the following function to add a breakpoint to line 68 of ccstut.c.

    insert(IDE_Obj,'ccstut.c',68)

    Line 68 is

    printf("Embedded Coder: Tutorial - Memory Modified by Matlab!\n");
    

    For information about adding breakpoints to a file, refer to insert in the online Help system. Then proceed with the tutorial.

  2. To demonstrate the new functions, try the following functions.

    halt(IDE_Obj)                 % Halt the processor.
    restart(IDE_Obj)              % Reset the PC to start of program.
    run(IDE_Obj,'runtohalt',30);  % Wait for program execution to stop at 
                             % breakpoint (timeout = 30 seconds).
    

    When you switch to viewing CCS IDE, you see that your program stopped at the breakpoint you inserted, and the program printed the following messages in the CCS IDE Stdout tab. Nothing prints in the MATLAB command window:

    Embedded Coder: Tutorial - Initialized Memory
    Double Data array = 16.3 -2.13 5.1 11.8
    Integer Data array = -1-508-647-7000 (call me anytime!)
    
  3. Before you restart your program (currently stopped at line 68), change some values in memory. Perform one of the following procedures based on your processor.

    C5xxx processor family — Enter the following functions to demonstrate the read and write functions.

    1. Enter ddatv = read(IDE_Obj,address(IDE_Obj,'ddat'),'double',4).

      MATLAB software responds with

      ddatv =

         16.3000   -2.1300    5.1000   11.8000
      
    2. Enter idatv = read(IDE_Obj,address(IDE_Obj,'idat'),'int16',4).

      Now MATLAB software responds

      idatv =

      -1 508 647 7000

      If you used 8-bit integers (int8), the returned values would be incorrect.

      idatv=read(IDE_Obj,address(IDE_Obj,'idat'),'int8',4)

      idatv =

      1 0 -4 1

    3. You can change the values stored in ddat by entering write(IDE_Obj,address(IDE_Obj,'ddat'),double([pi 12.3 exp(-1)...
      sin(pi/4)]))

      The double argument directs MATLAB software to write the values to the processor as double-precision data.

    4. To change idat, enter

      write(IDE_Obj,address(IDE_Obj,'idat'),int32([1:4]))

      Here you write the data to the processor as 32-bit integers (convenient for representing phone numbers, for example).

    5. Start the program running again by entering the following command:

      run(IDE_Obj,'runtohalt',30);

      The Stdout tab in CCS IDE reveals that ddat and idat contain new values. Next, read those new values back into MATLAB software.

    6. Enter ddatv = read(IDE_Obj,address(IDE_Obj,'ddat'),'double',4).

      ddatv =

      3.1416 12.3000 0.3679 0.7071

      ddatv contains the values you wrote in step c.

    7. Verify that the change to idatv occurred by entering the following command at the prompt:

      idatv = read(IDE_Obj,address(IDE_Obj,'idat'),'int16',4)

      MATLAB software returns the new values for idatv.

      idatv =

      1 2 3 4

    8. Use restart to reset the program counter for your program to the beginning. Enter the following command at the prompt:

      restart(IDE_Obj);

    C6xxx processor family — Enter the following commands to demonstrate the read and write functions.

    1. Enter ddatv = read(IDE_Obj,address(IDE_Obj,'ddat'),'double',4).

      MATLAB software responds with

      ddatv =

         16.3000   -2.1300    5.1000   11.8000
      
    2. Enter idatv = read(IDE_Obj,address(IDE_Obj,'idat'),'int16',4).

      MATLAB software responds

      idatv =

      -1 508 647 7000

      If you used 8-bit integers (int8), the returned values would be incorrect.

      idatv=read(IDE_Obj,address(IDE_Obj,'idat'),'int8',4)

      idatv =

      1 0 -4 1

    3. Change the values stored in ddat by entering write(IDE_Obj,address(IDE_Obj,'ddat'),double([pi 12.3 exp(-1)...
      sin(pi/4)]))

      The double argument directs MATLAB software to write the values to the processor as double-precision data.

    4. To change idat, enter the following command:

      write(IDE_Obj,address(IDE_Obj,'idat'),int32([1:4]))

      In this command, you write the data to the processor as 32-bit integers (convenient for representing phone numbers, for example).

    5. Next, start the program running again by entering the following command:

      run(IDE_Obj,'runtohalt',30);

      The Stdout tab in CCS IDE reveals that ddat and idat contain new values. Read those new values back into MATLAB software.

    6. Enter ddatv = read(IDE_Obj,address(IDE_Obj,'ddat'),'double',4).

      ddatv =

      3.1416 12.3000 0.3679 0.7071

      Verify that ddatv contains the values you wrote in step c.

    7. Verify that the change to idatv occurred by entering the following command:

      idatv = read(IDE_Obj,address(IDE_Obj,'idat'),'int32',4)

      MATLAB software returns the new values for idatv.

      idatv =

      1 2 3 4

    8. Use restart to reset the program counter for your program to the beginning. Enter the following command at the prompt:

      restart(IDE_Obj);

  4. Embedded Coder offers more functions for reading and writing data to your processor. These functions let you read and write data to the processor registers: regread and regwrite. They let you change variable values on the processor in real time. The functions behave slightly differently depending on your processor. Select one of the following procedures to demonstrate regread and regwrite for your processor.

    C5xxx processor family — Most registers are memory-mapped and available using read and write. However, the PC register is not memory mapped. To access this register, use the special functions — regread and regwrite. The following commands demonstrate how to use these functions to read and write to the PC register.

    1. To read the value stored in register PC, enter the following command at the prompt to indicate to MATLAB software the data type to read. The input string binary indicates that the PC register contains a value stored as an unsigned binary integer.

      IDE_Obj.regread('PC','binary')

      MATLAB software displays

      ans =

      33824

    2. To write a new value to the PC register, enter the following command. This time, the binary input argument tells MATLAB software to write the value to the processor as an unsigned binary integer. Notice that you used hex2dec to convert the hexadecimal string to decimal.

      IDE_Obj.regwrite('PC',hex2dec('100'),'binary')

    3. Verify that the PC register contains the value you wrote.

      IDE_Obj.regread('PC','binary')

    C6xxx processor familyregread and regwrite let you access the processor registers directly. Enter the following commands to get data into and out of the A0 and B2 registers on your processor.

    1. To retrieve the value in register A0 and store it in a variable in your MATLAB workspace. Enter the following command:

      treg = IDE_Obj.regread('A0','2scomp');

      treg contains the two's complement representation of the value in A0.

    2. To retrieve the value in register B2 as an unsigned binary integer, enter the following command:

      IDE_Obj.regread('B2','binary');

    3. Next, enter the following command to use regwrite to put the value in treg into register A2.

      IDE_Obj.regwrite('A2',treg,'2scomp');

      CCS IDE reports that A0, B2, and A2 have the values you expect. Select View > CPU Registers > Core Registers from the CCS IDE menu bar to list the processor registers.

Closing the Links or Cleaning Up CCS IDE

Objects that you create in Embedded Coder software have COM handles to CCS. Until you delete these handles, the CCS process (cc_app.exe in the Microsoft Windows Task Manager) remains in memory. Closing MATLAB software removes these COM handles, but there may be times when you want to delete the handles without closing the application.

Use clear to remove objects from your MATLAB workspace and to delete handles they contain. clear all deletes everything in your workspace. To retain your MATLAB software data while deleting objects and handles, use clear objname. This applies to IDE handle objects you created with ticcs. To remove the objects created during the tutorial, the tutorial program executes the following command at the prompt:

clear cvar cfield uintcvar

This tutorial also closes the project in CCS with the following command:

close(IDE_Obj,projfile,'project')

To delete your link to CCS, enter clear IDE_Obj at the prompt.

Your development tutorial using Code Composer Studio IDE is done.

During the tutorial you

  1. Selected your processor.

  2. Created and queried links to CCS IDE to get information about the link and the processor.

  3. Used MATLAB software to load files into CCS IDE, and used MATLAB software to run that file.

  4. Worked with your CCS IDE project from MATLAB software by reading and writing data to your processor, and changing the data from MATLAB software.

  5. Created and used the embedded objects to manipulate data in a C-like way.

  6. Closed the links you opened to CCS IDE.

Getting Started with RTDX

Texas Instruments Real-Time Data Exchange (RTDX) provides "real-time, continuous visibility into the way target applications operate in the real world. RTDX allows system developers to transfer data between target devices and a host without interfering with the target application."

You can use RTDX with Embedded Coder software and Code Composer Studio to accelerate development and deployment to Texas Instruments C2000 processors. RTDX helps you test and analyze your processing algorithms in your MATLAB workspace. RTDX lets you interact with your process in real time while it's running on the processor. For example, you can:

Enabling real-time interaction lets you more easily see your process or algorithm in action, the results as they develop, and the way the process runs.

This tutorial assumes you have Texas Instruments Code Composer Studio software and at least one target development board. You can use the hardware simulator in CCS IDE to run this tutorial.

After you complete the tutorial, either in the demonstration form or by entering the functions along with this text, you are ready to begin using RTDX with your applications and hardware.

Introducing the Tutorial for Using RTDX

Digital signal processing development efforts begin with an idea for processing data; an application area, such as audio or wireless communications or multimedia computing; and a platform or hardware to host the signal processing. Usually these processing efforts involve applying strategies like signal filtering, compression, and transformation to change data content; or isolate features in data; or transfer data from one form to another or one place to another.

Developers create algorithms they need to accomplish the desired result. After they have the algorithms, they use models and target processor development tools to test their algorithms, to determine whether the processing achieves the goal, and whether the processing works on the proposed platform.

Embedded Coder and the links for RTDX and CCS IDE ease the job of taking algorithms from the model realm to the real world of the processor on which the algorithm runs.

RTDX and links for CCS IDE provide a communications pathway to manipulate data and processing programs on your processor. RTDX offers real-time data exchange in two directions between MATLAB software and your processor process. Data you send to the processor has little effect on the running process and plotting the data you retrieve from the processor lets you see how your algorithms are performing in real time.

To introduce the techniques and tools available in Embedded Coder for using RTDX, the following procedures use many of the methods in the link software to configure the processor, open and enable channels, send data to the processor, and clean up after you finish your testing. Among the functions covered are:

Functions From Objects for CCS IDE.  

FunctionDescription
ticcsCreate connections to CCS IDE and RTDX.
cdChange the CCS IDE working folder from MATLAB software.
openLoad program files in CCS IDE.
runRun processes on the processor.

Functions From the RTDX Class.  

FunctionDescription
closeClose the RTDX links between MATLAB software and your processor.
configureDetermine how many channel buffers to use and set the size of each buffer.
disableDisable the RTDX links before you close them.
displayReturn the properties of an object in formatted layout. When you omit the closing semicolon on a function, disp (a built-in function) provides the default display for the results of the operation.
enableEnable open channels so you can use them to send and retrieve data from your processor.
isenabledDetermine whether channels are enabled for RTDX communications.
isreadableDetermine whether MATLAB software can read the specified memory location.
iswritableDetermine whether MATLAB software can write to the processor.
msgcountDetermine how many messages are waiting in a channel queue.
openOpen channels in RTDX.
readmatRead data matrices from the processor into MATLAB software as an array.
readmsgRead one or more messages from a channel.
writemsgWrite messages to the processor over a channel.

This tutorial provides the following workflow to show you how to use many of the functions in the links. By performing the steps provided, you work through many of the operations yourself. The tutorial follows the general task flow for developing digital signal processing programs through testing with the links for RTDX.

Within this set of tasks, numbers 1, 2, and 4 are fundamental to all development projects. Whenever you work with MATLAB software and objects for RTDX, you perform the functions and tasks outlined and presented in this tutorial. The differences lie in Task 3. Task 3 is the most important for using Embedded Coder to develop your processing system.

  1. Create an RTDX link to your desired processor and load the program to the processor.

    All projects begin this way. Without the links you cannot load your executable to the processor.

  2. Configure channels to communicate with the processor.

    Creating the links in Task 1 did not open communications to the processor. With the links in place, you open as many channels as you need to support the data transfer for your development work. This task includes configuring channel buffers to hold data when the data rate from the processor exceeds the rate at which MATLAB software can capture the data.

  3. Run your application on the processor. You use MATLAB software to investigate the results of your running process.

  4. Close the links to the processor and clean up the links and associated debris left over from your work.

    Closing channels and cleaning up the memory and links you created prepares CCS IDE, RTDX, and Embedded Coder for the next time you start development on a project.

This tutorial uses an executable program named rtdxtutorial_6xevm.out as your application. When you use the RTDX and CCS IDE links to develop your own applications, replace rtdxtutorial_6xevm.out in Task 3 with the filename and path to your digital signal processing application.

You can view the tutorial file used here by clicking rtdxtutorial. To run this tutorial in MATLAB software, click run rtdxtutorial.

One more note about this tutorial. Throughout the code we use both the dot notation (direct property referencing) to access functions and link properties and the function form.

For example, use the following command to open and configure ichan for write mode.

IDE_Obj.rtdx.open('ichan','w');

You could use an equivalent syntax, the function form, that does not use direct property referencing.

open(IDE_Obj.rtdx,'ichan','w');

Or, use

open(rx,'ichan','w');

if you created an alias rx to the RTDX portion of IDE_Obj, as shown by the following command:

rx = IDE_Obj.rtdx;

Creating the ticcs Objects

With your processing model converted to an executable for your desired processor, you are ready to use the objects to test and run your model on your processor. Embedded Coder and the objects do not distinguish the source of the executable — whether you used Embedded Coder, CCS IDE, or some other development tool to program and compile your model to an executable does not affect the object connections. So long as your .out file is acceptable to the processor you select, Embedded Coder provides the connection to the processor.

Before continuing with this tutorial, you must load a valid GEL file to configure the EMIF registers of your processor and perform any required processor initialization steps. Default GEL files provided by CCS are stored in ..\IDE_Obj\gel in the folder where you installed CCS software. Select File > Load_GEL in CCS IDE to load the default GEL file that matches your processor family, such as init6x0x.gel for the Cxxxx processor family, and your configuration.

Begin the process of getting your model onto the processor by creating a an object that refers to CCS IDE. Start by clearing all existing handles and setting echo on so you see functions execute as the program runs:

  1. clear all; echo on;

    clear all has the side effect of removing debugging breakpoints and resetting persistent variables because function breakpoints and persistent variables are cleared whenever the MATLAB file changes or is cleared. Breakpoints within your executable remain after clear. Clearing the MATLAB workspace does not affect your executable.

  2. Now construct the link to your board and processor by entering

    IDE_Obj=ticcs('boardnum',0);
    

    boardnum defines which board the new link accesses. In this example, boardnum is 0. Embedded Coder connects the link to the first, and in this case only, processor on the board. To find the boardnum and procnum values for the boards and simulators on your system, use ccsboardinfo. When you enter the following command at the prompt

    ccsboardinfo
    
  3. To open and load the processor file, change the path for MATLAB software to be able to find the file.

    projname = C:\Temp\EmbIDELinkCCDemos_v4.1\rtdxtutorial\cxx\cxxxp\rtdxtut_sim.pjt
    
    
    outFile = C:\Temp\EmbIDELinkCCDemos_v4.1\rtdxtutorial\cxx\cxxxp\rtdxtut_sim.out
    
    processor_dir = demoPjt.DemoDir 
    
    processor_dir = C:\Temp\EmbIDELinkCCDemos_v4.1\rtdxtutorial\cxx\cxxxp
    
    cd(IDE_Obj,processor_dir); % Go to processor directory
    cd(IDE_Obj,tgt_dir); % Or IDE_Obj.cd(tgt_dir)
    dir(IDE_Obj); % Or IDE_Obj.dir
    

    To load the project file to your processor, enter the following commands at the MATLAB software prompt. getDemoProject is a specialized function for loading Embedded Coder demo files. It is not supported as a standard Embedded Coder function.

    demoPjt = getDemoProject(IDE_Obj,'ccstutorial');
    
    demoPjt.ProjectFile
    
    ans = C:\Temp\EmbIDELinkCCDemos_v4.1\ccstutorial\cxx\cxxxp\ccstut.pjt
    
    
    demoPjt.DemoDir
    
    ans = C:\Temp\EmbIDELinkCCDemos_v4.1\ccstutorial\cxx\cxxxp

    Notice where the demo files are stored on your machine. In general, Embedded Coder software stores the demo project files in

    EmbIDELinkCCDemos_v#.#

    For example, if you are using version 4.1 of Embedded Coder software, the project demos are stored in EmbIDELinkCCDemos_v4.1\. Embedded Coder software creates this folder in a location on your machine where you have write permission. Usually, there are two locations where Embedded Coder software tries to create the demo folder, in the order shown.

    1. In a temporary folder on the C drive, such as C:\temp\.

    2. If Embedded Coder software cannot use the temp folder, you see a dialog box that asks you to select a location to store the demos.

  4. You have reset the folder path to find the tutorial file. Now open the .out file that matches your processor type.

    IDE_Obj.open('rtdxtutorial_xxx.out')
    

    Because open is overloaded for the CCS IDE and RTDX links, this may seem a bit strange. In this syntax, open loads your executable file onto the processor identified by IDE_Obj. Later in this tutorial, you use open with a different syntax to open channels in RTDX.

    In the next section, you use the new link to open and enable communications between MATLAB software and your processor.

Configuring Communications Channels

Communications channels to the processor do not exist until you open and enable them through Embedded Coder and CCS IDE. Opening channels consists of opening and configuring each channel for reading or writing, and enabling the channels.

In the open function, you provide the channel names as strings for the channel name property. The channel name you use is not random. The channel name string must match a channel defined in the executable file. If you specify a string that does not identify an existing channel in the executable, the open operation fails.

In this tutorial, two channels exist on the processor — ichan and ochan. Although the channels are named ichan for input channel and ochan for output channel, neither channel is configured for input or output until you configure them from MATLAB software or CCS IDE. You could configure ichan as the output channel and ochan as the input channel. The links would work just the same. For simplicity, the tutorial configures ichan for input and ochan for output. One more note—reading and writing are defined as seen by the processor. When you write data from MATLAB software, you write to the channel that the processor reads, ichan in this case. Conversely, when you read from the processor, you read from ochan, the channel that the processor writes to:

  1. Configure buffers in RTDX to store the data until MATLAB software can read it into your workspace. Often, MATLAB software cannot read data as quickly as the processor can write it to the channel.

    IDE_Obj.rtdx.configure(1024,4); % define 4 channels of 1024 bytes each
    

    Channel buffers are optional. Adding them provides a measure of insurance that data gets from your processor to MATLAB software without getting lost.

  2. Define one of the channels as a write channel. Use 'ichan' for the channel name and 'w' for the mode. Either 'w' or 'r' fits here, for write or read.

    IDE_Obj.rtdx.open('ichan','w');
    
  3. Now enable the channel you opened.

    IDE_Obj.rtdx.enable('ichan');
    
  4. Repeat steps 2 and 3 to prepare a read channel.

    IDE_Obj.rtdx.open('ochan','r');
    IDE_Obj.rtdx.enable('ochan');
    
  5. To use the new channels, enable RTDX by entering

    IDE_Obj.rtdx.enable;
    

    You could do this step before you configure the channels — the order does not matter.

  6. Reset the global time-out to 20s to provide a little room for error. ticcs applies a default timeout value of 10 s. In some cases this may not be enough.

    IDE_Obj.rtdx.get('timeout')
    ans =
         10
    IDE_Obj.rtdx.set('timeout', 20); % Reset timeout = 20 seconds
    
  7. Check that the timeout property value is now 20s and that your object has a valid configuration for the rest of the tutorial.

    IDE_Obj.rtdx
    
    RTDX Object:
      API version:       1.0
      Default timeout:   20.00 secs
      Open channels:     2
    

Running the Application

To this point you have been doing housekeeping functions that are common to any application you run on the processor. You load the processor, configure the communications, and set up other properties you need.

In this tutorial task, you use a specific application to demonstrate a few of the functions available in Embedded Coder that let you experiment with your application while you develop your prototype. To demonstrate the RTDX readmat, readmsg, and writemsg functions, you write data to your processor for processing, then read data from the processor after processing:

  1. Restart the program you loaded on the processor. restart sets the program counter (PC) to the beginning of the executable code on the processor.

    IDE_Obj.restart
    

    Restarting the processor does not start the program executing. You use run to start program execution.

  2. Type IDE_Obj.run('run');

    Using 'run' for the run mode tells the processor to continue to execute the loaded program continuously until it receives a halt directive. In this mode, control returns to MATLAB software so you can work in MATLAB software while the program runs. Other options for the mode are

    • 'runtohalt' — start to execute the program and wait to return control to MATLAB software until the process reaches a breakpoint or execution terminates.

    • 'tohalt' — change the state of a running processor to 'runtohalt' and wait to return until the program halts. Use tohalt mode to stop the running processor cleanly.

  3. Type the following functions to enable the write channel and verify that the enable takes effect.

    IDE_Obj.rtdx.enable('ichan');
    IDE_Obj.rtdx.isenabled('ichan')
    

    If MATLAB software responds ans = 0 your channel is not enabled and you cannot proceed with the tutorial. Try to enable the channel again and verify the status.

  4. Write some data to the processor. Check that you can write to the processor, then use writemsg to send the data. You do not need to enter the if-test code shown.

    if IDE_Obj.rtdx.iswritable('ichan'),  % Used in a script application.
        disp('writing to processor...') % Optional to display progress.
        indata=1:10
        IDE_Obj.rtdx.writemsg('ichan', int16(indata))
    end  % Used in scripts for channel testing.
    

    The if statement simulates writing the data from within a MATLAB software script. The script uses iswritable to check that the input channel is functioning. If iswritable returns 0 the script would skip the write and exit the program, or respond in some way. When you are writing or reading data to your processor in a script or MATLAB file, checking the status of the channels can help you avoid errors during execution.

    As your application runs you may find it helpful to display progress messages. In this case, the program directed MATLAB software to print a message as it reads the data from the processor by adding the function

    disp('writing to processor...')
    

    Function IDE_Obj.rtdx.writemsg('ichan', int16(indata)) results in 20 messages stored on the processor. Here's how.

    When you write indata to the processor, the following code running on the processor takes your input data from ichan, adds one to the values and copies the data to memory:

    while ( !RTDX_isInputEnabled(&ichan) )  
    
    {/* wait for channel enable from MATLAB */} 
    RTDX_read( &ichan, recvd, sizeof(recvd) );	 
    puts("\n\n Read Completed "); 
    
    for (j=1; j<=20; j++) {   
      for (i=0; i<MAX; i++) {
        recvd[i] +=1;
      }   
      while ( !RTDX_isOutputEnabled(&ochan) )
        { /* wait for channel enable from MATLAB */ }
      RTDX_write( &ochan, recvd, sizeof(recvd) );
     	 while ( RTDX_writing != NULL )
      	{ /* wait for data xfer INTERRUPT DRIVEN for Cxxxx */ }
    } 

    Program int16_rtdx.c contains this source code. You can find the file in a folder in the ..\tidemos\rtdxtutorial folder.

  5. Type the following to check the number of available messages to read from the processor.

    num_of_msgs = IDE_Obj.rtdx.msgcount('ochan');
    

    num_of_msgs should be zero. Using this process to check the amount of data can make your reads more reliable by letting you or your program know how much data to expect.

  6. Type the following to verify that your read channel ochan is enabled for communications.

    IDE_Obj.rtdx.isenabled('ochan')
    

    You should get back ans = 0 — you have not enabled the channel yet.

  7. Now enable and verify 'ochan'.

    IDE_Obj.rtdx.enable('ochan');
    IDE_Obj.rtdx.isenabled('ochan')
    

    To show that ochan is ready, MATLAB software responds ans = 1. If not, try enabling ochan again.

  8. Type

    pause(5);
    

    The pause function gives the processor extra time to process the data in indata and transfer the data to the buffer you configured for ochan.

  9. Repeat the check for the number of messages in the queue. There should be 20 messages available in the buffer.

    num_of_msgs = IDE_Obj.rtdx.msgcount('ochan')
    

    With num_of_msgs = 20, you could use a looping structure to read the messages from the queue in to MATLAB software. In the next few steps of this tutorial you read data from the ochan queue to different data formats within MATLAB software.

  10. Read one message from the queue into variable outdata.

    outdata = IDE_Obj.rtdx.readmsg('ochan','int16')
    
    outdata = 
         2     3     4     5     6     7     8     9     10     11
    

    Notice the 'int16' represent option. When you read data from your processor you need to tell MATLAB software the data type you are reading. You wrote the data in step 4 as 16-bit integers so you use the same data type here.

    While performing reads and writes, your process continues to run. You did not need to stop the processor to get the data or send the data, unlike using most debuggers and breakpoints in your code. You placed your data in memory across an RTDX channel, the processor used the data, and you read the data from memory across an RTDX channel, without stopping the processor.

  11. You can read data into cell arrays, rather than into simple double-precision variables. Use the following function to read three messages to cell array outdata, an array of three, 1-by-10 vectors. Each message is a 1-by-10 vector stored on the processor.

    outdata = IDE_Obj.rtdx.readmsg('ochan','int16',3)
    
    outdata = 
    [1x10  int16]  [1x10  int16]  [1x10  int16]
    
  12. Cell array outdata contains three messages. Look at the second message, or matrix, in outdata by using dereferencing with the array.

    outdata{1,2}
    
    outdata = 
         4     5     6     7     8     9     10     11     12     13
    
  13. Read two messages from the processor into two 2-by-5 matrices in your MATLAB workspace.

    outdata = IDE_Obj.rtdx.readmsg('ochan','int16',[2 5],2)
    
    outdata = 
        [2x5 int16]  [2x5 int16]
    

    To specify the number of messages to read and the data format in your workspace, you used the siz and nummsgs options set to [2 5] and 2.

  14. You can look at both matrices in outdata by dereferencing the cell array again.

    outdata{1,:}
    
    ans =
         6     8     10     12     14
         7     9     11     13     15
    ans = 
         7      9     11     13     15
         8     10     12     14     16
    
  15. For a change, read a message from the queue into a column vector.

    outdata = IDE_Obj.rtdx.readmsg('ochan','int16',[10 1])
    
    outdata =
          8
          9
         10
         11
         12
         13
         14
         15
         16
         17
    
  16. Embedded Coder provides a function for reading messages into matrices–readmat. Use readmat to read a message into a 5-by-2 matrix in MATLAB software.

    outdata = readmat(IDE_Obj.rtdx,'ochan','int16',[5 2])
    
    outdata =
         9   14
        10   15
        11   16
        12   17
        13   18
    

    Because a 5-by-2 matrix requires ten elements, MATLAB software reads one message into outdata to fill the matrix.

  17. To check your progress, see how many messages remain in the queue. You have read eight messages from the queue so 12 should remain.

    num_of_msgs = IDE_Obj.rtdx.msgcount('ochan')
    
    num_of_msgs =
        12
    
  18. To demonstrate the connection between messages and a matrix in MATLAB software, read data from 'ochan' to fill a 4-by-5 matrix in your workspace.

    outdata = IDE_Obj.rtdx.readmat('ochan','int16',[4 5])
    
    outdata =
        10   14   18   13   17
        11   15   19   14   18
        12   16   11   15   19
        13   17   12   16   20
    

    Filling the matrix required two messages worth of data.

  19. To verify that the last step used two messages, recheck the message count. You should find 10 messages waiting in the queue.

    num_of_msgs = IDE_Obj.rtdx.msgcount('ochan')
    
  20. Continuing with matrix reads, fill a 10-by-5 matrix (50 matrix elements or five messages).

    outdata = IDE_Obj.rtdx.readmat('ochan','int16',[10 5])
    
    outdata =
        12   13   14   15   16
        13   14   15   16   17
        14   15   16   17   18
        15   16   14   18   19
        16   17   18   19   20
        17   18   19   20   21
        18   19   20   21   22
        19   20   21   22   23
        20   21   22   23   24
        21   22   23   24   25
    
  21. Recheck the number of messages in the queue to see that five remain.

  22. flush lets you remove messages from the queue without reading them. Data in the message you remove is lost. Use flush to remove the next message in the read queue. Then check the waiting message count.

    IDE_Obj.rtdx.flush('ochan',1)
    num_of_msgs = IDE_Obj.rtdx.msgcount('ochan')
    
    num_of_msgs =
    
         4
    
  23. Empty the remaining messages from the queue and verify that the queue is empty.

    IDE_Obj.rtdx.flush('ochan','all')
    

    With the all option, flush discards all messages in the ochan queue.

Closing the Connections and Channels or Cleaning Up

One of the most important programmatic processes you should do in every RTDX session is to clean up at the end. Cleaning up includes stopping your processor, disabling the RTDX channels you enabled, disabling RTDX and closing your open channels. Performing this series of tasks prevents trouble caused by unexpected interactions with remaining handles, channels, and links from earlier development work.

Best practices suggest that you include the following tasks (or an subset that meets your development needs) in your development scripts and programs.

We use several functions in this section; each has a purpose — the operational details in the following list explain how and why we use each one. They are

Use the following procedure to shut down communications between MATLAB software and the processor, and end your session:

  1. Begin the process of shutting down the processor and RTDX by stopping the processor. Type the following functions at the prompt.

    if (isrunning(IDE_Obj))  % Use this test in scripts.
       IDE_Obj.halt;         % Halt the processor.
    end                 % Done.
    

    Your processor may already be stopped at this point. In a script, you might put the function in an if-statement as we have done here. When you direct a stopped processor to halt, the function returns immediately.

  2. You have stopped the processor. Now disable the RTDX channels you opened to communicate with the processor.

    IDE_Obj.rtdx.disable('all');
    

    If required, using disable with channel name and processor identifier input arguments lets you disable only the channel you choose. When you have more than one board or processor, you may find disabling selected channels meets your needs.

    When you finish your RTDX communications session, disable RTDX so that Embedded Coder releases your open channels before you close them.

    IDE_Obj.rtdx.disable;
    
  3. Use one or all of the following function syntaxes to close your open channels. Either close selected channels by using the channel name in the function, or use the all option to close all open channels.

    • IDE_Obj.rtdx.close('ichan') to close your input channel in this tutorial.

    • IDE_Obj.rtdx.close('ochan') to close your output channel in the tutorial.

    • IDE_Obj.rtdx.close('all') to close all of your open RTDX channels, regardless of whether they are part of this tutorial.

    Consider using the all option with the close function when you finish your RTDX work. Closing channels reduces unforeseen problems caused by channel objects that exist but do not get closed when you end your session.

  4. When you created your RTDX object (IDE_Obj = ticcs('boardnum',1) at the beginning of this tutorial, the ticcs function opened CCS IDE and set the visibility to 0. To avoid problems that occur when you close the interface to RTDX with CCS visibility set to 0, make CCS IDE visible on your desktop. The following if statement checks the CCS IDE visibility and changes it if required.

    if IDE_Obj.isvisible,
        IDE_Obj.visible(1);
    end
    

    Visibility can cause problems. When CCS IDE is running invisibly on your desktop, do not use clear all to remove your links for CCS IDE and RTDX. Without a ticcs object that references the CCS IDE you cannot access CCS IDE to change the visibility setting, or close the application. To close CCS IDE when you do not have an existing object, either create a new object to access the CCS IDE, or use Microsoft Windows Task Manager to end the process cc_app.exe, or close the MATLAB software.

  5. You have finished the work in this tutorial. Enter the following commands to close your remaining references to CCS IDE and release the associated resources.

    clear ('all'); % Calls the link destructors to remove all links.
    echo off
    

    clear all without the parentheses removes all variables from your MATLAB workspace.

You have completed the tutorial using RTDX. During the tutorial you

  1. Opened connections to CCS IDE and RTDX and used those connections to load an executable program to your processor.

  2. Configured a pair of channels so you could transfer data to and from your processor.

  3. Ran the executable on the processor, sending data to the processor for processing and retrieving the results.

  4. Stopped the executing program and closed the links to CCS IDE and RTDX.

This tutorial provides a working process for using Embedded Coder and your signal processing programs to develop programs for a range of Texas Instruments processors. While the processor may change, the essentials of the process remain the same.

Listing Functions

To review a complete list of functions and methods that operate with ticcs objects, either CCS IDE or RTDX, enter either of the following commands at the prompt.

help ticcs
help rtdx

If you already have a ticcs object IDE_Obj, you can use dot notation to return the methods for CCS IDE or RTDX by entering one of the following commands at the prompt:

In either instance MATLAB software returns a list of the available functions for the specified link type, including both public and private functions. For example, to see the functions (methods) for links to CCS IDE, enter:

help ticcs

Constructing ticcs Objects

When you create a connection to CCS IDE using the ticcs command, you are creating a "ticcs object for accessing the CCS IDE and RTDX interface". The ticcs object implementation relies on MATLAB software object-oriented programming capabilities.

The discussions in this section apply to the ticcs objects in Embedded Coder.

Like other MATLAB software structures, objects in Embedded Coder have predefined fields called object properties.

You specify object property values by one of the following methods:

For examples of setting ticcs object properties, refer to ticcs.

Example — Constructor for ticcs Objects

The easiest way to create an object is to use the function ticcs to create an object with the default properties. Create an object named IDE_Obj to refer to CCS IDE by entering

IDE_Obj = ticcs

MATLAB software responds with a list of the properties of the object IDE_Obj you created along with the associated default property values.

ticcs object:
  API version      : 1.0
  Processor type   : Cxx
  Processor name   : CPU
  Running?         : No
  Board number     : 0
  Processor number : 0
  Default timeout  : 10.00 secs

  RTDX channels    : 0

Inspecting the output reveals two objects listed—a CCS IDE object and an RTDX object. CCS IDE and RTDX objects cannot be created separately. By design they maintain a member class relationship; the RTDX object is a class, a member of the CCS object class. In this example, IDE_Obj is an instance of the class CCS. If you enter

rx = IDE_Obj.rtdx

rx is a handle to the RTDX portion of the CCS object. As an alias, rx replaces IDE_Obj.rtdx in functions such as readmat or writemsg that use the RTDX communications features of the CCS link. Typing rx at the command line now produces

rx

RTDX channels    : 0

The object properties are described in the function reference, and in more detail in ticcs Object Properties. These properties are set to default values when you construct objects.

ticcs Properties and Property Values

Objects in Embedded Coder software have properties associated with them. Each property is assigned a value. You can set the values of most properties, either when you create the link or by changing the property value later. However, some properties have read-only values. And a few property values, such as the board number and the processor to which the link attaches, become read-only after you create the object. You cannot change those after you create your link.

For more information about using objects and properties, refer to Using Objects in MATLAB Programming Fundamentals.

Overloaded Functions for ticcs Objects

Several functions in this Embedded Coder have the same name as functions in other MathWorks toolboxes or in MATLAB software. These behave similarly to their original counterparts, but you apply these functions directly to an object. This concept of having functions with the same name operate on different types of objects (or on data) is called overloading of functions.

For example, the set command is overloaded for ticcs objects. After you specify your link by assigning values to its properties, you can apply the functions in this toolbox (such as readmat for using RTDX to read an array of data from the processor) directly to the variable name you assign to your object, without specifying your object parameters again.

ticcs Object Properties

Embedded Coder provides an interface to your processor hardware so you can communicate with processors for which you are developing systems and algorithms. Each ticcs object comprises two objects—a CCS IDE object and an RTDX interface object. The objects are not separable; the RTDX object is a subclass of the CCS IDE object. Each of the objects has multiple properties. To configure the interface objects for CCS IDE and RTDX, you set parameters that define details such as the desired board, the processor, the timeout period applied for communications operations, and a number of other values. Because Embedded Coder uses objects to create the interface, the parameters you set are called properties and you treat them as properties when you set them, retrieve them, or modify them.

This section details the properties for the ticcs objects for CCS IDE and RTDX. First the section provides tables of the properties, for quick reference. Following the tables, the section offers in-depth descriptions of each property, its name and use, and whether you can set and get the property value associated with the property. Descriptions include a few examples of the property in use.

MATLAB software users may find much of this handling of objects familiar. Objects in Embedded Coder, behave like objects in MATLAB software and the other object-oriented toolboxes. For C++ programmers, discussion of object-oriented programming is likely to be a review.

Quick Reference to ticcs Object Properties

The following table lists the properties for the ticcs objects in Embedded Coder. The second column tells you which object the property belongs to. Knowing which property belongs to each object in a ticcs object tells you how to access the property.

Property NameApplies to Which Connection?User Settable?Description
apiversion

CCS IDE

No

Reports the version number of your CCS API.

boardnum

CCS IDE

Yes/initially

Specifies the index number of a board that CCS IDE recognizes.

ccsappexe

CCS IDE

No

Specifies the path to the CCS IDE executable. Read-only property.

numchannels

RTDX

No

Contains the number of open RTDX channels for a specific link.

page

CCS IDE

Yes/default

Stores the default memory page for reads and writes.

procnum

CCS IDE

Yes/at start only

Stores the number CCS Setup Utility assigns to the processor.

timeout

CCS IDE

Yes/default

Contains the global timeout setting for the link.

version

RTDX

No

Reports the version of your RTDX software.

Some properties are read only — you cannot set the property value. Other properties you can change at all times. If the entry in the User Settable column is "Yes/initially", you can set the property value only when you create the link. Thereafter it is read only.

Details About ticcs Object Properties

To use the links for CCS IDE and RTDX interface you set values for:

Details of the properties associated with connections to CCS IDE and RTDX interface appear in the following sections, listed in alphabetical order by property name.

Many of these properties are object linking and embedding (OLE) handles. The MATLAB software COM server creates the handles when you create objects for CCS IDE and RTDX. You can manipulate the OLE handles using get, set, and invoke to work directly with the COM interface with which the handles interact.

apiversion.  Property appversion contains a string that reports the version of the application program interface (API) for CCS IDE that you are using when you create a link. You cannot change this string. When you upgrade the API, or CCS IDE, the string changes to match. Use display to see the apiversion property value for a link. This example shows the appversion value for link IDE_Obj.

display(IDE_Obj)

TICCS Object:
  API version      : 1.0
  Processor type   : Cxx
  Processor name   : CPU
  Running?         : No
  Board number     : 0
  Processor number : 0
  Default timeout  : 10.00 secs

  RTDX channels    : 0

Note that the API version is not the same as the CCS IDE version.

boardnum.  Property boardnum identifies the board referenced by the IDE handle object for CCS. When you create a link, you use boardnum to specify the board you are using. To get the value for boardnum, use ccsboardinfo or the CCS Setup utility from Texas Instruments software. The CCS Setup utility assigns the number for each board installed on your system.

ccsappexe.  Property ccsappexe contains the path to the CCS IDE executable file cc_app.exe. When you use ticcs to create a link, MATLAB software determines the path to the CCS IDE executable and stores the path in this property. This is a read-only property. You cannot set it.

numchannels.  Property numchannels reports the number of open RTDX communications channels for an RTDX link. Each time you open a channel for a link, numchannels increments by one. For new links numchannels is zero until you open a channel for the link.

To see the value for numchannels create a link to CCS IDE. Then open a channel to RTDX. Use display to see the RTDX link properties.

IDE_Obj=ticcs

TICCS Object:
  API version      : 1.0
  Processor type   : Cxx
  Processor name   : CPU
  Running?         : No
  Board number     : 0
  Processor number : 0
  Default timeout  : 10.00 secs

  RTDX channels    : 0

rx=IDE_Obj.rtdx

  RTDX channels    : 0

open(rx,'ichan','r','ochan','w');

get(IDE_Obj.rtdx)

ans = 

    numChannels: 2
           Rtdx: [1x1 COM ]
    RtdxChannel: {''  ''  ''}
       procType: 103
        timeout: 10

page.  Property page contains the default value CCS IDE uses when the user does not specify the page input argument in the syntax for a function that access memory.

procnum.  Property procnum identifies the processor referenced by the IDE handle object for CCS. When you create an object, you use procnum to specify the processor you are using . The CCS Setup Utility assigns a number to each processor installed on each board. To determine the value of procnum for a processor, use ccsboardinfo or the CCS Setup utility from Texas Instruments software.

To identify a processor, you need both the boardnum and procnum values. For boards with one processor, procnum equals zero. CCS IDE numbers the processors on multiprocessor boards sequentially from 0 to the number of processors. For example, on a board with four processors, the processors are numbered 0, 1, 2, and 3.

rtdx.  Property rtdx is a subclass of the ticcs link and represents the RTDX portion of the IDE handle object for CCS. As shown in the example, rtdx has properties of its own that you can set, such as timeout, and that report various states of the link.

get(IDE_Obj.rtdx)

ans = 

        version: 1
    numChannels: 0
           Rtdx: [1x1 COM ]
    RtdxChannel: {''  []  ''}
       procType: 103
        timeout: 10

In addition, you can create an alias to the rtdx portion of a link, as shown in this code example.

rx=IDE_Obj.rtdx

  RTDX channels    : 0

Now you can use rx with the functions in Embedded Coder, such as get or set. If you have two open channels, the display looks like the following example:

get(rx)

ans = 

    numChannels: 2
           Rtdx: [1x1 COM ]
    RtdxChannel: {2x3 cell}
       procType: 98
        timeout: 10

rtdxchannel.  Property rtdxchannel, along with numchannels and proctype, is a read-only property for the RTDX portion of the IDE handle object for CCS. To see the value of this property, use get with the link. Neither set nor invoke work with rtdxchannel.

rtdxchannel is a cell array that contains the channel name, handle, and mode for each open channel for the link. For each open channel, rtdxchannel contains three fields, as follows:

.rtdxchannel{i,1}

Channel name of the ith-channel, i from 1 to the number of open channels

.rtdxchannel{i,2}

Handle for the ith-channel

.rtdxchannel{i,3}

Mode of the ith-channel, either 'r' for read or 'w' for write

With four open channels, rtdxchannel contains four channel elements and three fields for each channel element.

timeout.  Property timeout specifies how long CCS IDE waits for any process to finish. Two timeout periods can exist — one global, one local. You set the global timeout when you create the IDE handle object for CCS. The default global timeout value 10 s. However, when you use functions to read or write data to CCS IDE or your processor, you can set a local timeout that overrides the global value. If you do not set a specific timeout value in a read or write process syntax, the global timeout value applies to the operation. Refer to the help for the read and write functions for the syntax to set the local timeout value for an operation.

version.  Property version reports the version number of your RTDX software. When you create a ticcs object, version contains a string that reports the version of the RTDX application that you are using. You cannot change this string. When you upgrade the API, or CCS IDE, the string changes to match. Use display to see the version property value for a link. This example shows the apiversion value for object rx.

get(rx) % rx is an alias for IDE_Obj.rtdx.

ans = 

        version: 1
    numChannels: 0
           Rtdx: [1x1 COM ]
    RtdxChannel: {''  []  ''}
       procType: 103
        timeout: 10
  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS