when a project created in MC9S12XDP512 in codewarrior has  Enable interrupts in main what is it

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

when a project created in MC9S12XDP512 in codewarrior has  Enable interrupts in main what is it

2,190 Views
sunil99
Contributor I
hai sir,
 
sub:can you please tell me when a project created in MC9S12XDP512 in codewarrior has  Enable interrupts in main automatically and it creates like this
main()
{
put ur code here;
 
Enable interrupts;
for(;:smileywink:;
}
what is the importance of Enable interrupts what it does actually is it connected in any way to vector.c and ISRS.because of that only interrupts in ISRS will be enabled or what.please tell me.should we keep our entire code before Enable interrupts or we need to keep enable inteerupts in between our code where ever necessary when i keep enable interrupts in my code before tranmit routine and executing its giving message unimplemeted isr[i am using only CAN recive ISr rest all keeping as unimplemented]  what might be problem if i am keeping enable interrupts after the ocde ie as last line i am not getting that error but receiving side interrupts are not enabled what might be the problem please suggest me or atleast expalin about eanble interrupts.
 
thanks inadvance
bye
sunil
 
Labels (1)
0 Kudos
4 Replies

547 Views
Alban
Senior Contributor II
Hello,

In the MCU, there is a global interrupt mask available.
Out of Reset, all Interrupts are masked (temporarily disabled, but the interrupt stays pending).

This mask is the I bit in the CCR = Condition Code Register.
Enable interrupts is Clearing the bit while disabling interrupts set the bit.
These functions are just doing a asm CLI or asm SEI, the assembly instruction to enable/disable the global mask.

You still have to handle local enable of interrupts in all the modules. For the CAN, I think it is in CANIER, CANRIER and CANTIER, or with a similar name. They are explained in the msCAN block guide.

The I bit is described in the CPU reference manual.

Cheers,
Alban.
0 Kudos

547 Views
sunil99
Contributor I
hai sir,
   i am not using XGATE so i kept all its interrupts as unimplemented ISR but still i am not able to handle a interrupt request.i am sending my vector.c file just see that still i am not able to handle interrupt request what additional things should i do in the code to handle interrupt request.should i keep my entire code before enableinterrupts or after it please tell me how to handle interrupts locally i am not able to handle interrupts properly please correct me and help me i am awfully struck and helpless in solving that problem interruptis not at all getting generated whata dditional things should i do in the code o generate an interrupt
for ISR function i am handling it as
#pragma CODE_SEG __NEAR_SEG NON_BANKED
#pragma TRAP_PROC
interrupt void CAN0RECIVEISR(void)
{
code
}
#pragma DATA_SEG DEFAULT
 
but still i am not handling interrupts please suggest me i am struggling continuously with this problem form firday please help me i am sending the vector.c file and in linker file i am commneting vector 0_startup othert than that what should i do to handle interrupts please tell me or else send em sample code how to handle interrupts and how to declare vector table and i am through with  CANIER, CANRIER and CANTIER all these but new to code warrior and unable to handle please help me or else i cant go forward or else reset vectors is not allowing me to handle interrupts or any compiler settings not able to ahndle interrupt please help me i am in desperate need of help please sir show me way
thanks in advance
bye
sunil
0 Kudos

547 Views
J2MEJediMaster
Specialist I
Best thing for you to do is look at some example code that should have been part of your CodeWarrior installation. There is a demo program that uses an interrupt handler that should give you ideas of how to write your ISR.

First, go to your CodeWarrior directory at (assuming you installed CodeWarrior V4.5 on the C: drive): C:\Program Files\Freescale\CW for HC12 V4.5 and see if you have a (CodeWarrior Examples) directory. If not, you may have to run the CodeWarrior installer again and have it install the example code and documentation.

If the directory is present, then navigate to the directory inside it that contains an example program for your specific MCU type. Following the layout I'm giving here, that would be: C:\Program Files\Freescale\CW for HC12 V4.5\(CodeWarrior Examples)\MC9S12\DP\DP512\Sources.

---Tom

0 Kudos

547 Views
Alban
Senior Contributor II
Please Sunill, look at examples for S12X and not S12.
The interrupt handling is totally different and not fully compatible.

It could be the occasion to start using the XGATE as all the code is provided free of charge and fully tested and working without limitation...

Cheers,
Alban.
0 Kudos