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.

Built-in Functions<br />

output_low(PIN_B0);<br />

delay_us(period-duty);<br />

} while(TRUE);<br />

Example Files:<br />

Also See:<br />

ex_sqw.c<br />

delay_ms(), delay_cycles(), #USE DELAY<br />

disable_interrupts( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

disable_interrupts (level)<br />

level - a constant defined in the devices .h file<br />

undefined<br />

Disables the interrupt at the given level. The GLOBAL level will not disable any<br />

of the specific interrupts but will prevent any of the specific interrupts,<br />

previously enabled to be active. Valid specific levels are the same as are used<br />

in #INT_xxx and are listed in the devices .h file. GLOBAL will also disable the<br />

peripheral interrupts on devices that have it. Note that it is not necessary to<br />

disable interrupts inside an interrupt service routine since interrupts are<br />

automatically disabled. Some chips that have interrupt on change for<br />

individual pins allow the pin to be specified like INT_RA1.<br />

Device with interrupts (<strong>PCM</strong> and <strong>PCH</strong>)<br />

Should have a #INT_xxxx, constants are defined in the devices .h file.<br />

disable_interrupts(GLOBAL); // all interrupts OFF<br />

disable_interrupts(INT_RDA); // RS232 OFF<br />

enable_interrupts(ADC_DONE);<br />

enable_interrupts(RB_CHANGE);<br />

// these enable the interrupts<br />

// but since the GLOBAL is disabled they<br />

// are not activated until the following<br />

// statement:<br />

enable_interrupts(GLOBAL);<br />

Example Files:<br />

Also See:<br />

ex_sisr.c, ex_stwt.c<br />

enable_interrupts(), clear_interrupt (), #INT_xxxx, Interrupts Overview,<br />

interrupt_active()<br />

173

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

Saved successfully!

Ooh no, something went wrong!