This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430F6734A: IAR C: How to get value of Program Counter that will be returned after ISR

Part Number: MSP430F6734A

Tool/software: TI C/C++ Compiler

Hi,

We are using IAR 7.12 C for one of our project that use MSP430F6734A has 96 KB flash memory.

And IAR C compiler configured for large code model.

For diagnostic purpose, inside the interrupt routine I need to store the address of the code that will be executed after the ISR.

That value (Program Counter just before the ISR) automatically pushed by MSP430 to somewhere before jumping to ISR routine and poped automatically after the ISR routine.

I need that 32 bit value in my C variable, how can I obtain it?

uint32_t PROGRAM_COUNTER_WAS;

void func1(void)
{
	..
}

void func2(void)
{
	..
}

void main(void)
{
	...
	__enable_interrupt();
	
	while(true)
	{
		func1();
		func2();
		..
	}
}

#pragma vector =  PORT1_VECTOR /* 0xFFDE Port 1 */
__interrupt void PORT1_ISR(void)
{
	...
	PROGRAM_COUNTER_WAS = ?? // here I need to store the address of the code that will be executed after the ISR
}

#pragma vector = RTC_VECTOR
__interrupt void RTC_ISR(void)
{
	...	
	PROGRAM_COUNTER_WAS = ?? // here I need to store the address of the code that will be executed after the ISR
}

#pragma vector =  AUX_VECTOR	/* 0xFFE6 AUX Supply */
__interrupt void AUX_ISR(void)
{
	...
	PROGRAM_COUNTER_WAS = ?? // here I need to store the address of the code that will be executed after the ISR
}

**Attention** This is a public forum