datatypemanager - Open Data Type Manager

Syntax

datatypemanager(cc)
cc2 = datatypemanager(cc)

Description

datatypemanager(cc) opens the Data Type Manager (DTM) with data type information about the project to which cc refers. With the type manager open, you can add type definitions (typedefs) from your project to MATLAB® software so it can interpret them. You add your typedefs because MATLAB software cannot determine or understand typedefs in your function prototypes remotely across the interface to CCS.

Each custom type definition in your prototype must appear on the Typedef name (Equivalent data type) list before you can use the typedef from MATLAB software with a function object.

When the DTM opens, a variety of information and options displays in the Data Type Manager dialog box:

cc2 = datatypemanager(cc) returns the cc2 ticcs object while it opens the DTM. cc2 represents an alias to cc. Objects cc and cc2 are not independent objects. When you change a property of either cc or cc2, the corresponding property in the other object changes as well.

Data Type Manager

When you create objects that access functions in a project, MATLAB software can recognize most data types that you use in your project. However, if the functions use one or more custom type definitions, MATLAB software cannot recognize the data type and cannot work with the function. To overcome this problem, the Data Type Manager provides the capability to define your typedefs to MATLAB software.

Entering

datatypemanager(cc)

at the MATLAB prompt opens the DTM.

Before you add a type definition, the Typedef name (Equivalent data type) list shows a number of data types already defined:

The lowercase versions of the data types appear because MATLAB software does not recognize the initial capital versions automatically. In the data type entry, the project data type with the initial capital letter is mapped to the lowercase MATLAB software data type.

Although not recommended, you can use mixed case typedef names, so long as the equivalent data type uses lowercase. In particular, typedefs that refer to other typedefs should resolve to a data type in lowercase.

Adding a type definition adds the new data type to the list of typedefs.

Remove any existing or new type definitions with the Remove typedef option.

Add Typedef Dialog Box

Clicking Add typedef in the DTM opens the List of Known Data Types dialog box. As shown in this figure, you add your custom type definitions here.

When you have used custom type definitions in your program or project, you must specify what they mean to MATLAB software. The Typedef option lets you enter the name of the typedef in your program and select an equivalent type from the Known Types list. By defining your type definitions in this dialog box, you enable MATLAB software to understand and work with them. For example, when you return the data to the MATLAB workspace or send data from the workspace to your project.

After you define each typedef, the Equivalent type option shows you the type you specified for each type definition, either when you enter it in the Typedef field or select it from the Known Types list.

Options in this dialog box let you review the data types you are using or that are available in your projects. By selecting different data type categories from the Known Types list, you can see all of the supported data types.

From the list of known data types, choose one of the following data type categories:

Custom type definitions can refer to other typedefs in your project. Nesting typedefs works after you have defined the necessary custom types. To create a typedef that uses another typedef, define the nested (inner) definition, and then define the outer definition as a pointer to the nested definition. Refer to Examples to see this in operation.

Program loaded — tells you the name of the program loaded on the processor, if you loaded the program from this dialog box. If not, Program loaded does not report the program name.

Load CCS Program — opens the Load Program dialog box so you can select and load a .out file to your processor.

Examples

This set of examples show how to create custom type definitions with the DTM. Each example shows the List of Known Data Types dialog box with the selections or entries needed to create the typedef.

Start the examples by creating a ticcs object:

cc=ticcs;

Now start the DTM with the cc object. So far you have not loaded a file on the target.

datatypemanager(cc);

With the DTM open, you can create a few custom data types.

First example

Create a typedef (typedef1) that uses a MATLAB software data type. typedef1 uses the equivalent data type uint32.

Second example

Create a second typedef (typedef2) that uses one of the TI C data types. Define typedef2 to use the signed long data type.

Third example

Create a typedef (typedef3) that refers to another typedef (typedef2). Call this a nested typedef.

Notice that the referenced typedef, typedef2, is entered as a pointer (indicated by the added asterisk). Using the pointer form lets MATLAB software recognize the data type that typedef2 represents. If you do not use the pointer, MATLAB software converts typedef3 to a default value equivalent data type, in this case, int.

The next figure shows typedef4 created to use typedef2 rather than typedef2* for a nested typedef. Under Equivalent type, typedef4 has an equivalent data type of typedef2, as specified. But, when you look at the list of known data types in the Data Type Manager dialog box, you see that typedef4 maps to int, not typedef2, or eventually signed long.

Here is the DTM after you create all the example custom data types. Take note of typedef4 in this listing. You see typedef4 defaults to an equivalent data type int, where typedef3, also a nested type definition, retains the equivalent data type you assigned. Now you are ready to use a function that includes your custom type definitions in your hardware-in-the-loop development work.

See Also

createobj

  


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