SW006010 Microchip Technology, SW006010 Datasheet - Page 61

no-image

SW006010

Manufacturer Part Number
SW006010
Description
MPLAB 17C SOFTWARE
Manufacturer
Microchip Technology
Datasheets

Specifications of SW006010

Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC17C
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
MPLAB®
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
 2002 Microchip Technology Inc.
The ALUSTA, PCLATH, BSR and WREG are the registers that absolutely need to be
saved before we branch to the interrupt service function. However, there are other
registers used by the compiler that are worth saving under certain circumstances. The
following is an example that uses the Timer 0 Overflow Interrupt.
#include <p17c44.h>
unsigned char x;
void _ _TMR0()
{
}
void main()
{
// Install interrupt handler for timer 0 interrupt
// Set prescale value for TMR0
// Unmask TMR0 overflow interrupt
// Enable all unmasked interrupts
// Set Port B in o/p mode
}
Install
Timer 0 overflow interrupts. Then the appropriate prescale value, interrupt flag and
global interrupt enable flag are set. The program enters into an infinite loop when it
reaches the
the
displayed on LEDs.
x++;
PORTB = x;
x = 1;
Install_TMR0(_ _TMR0);
T0STA = 0b11100110;
INTSTA = 0b00000010;
CPUSTA = 0;
TRISB = 0;
while(1)
{
// Loop and wait for an interrupt to take place!
}
_ _TMR0()
_TMR0 (_ _TMR0)
while(1)
function where the value of ‘x’ is sent to PORT B and possibly
statement. When Timer 0 overflows, program control goes to
sets the function
_ _TMR0()
Runtime Environment
as the interrupt handler for
apRNOVM^-page 55
Part
Part
Part
Part
1
2
3
4

Related parts for SW006010