| Embedded IDE Link™ CC | ![]() |
datatypemanager(cc)
cc2 = datatypemanager(cc)
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:
Typedef name (Equivalent data type) — provides a list of default data types. When you create a typedef, it appears added to this list.
Add typedef — opens the Add Typedef dialog box so you can add one or more typedefs to your project. Your added typedef appears on the Typedef name (Equivalent data type) list. Also, when you pass the cc object to the DTM, and then add a typedef, the command
cc.type
returns a list of the data types in the object including the typedefs you added.
Remove typedef — removes a selected typedef from the Typedef name (Equivalent data type) list.
Load session — loads a previously saved session so you can use the typedefs you defined earlier without reentering them.
Refresh list — updates the list in Typedef name (Equivalent data type). Refreshing the list ensures the contents are current. If you changed your project data type content or loaded a new project, this updates the type definitions in the DTM.
Close — closes the DTM and prompts you to save the session information. This is the only way to save your work in this dialog box. Saving the session creates an M-file you can reload into the DTM later.
Clicking Close in the DTM prompts you to save your session. Saving the session creates an M-file that contains operations that create your final list of data types, identical to the data types in the Typedef name list.
In the stored M-file, you find a function that includes the add and remove operations you used to create the list of data types in the DTM. For each time you added a typedef in the DTM, the M-file contains an add command that adds the new type definition to the cc.type property of the object. When you remove a data type, you see an equivalent clear command that removes a data type from the cc.type object.
Note All of your operations that add and remove data types in the DTM during a session are stored in the generated M-file that you save. Saving the operations has the effect of storing any mistakes you make while creating or removing type definitions. One consequence of storing mistakes is that when you load your saved session into the DTM, you see the same error messages you saw when you created the data types in the session. |
The first line of the M-file is a function definition, where the name of the function is the filename of the session you saved.
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.
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:
Void(void) — void return argument for a function
Float(float) — float data type used in a function input or return argument
Double(double) — double data type used in a function input or return argument
Long(long) — long data type used in a function input or return argument
Int(int) — int data type used in a function input or return argument
Short(short) — short data type used in a function input or return argument
Char(char) — character data type used in a function input or return argument
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.
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:
MATLAB Types
| Data Type | Description |
|---|---|
int8 | 8-bit integer data |
uint8 | unsigned 8-bit integer data |
int16 | 16-bit integer data |
uint16 | unsigned 16-bit integer data |
int32 | 32-bit integer data |
uint32 | unsigned 32-bit integer data |
int64 | 64-bit integer data |
uint64 | unsigned 64-bit integer data |
single | 32-bit IEEE® floating-point data |
double | 64-bit IEEE floating-point data |
TI C Types
| Data Type | Description (For C6000™ Compiler) |
|---|---|
char | 8-bit character data with a sign bit |
unsigned char | 8-bit character data |
signed char | 8-bit character data |
short | 16-bit numeric data |
unsigned short | unsigned 16-bit numeric data |
signed short | 16-bit numeric data with sign designation |
int | 32-bit integer numeric data |
unsigned int | 32-bit integer numerics without sign information |
signed int | 32-bit integer numerics with sign information |
long | 40-bit data with sign bit. Note that this is not the same as int. |
unsigned long | 40-bit data without information about the sign of the number |
signed long | 40-bit data without information about the sign of the number represented |
float | 32-bit numeric data |
double | 64-bit numeric data |
long double | On the C2000™ and C5000™ processors – 32-bit IEEE floating-point data On the C6000 processors – 64-bit IEEE floating-point data |
Numbers of bits change depending on the processor and compiler. For more information about Texas Instruments™ data types and specific processors or compilers, refer to your compiler documentation from Texas Instruments processors.
TI Fixed-Point Types
| Data Type | Description |
|---|---|
Q0.15 | Numeric data with 16-bit word length and 15-bit fraction length |
Q0.31 | 32-bit word length numeric data with fraction length of 31 bits |
Struct, Union, Enum types
If the program you load on the processor includes one or more of struct, union, or enum data types, the type definitions show up on this list. Until you load a program on the processor, this list is empty and trying to access the list generates an error message.
Load a program, if you have not already done so, by clicking Load CCS Program and selecting a .out file to load on your processor.
When the load process works, you see the name of the file you loaded in Loaded program. Otherwise you get an error message that the load failed.
Only programs that you load from this dialog box appear in Program loaded. Programs that you already loaded on your target do not appear in the Loaded program option. MATLAB software cannot determine what program you have loaded.
Others such as pointers and typedefs
Like struct, union, and enum data types, the Others list is empty until you define one or more typedefs. Unlike the Struct, Union, Enum types list, loading a program does not populate this list with typedefs from the program. You must define them explicitly in this dialog box.
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.
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.
Create a typedef (typedef1) that uses a MATLAB software data type. typedef1 uses the equivalent data type uint32.

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

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.

![]() | createobj | declare | ![]() |
| © 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 |