17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PreProcessor<br />

The compiler will set the access bit depending on the value of the file register.<br />

If there is just a variable identifier in the #asm block then the<br />

compiler inserts an & before it. And if it is an expression it must be<br />

a valid C expression that evaluates to a constant (no & here). In C<br />

an un-subscripted array name is a pointer and a constant (no need<br />

for &).<br />

#bit<br />

Syntax:<br />

Elements:<br />

#BIT id = x.y<br />

id is a valid C identifier,<br />

x is a constant or a C variable,<br />

y is a constant 0-7<br />

Purpose:<br />

A new C variable (one bit) is created and is placed in memory at byte x and bit y. This<br />

is useful to gain access in C directly to a bit in the processors special function register<br />

map. It may also be used to easily access a bit of a standard C variable.<br />

Examples:<br />

#bit T0IF = 0x b.2<br />

...<br />

T1IF = 0; // Clear Timer 0 interrupt flag<br />

int result;<br />

#bit result_odd = result.0<br />

...<br />

if (result_odd)<br />

Example<br />

Files:<br />

Also See:<br />

ex_glint.c<br />

#BYTE, #RESERVE, #LOCATE, #WORD<br />

#build<br />

Syntax:<br />

Elements:<br />

#BUILD(segment = address)<br />

#BUILD(segment = address, segment = address)<br />

#BUILD(segment = start:end)<br />

#BUILD(segment = start: end, segment = start: end)<br />

#BUILD(nosleep)<br />

segment is one of the following memory segments which may be assigned a<br />

location: MEMORY, RESET, or INTERRUPT<br />

95

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

Saved successfully!

Ooh no, something went wrong!