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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
3,872件の閲覧回数
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?

ラベル(1)
0 件の賞賛
返信
1 解決策
2,146件の閲覧回数
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 件の賞賛
返信
2 返答(返信)
2,145件の閲覧回数
dermotmurphy
Contributor I

Many thanks, that works great.

0 件の賞賛
返信
2,147件の閲覧回数
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 件の賞賛
返信