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.

INT_OSC_FAIL or INT_OSCF Interrupt fires when the system oscillator fails and the processor<br />

switches to the internal oscillator.<br />

Relevant Include Files:<br />

None, all functions built-in<br />

Relevant getenv()<br />

parameters:<br />

None<br />

Example Code:<br />

For PIC18F8722<br />

setup_oscillator(OSC_32MHZ); //sets the internal oscillator to 32MHz (PLL enabled)<br />

If the internal oscillator fuse option are specified in the #fuses and a valid clock is specified in<br />

the #use delay(clock=xxx) directive the compiler automatically sets up the oscillator. The #use<br />

delay statements should be used to tell the compiler about the oscillator speed.<br />

Interrupts<br />

The following functions allow for the control of the interrupt subsystem of the microcontroller.<br />

With these functions, interrupts can be enabled, disabled, and cleared. With the preprocessor<br />

directives, a default function can be called for any interrupt that does not have an associated<br />

ISR, and a global function can replace the compiler generated interrupt dispatcher.<br />

Relevant Functions:<br />

disable_interrupts()<br />

enable_interrupts()<br />

ext_int_edge()<br />

clear_interrupt()<br />

interrupt_active()<br />

interrupt_enabled()<br />

Relevant Preprocessor:<br />

#DEVICE HIGH_INTS=<br />

#INT_XXX fast<br />

Disables the specified interrupt.<br />

Enables the specified interrupt.<br />

Enables the edge on which the edge interrupt should trigger. This<br />

can be either rising or falling edge.<br />

This function will clear the specified interrupt flag. This can be<br />

used if a global isr is used, or to prevent an interrupt from being<br />

serviced.<br />

This function checks the interrupt flag of specified interrupt and<br />

returns true if flag is set.<br />

This function checks the interrupt enable flag of the specified<br />

interrupt and returns TRUE if set.<br />

This directive tells the compiler to generate code for high priority<br />

interrupts.<br />

This directive tells the compiler that the specified interrupt should<br />

56

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

Saved successfully!

Ooh no, something went wrong!