| Embedded IDE Link™ CC | ![]() |
Change object represent property from one data type to another
convert(objname,datatype)
convert(objname,datatype,size)
convert(objname,datatype) returns objname with the represent property changed to the data type specified by datatype. Input argument datatype can be any supported data type. After you change the data type specified in represent, read or write operations apply the appropriate data conversion to implement on the target the data type specified by the represent property.
Note pointer and rpointer objects respond differently when you use convert. Refer to Using convert with pointer and rpointer Objects for more information about the supported data types for pointer or rpointer objects and how convert behaves with different data types. |
The following data types work as input arguments to convert.
| datatype String | represent Property Value |
|---|---|
'double' | 'float' |
'single' | 'float' |
'int32' | 'signed' |
'int16' | 'signed' |
'int8' | 'signed' |
'uint32' | 'unsigned' |
'uint16' | 'unsigned' |
'uint8' | 'unsigned' |
'long double' | 'float' |
'float' | 'float' |
'long' | 'signed' |
'int' | 'signed' |
'char' | 'signed'/'unsigned' |
'unsigned long' | 'signed' |
'unsigned int' | 'unsigned' |
'unsigned char' | 'unsigned' |
'Q0.15' | 'fract' |
'Q0.31' | 'fract' |
Various Texas Instruments™ processors restrict the sizes of the data types used by objects in Embedded IDE Link™ CC. Shown in the next table, the processor families restrict the valid word sizes for the listed data types.
Word Size Limits for Supported Processors
| represent Property Value | TI's C2000™ Processors | TI's C54x™ Processors | TI's C55x™ Processors | TI's C6000™ Processors |
|---|---|---|---|---|
'float' | 32 bits | 32 bits | 32 bits | 32, 64 bits |
'signed' | 16, 32 bits | 16, 32 bits | 16, 32, 40, 64 bits | 8, 16, 32, 40, 64 bits |
'unsigned' | 16, 32 bits | 16, 32 bits | 16, 32, 40, 64 bits | 8, 16, 32, 40, 64 bits |
'fract' | 16, 32bits | 16, 32 bits | 16, 32 | 16, 32 bits |
Using the properties of the objects, you change the word size by changing the value of the storageunitspervalue property of the object. Note that you cannot change the bitsperstorageunit property value, which depends on the processor and whether the object represents a memory location or a register.
Pointer objects, both data and numeric, usually use fewer than 32 bits, such as 22 or 23 bits, but are incorporated in 32-bit words.
convert applies to any object that has the represent property. function, ticcs, and rtdx objects do not use the represent property and do not support convert.
convert(objname,datatype,size) returns objname with the specified data type for the represent property, and the size property value set to size.
Note convert does not support pointers to void, that is, pointers of the form void *. Before you convert a pointer to void, change the pointer to a valid data type, such as int * or char *. |
When you convert a pointer object, the results depend on the data type you specify to convert to in the syntax:
When you specify a valid pointer type for your converted pointer or rpointer object, convert changes the data type of the pointer and it remains a pointer.
When you specify a nonpointer data type for your converted object, convert changes the referent or regstring properties of your pointer object, changing the data type of the referent (the value the pointer refers to) and your object is no longer a pointer. Therefore, use convert to change pointer or rpointer objects to nonpointer objects. You can convert to any data type, such as:
All C native data types without the asterisk that indicates this is a pointer
enum (enumerated)
string
struct
Working with pointer objects and register pointer (rpointer) objects is slightly different from using convert with numeric objects.
![]() | configure | copy | ![]() |
| © 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 |