Tool/software: TI C/C++ Compiler
I have an application where I want to test the interrupt flags in the IFR register while the interrupt is not enabled (e.g. IER.x == 0 or INTM == 1).
The IFR register is declared in F2837xD_device.h as "extern __cregister volatile unsigned int IFR". The CPU supports reading the IFR register into the accumulator using the stack as follows:
PUSH IFR
POP @AL
The compiler SHOULD therefore able to read the IFR into a variable for testing in my application.
BUT the following code fails to build:
if (IFR & M_INT14) doSomething();
with the error message:
>>> Illegal use of control register
Please can you advise me on how to read the IFR register within C code.
I realise I could write an assembly function that performs the read through the stack, but this is not acceptable as this code is called very often.