How do I disable all interrupts on a MPC5604 (whats the equivalent to DisableInterrupts used on the S12 compiler)

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

How do I disable all interrupts on a MPC5604 (whats the equivalent to DisableInterrupts used on the S12 compiler)

Jump to solution
3,036 Views
dermotmurphy
Contributor I

I have an interrupt which is updating data, which can also be read using other functions.

I need to be able to read data knowing that it is not being updated mid way through the read.

 

On the S12 I would do this:

disable all interrupts using the DisableInterrupts function which would update the I bit in the CCR register.

perform the action

enable all interrupts using the EnableInterrupts function

 

What is the equivalent for the MPC5604?

Labels (1)
0 Kudos
1 Solution
1,310 Views
stanish
NXP Employee
NXP Employee

You can e.g. set/clear EE bit in MSR register. See below the example of implementation using the custom macros.

#define DISABLE_INT __asm(wrteei  0)

#define ENABLE_INT  __asm(wrteei  1)

void main(void)

{

  ENABLE_INT;

DISABLE_INT;

}

View solution in original post

0 Kudos
2 Replies
1,309 Views
dermotmurphy
Contributor I

Many thanks, that works great.

0 Kudos
1,311 Views
stanish
NXP Employee
NXP Employee

You can e.g. set/clear EE bit in MSR register. See below the example of implementation using the custom macros.

#define DISABLE_INT __asm(wrteei  0)

#define ENABLE_INT  __asm(wrteei  1)

void main(void)

{

  ENABLE_INT;

DISABLE_INT;

}

0 Kudos