PIC 16F684 Processing Microcontroller Interupt

I just finished my microprocessor class in college just a few weeks ago, where we only programmed the assembly. We learned about the fair amount (IMHO) of the interruptions.

Here's my question: I program in C using the HiTech Compiler for 16F684, the Datasheet section, which discusses interrupts ( PIC 16F684 Datasheet in section 12.4), says that the program will go to the 0x0004 interrupt vector. Using the assembly in my microprocessor class, we just installed the .org operator, pointing to this address, and write the necessary assembly below, so when an interrupt occurs, it will jump there and start. I can understand this in the assembly, but when I program in C, I do not believe that I have control over where the program fragments are stored in memory, which is a problem. I cannot figure out how to place commands on an interrupt in C.

Please let me know if I need to clarify!

+4
source share
4 answers

This Microchip FAQ contains some information on using interrupts under HiTech C.

+3
source

HiTech C extends C using the interrupt function type:

 void interrupt my_interrupt_handler (void) { handle_interrupts_here(); } 

You really need to get a compiler guide. I believe the Pic-lite manual is free to download, at least that was when I downloaded my copy for a while in 2001.

+3
source

You will have to delve into the HiTech documentation, but often compilers have special keywords for defining interrupt functions. The compiler or runtime system must deal with a function caused by a special interrupt: in addition to vector tuning, the compiler (or the runtime system) must save all registers. Perhaps this is not necessary for a normal function without interruption.

The allowance will be your friend.

+1
source

The CCS compiler for PIC uses the # INT_ * compiler directives or 'attributes' for interrupt functions for various interrupt sources.

0
source

All Articles