Erik Lee

RTI problem--Processor mc9s12dt256b

Discussion created by Erik Lee on Dec 18, 2007
Latest reply on Dec 30, 2007 by kef
I am trying to setup an interrupt and having problems.  I think that the problem is regarding the vector address, which I am a bit unclear about.  I used processor expert to get the interrupt to turn on and off an LED and it was successful.  By looking in the vectors.c file from processor expert I can see that the vector address is 0xFFF0 but I cant seem to get the interrupt to work without using processor expert.  I should note that maybe there is some other problem that I am missing, but I am pretty sure that I need to define a vector address for the interrupt.  Any code examples or suggestions would be greatly appreciated.  The code for the program is listed below.  Thanks in advance.

#include <hidef.h>      /* common defines and macros */
#include <mc9s12dt256.h>     /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dt256b"

#pragma TRAP_PROC
void MY_Int(void){
  CRGFLG = 128;
    DDRB=0xF0; //sets to output
    if (PORTB == 0x10){
      PORTB = 0;
      PORTB = 0x10;

void main(void) {
  /* put your own code here */
                      /* Enable interrupt */

  for(;:smileywink: {} /* wait forever */
  /* please make sure that you never leave this function */