Interrupt whith XGATE problem.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Interrupt whith XGATE problem.

4,229 次查看
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
标签 (1)
0 项奖励
回复
3 回复数

1,138 次查看
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 项奖励
回复

1,138 次查看
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 项奖励
回复

1,138 次查看
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 项奖励
回复