Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service
   Home P&E Customer Support FAQs - Frequently Asked Questions FAQ ID # 49
FAQ ID # 49
 
Question
My interrupts don't seem to be working and I'm using an HC(S)12 with paged FLASH. How can I get them to function properly?
 
Answer
Due to the nature of the paged architecture, you should be certain that your interrupt vectors point to a fixed page of flash. (eg, $C000). When your code is executing, the PPAGE register may be set to any number of values-- and, when writing your code, there is no way to determine where the PPAGE will be pointing when an interrupt occurs! Your interrupt vector will always point to a word address-- eg, $8000. If you've created your interrupt handler on page 1, $8000, and your code is executing at page 4, $8000, and an interrupt occurs, the program counter will jump to address page 4, $8000-- and, of course, the processor will "get lost". The recommended manner for handling interrupts would be to have all interrupt vectors point to a fixed flash page. You can either handle the interrupts in that location, or use a "call" (or similar) instruction to jump to the correct page/address. (keep in mind that "call" instructions affect the stack and should be ended with an "rtc" instruction to restore the stack pointer to its previous value). See the Demo Code below for an overview of using the paged architecture.
 
Related Downloads
HC12/HCS12 Assembly Paging Example (MC9S12DP256) - A small assembly program demonstrating how to build a paged application with PEmicro's assembler.

 
Architectures Categories Products
HC(S)12(X) General / Miscellaneous, Development Board, Debugger, Flash Programming Software, Assembler, Development Kit / Package
 
Please rate this FAQ to help us improve our support
0 means "not helpful"
10 means "very helpful"
0 1 2 3 4 5 6 7 8 9 10

© 2017 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement