RTI problem - mc9s12dt256b

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RTI problem - mc9s12dt256b

1,659 Views
leeen82
Contributor I
I am trying to setup a basic interrupt.  I have it working successfully using processor expert but am having issues setting it up myself.  I believe the problem is with the vector addressing, which is a bit unclear to me.  Using processor expert I see that the vector address is set to 0xFFF0, but when I try this with my program it will not compile.  I have posted the code below.  Any tips or code examples showing how to using vector addressing would help.  Thanks in advance.

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

VECTOR ADDRESS 0xFFF0 MY_Int; 

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


void main(void) {
  /* put your own code here */
 
  RTICTL=63;
  CRGFLG=128;
  CRGINT=128;
  //INTCR=191;
  EnableInterrupts;
  for(;:smileywink:{
  }
 
 
                      /* Enable interrupt */
  //EnableInterrupts;

  for(;:smileywink: {} /* wait forever */
  /* please make sure that you never leave this function */
}
 
Added p/n to subject.


Message Edited by NLFSJ on 2007-12-18 11:30 AM
Labels (1)
0 Kudos
3 Replies

389 Views
JimDon
Senior Contributor III
First change
Code:
void 0xFFF0 MY_Int(void){ // wrong

 To
Code:
void  MY_Int(void){

 Then move:
Code:
VECTOR ADDRESS 0xFFF0 MY_Int; // Should be in PRM file.

 To the prm file.
Also,
Code:
DDRB = 0x10; // set this bit to output.

 
This should at least get it to compile..



0 Kudos

389 Views
leeen82
Contributor I
Thanks for the reply and please forgive my lack of understanding with vector addressing.  I placed the code
VECTOR ADDRESS 0xFFF0 MY_Int;
in the prm file, but I cant get it to compile.  There are several sections in the prm file.  Is there a particular place in that file that this code should be?  Also there are two prm files, one for the simulation and one for the P&E connection to the processor.  I assume the code should go in the prm file corresponding to the processor connection.  Is this correct?

As a side note I cant seem to find much info about this topic in the manual.  Am I missing something (if so please point me to in the direction) or is the vector addressing a bit skipped over in the manual?

Thanks again for the help. 
    Erik
0 Kudos

389 Views
JimDon
Senior Contributor III
Code:
VECTOR ADDRESS 0xFFF0 MY_Int // in prm file, at the end no ';'

 Sorry, there should not be a semi-colon at the end!
There should be other vector statements in you prm file.
Yes, it should go into the prm file you are using.
PRM files are not very well explained, but if you type in VECTOR in the help index, you will find this explained.

Be default all "C" projects get this, which is by number. Personally, I always use a vector table.
Code:
VECTOR 0 _Startup /* reset vector: this is the default entry point for a C/C++ application. *///VECTOR 0 Entry  /* reset vector: this is the default entry point for an Assembly application. *///INIT Entry      /* for assembly applications: that this is as well the initialization entry point */

Build_Tools_Utilities.pdf discusses this on page 176 and 299. It gives asm examples, but it applies to "C" as well.
You can find this in the C:\Program Files\Freescale\Codewarrior for HC12 V4.6\Help\PDF directory.



Message Edited by JimDon on 2007-12-21 01:09 PM
0 Kudos