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.

Data Definitions<br />

For example:<br />

Places 1,2,3,4 to ROM addresses starting at 0x1000<br />

#rom 0x1000 = {1, 2, 3, 4}<br />

Places null terminated string in ROM<br />

#rom 0x1000={"hello"}<br />

This method can only be used to initialize the program memory.<br />

Built-in-Functions:<br />

The compiler also provides built-in functions to place data in program memory, they are:<br />

write_program_eeprom(address,data);<br />

- Writes data to program memory<br />

write_program_memory(address, dataptr, count);<br />

- Writes count bytes of data from dataptr to address in program memory.<br />

-<br />

Please refer to the help of these functions to get more details on their usage and limitations<br />

regarding erase procedures. These functions can be used only on chips that allow writes to<br />

program memory. The compiler uses the flash memory erase and write routines to implement<br />

the functionality.<br />

The data placed in program memory using the methods listed above can be read from width the<br />

following functions:<br />

read_program_memory((address, dataptr, count)<br />

- Reads count bytes from program memory at address to RAM at dataptr.<br />

These functions can be used only on chips that allow reads from program memory. The<br />

compiler uses the flash memory read routines to implement the functionality.<br />

Named Registers<br />

The <strong>CCS</strong> C <strong>Compiler</strong> supports the new syntax for filing a variable at the location of a<br />

processor register. This syntax is being proposed as a C extension for embedded<br />

use. The same functionality is provided with the non-standard #byte, #word, #bit<br />

and #locate.<br />

The syntax is:<br />

register _name type id;<br />

Or<br />

register constant type id;<br />

name is a valid SFR name with an underscore before it.<br />

Examples:<br />

register _status int8 status_reg;<br />

register _T1IF int8 timer_interrupt;<br />

register 0x04 int16 file_select_register;<br />

35

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

Saved successfully!

Ooh no, something went wrong!