17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SEE ALSO: Declarations, Type Specifiers, Type Qualifiers, Enumerated Types,<br />

typedef, Named Registers<br />

typedef<br />

If typedef is used with any of the basic or special types it creates a<br />

new type name that can be used in declarations. The identifier<br />

does not allocate space but rather may be used as a type specifier<br />

in other data definitions.<br />

typedef<br />

[type-qualifier] [type-specifier] [declarator];<br />

For example:<br />

typedef int mybyte;<br />

typedef short mybit;<br />

typedef enum {red,<br />

green=2,blue}colors;<br />

// mybyte can be used in declaration<br />

to<br />

// specify the int type<br />

// mybyte can be used in declaration<br />

to<br />

// specify the int type<br />

//colors can be used to declare<br />

//variable of this enum type<br />

SEE ALSO: Declarations, Type Specifiers, Type Qualifiers, Structures & Unions,<br />

Enumerated Types, Named Registers<br />

Non-RAM Data Definitions<br />

<strong>CCS</strong> C compiler also provides a custom qualifier addressmod which can<br />

be used to define a memory region that can be RAM, program eeprom,<br />

data eeprom or external memory. Addressmod replaces the older<br />

typemod (with a different syntax).<br />

The usage is :<br />

addressmod<br />

(name,read_function,write_function,start_address,end_<br />

address, share);<br />

Where the read_function and write_function should be blank for RAM, or<br />

for other memory should be the following prototype:<br />

// read procedure for reading n bytes from the memory starting at location addr<br />

32

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!