next up previous contents index
Next: 4.5 The PIC16 port Up: 4.4 The PIC14 port Previous: 4.4.2 Creating a device   Contents   Index

4.4.3 Interrupt code

For the interrupt function, use the keyword 'interrupt' with level number of 0 (PIC14 only has 1 interrupt so this number is only there to avoid a syntax error - it ought to be fixed). E.g.:

void Intr(void) interrupt 0 
{ 
  T0IF = 0; /* Clear timer interrupt */ 
}
Linking and assembling
For assembling you can use either GPUTILS' gpasm.exe or MPLAB's mpasmwin.exe. For linking you can use either GPUTIL's gplink or MPLAB's mplink.exe. If you use MPLAB and an interrupt function then the linker script file vectors section will need to be enlarged to link with mplink.

Here is a Makefile using GPUTILS:

.c.o: 
        sdcc -S -V -mpic14 -p16F877 $<  
        gpasm -c $*.asm 
 
$(PRJ).hex: $(OBJS)  
        gplink -m -s $(PRJ).lkr -o $(PRJ).hex $(OBJS)
Here is a Makefile using MPLAB:

.c.o:  
        sdcc -S -V -mpic14 -p16F877 $<  
        mpasmwin /q /o $*.asm 
 
$(PRJ).hex: $(OBJS)  
        mplink /v $(PRJ).lkr /m $(PRJ).map /o $(PRJ).hex $(OBJS)


next up previous contents index
Next: 4.5 The PIC16 port Up: 4.4 The PIC14 port Previous: 4.4.2 Creating a device   Contents   Index
Bernhard Held 2004-02-21