This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error C197: inline-asm: invalid expression token MSR CPSR_c, #(0x12|0x80)

Hello all.

I have downloaded the LPC213x sample codes for Keil, at NXP website: www.standardics.nxp.com/.../

I have tryed to compile the GPIO example, and I am getting the following error message, when trying to compile timer.c code:

Build target 'MCB2140 Board'
assembling Startup.s...
compiling irq.c...
compiling fiotest.c...
compiling fio.c...
compiling timer.c...
*** MSR CPSR_c, #(0x12|0x80)
..\COMMON\SRC\TIMER.C(35): error C197: inline-asm: invalid expression token
*** MSR CPSR_c, #(0x12|0x80)
..\COMMON\SRC\TIMER.C(35): error C197: inline-asm: missing ')'
Target not created

The error is about this part of the code, more especificly about the IDISABLE command:

void Timer0Handler (void) __irq
{
    T0IR = 1;                   /* clear interrupt flag */
    IENABLE;                    /* handles nested interrupt */

    timer_counter++;

    DISABLE;
    VICVectAddr = 0;            /* Acknowledge Interrupt */
}

This IDISABLE command is defined on the IRQ.H file, and somehow it is causing this error:

#if NESTED_INTERRUPT
#define IDISABLE        __asm { LDMFD SP!, {LR} } \ 
                                        __asm { MSR CPSR_c, #(IRQ32Mode|I_Bit) } \ 
                                        __asm { LDMFD SP!, {LR} } \ 
                                        __asm { MSR SPSR_cxsf, LR }
#else
#define IDISABLE ;      /* do nothing */
#endif

If anybody knows how to solve this problem, please help me. Thank you.