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.

OR IER instruction

Hello,

This is Zurfi and I'm new to F28335. My basic question is why we should use OR IER instruction to enable a specific interrupt level in the Interrupt Enable Register. 

Example: 

IER |= M_INT3;

Is this the only way to enable the interrupt level? OR I can use another instruction. 

Thanks in advance,

  • The reason is that IER might not be zero when you run that statement.


    For example, if IER was 0x0030 before you get to that statement, then running

    IER |= M_INT3;

    will make IER equal to 0x0034.

    If you just set IER as in...

    IER = M_INT3;

    then you will make IER equal 0x0004, which mean you turned off M_INT5 and M_INT6 that was enabled before the statement.

    Note that to disable a level, you should use &= and inverted level value, such as

    IER &= ~ ((unsigned int) M_INT6);


    I don't recommend disabling interrupts by disabling IER, do it at the PIE instead, unless you have a good reason to do so.

  • Thank you much quark. That makes complete sense.