Interrupt whith XGATE problem.

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

Interrupt whith XGATE problem.

3,592 Views
loulou
Contributor I
Hello,
 
I work on The S12xDP512 and my interrup are manage by the CPU.
But now i want to use the xgate for manage it.
 
I don't understand how one passes the Cpu at the Xgate for manage the interrupt.
 
 
 
It's my program with interrup manage by CPU (jus the define of interrup):
 
#ifndef __SMALL__                   
#pragma CODE_SEG __NEAR_SEG NON_BANKED
#endif
 

interrupt 23 analog(void)
        {
       calcul_moy();          //call calcu_moy
     comparison();          //call comparison
     ATD1CTL2=0x00;
     init_analog();
      }
 
If i want to use the Xgate in the place to Cpu what must i make??
 
Thanx for you help
Labels (1)
0 Kudos
3 Replies

501 Views
Sten
Contributor IV
In principle you just have to move your interrupt service routine from the .c file to a .cxgate file and add hex 80 to the priority when you initialize the Interrupt Module.
 
If you are working with CodeWarrior for HC12 v. 4.5, it will generate example code for you when you start a new project. There are also several Application Notes describing the use of the XGATE, start with AN3234 and AN2685.
0 Kudos

501 Views
Alban
Senior Contributor II
Yo, just the training I was providing last week :smileywink:
 
To move the interrupt, you need to:
 
 - Move the C code to .cxgate so the linker puts it for RAM execution. (said before)
 - Assign a proper priority and set the RQST bit in the interrupt config register (said before). Be careful, this is a paged area and you might need to change the page before accessing the location.
 - Remove the function call from your CPUS12X vector table.
 - Add the function pointer and optional variable pointer in the appropriate channel for the XGATE vector table.
 
Cheers,
Alban.
0 Kudos

501 Views
Alban
Senior Contributor II

Well, ok I know it's ugly to reply to your own post...

But I wanted to add some code to show an example.

In the Zip file, we transfer the interrupts from the S12X core to the XGATE.

Cheers,
Alban.

 

ChangeISRFromCPUtoXGATE.zip

Message Edited by t.dowe on 2009-10-20 11:11 PM
0 Kudos