This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Register Bank switching

hi all,
I had earlier posted this message, but got no reply.

I am using Infineon XC164CS controller.
I am testing the register bank switching using a simple program as below.

uwBank_set = 0; //global variable
__asm
{
mov r1,#32
mov r5,#64
}
BNKSEL1 = 0x8000;
GPT1_vStartTmr(GPT1_TIMER_3);
while(!uwBank_set);
GPT1_vStopTmr(GPT1_TIMER_3);
PSW_BANK1 = 1;

/*PSW_BANK1 is a macro for bit 9 of PSW register. Interrupt priority level is 15 and group level is 3.*/
I am using timer interrupt for this purpose.In the ISR I am swapping the contents of regs R1 and R5 as below.

__asm
{
mov r1,#64
mov r5,#32
}
uwBank_set = 1;


If I put a break point in the ISR, I can see the switching of the banks.
But if I change PSW bank bits to 0x10 in the main program as in the code, the register values will be 0.

Can any one suggest the solution?

- vishwa

0