CCS News

Tech Note: New Microchip 12-bit Parts Have Interrupt Capability

Wednesday 12 March, 2014

Microchip Technology's newest 12-bit PIC® MCUs include the long awaited feature of interrupts in the baseline family. The PIC16F527 and PIC16F570 have Timer 0, ADC, Comparator and Interrupt on interrupts and are fully supported in the latest version of the CCS Compiler. Interrupts can be enabled, disabled, and interrupt service routines are created the same way in the PCB compiler as they are in PCM, PCH and PCD compilers.

The defines INT_TIMER0, INT_AD, INT_COMP and INT_RA, for PIC16F527, or INT_RB, for PIC16F570, are added to the device's header file. Using one of the previous defines with the '#' sign in front of it is used to create the interrupt service routine for that interrupt. Also passing one of the defines to the enable_interrupts() or disable_interrupts() functions is used to enable or disable that interrupt. Finally, GLOBAL is used in the enable_interrupts() or disable_interrupts() functions to enable or disable the device's global interrupt. The following is an example of using the Timer 0 interrupt on a PIC16F527 to toggle PIN_A5 at a rate of approximately once every 250 ms:



Like us on Facebook. Follow us on Twitter.

About CCS:

CCS is a leading worldwide supplier of embedded software development tools that enable companies to develop premium products based on Microchip PIC® MCU and dsPIC® DSC devices. Complete proven tool chains from CCS include a code optimizing C compiler, application specific hardware platforms and software development kits. CCS' products accelerate development of energy saving industrial automation, wireless and wired communication, automotive, medical device and consumer product applications. Established in 1992, CCS is a Microchip Premier 3rd Party Partner. For more information, please visit http://www.ccsinfo.com.

PIC® MCU, MPLAB® IDE, MPLAB® ICD2, MPLAB® ICD3 and dsPIC® are registered trademarks of Microchip Technology Inc. in the U.S. and other countries.