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.

cc2540 delayfunction. Error[029] expected an expression

Other Parts Discussed in Thread: CC2540

hello community,

please dont kill me :) i think (hope) this is a little problem, but it drives me crazy for 2 days...

i am very new in c programming. i use the cc2540.

in the first time i only use the cc2540 as a "normal" µC. i will use the blutooth thing when the love grows bigger. this is our third date :-) 

this is the evalboard i use. its from bluegiga. there was a script-language included, but i killed it with TI cc debugger.

i am using IAR to programm this lady, but she is very strinct and does not forgive any mistakes.

i am trying to build a function to set up delays. milliseconds in this case.

she is complaining about that she expected any expressions. but i dont understand why.

here is my little programm.

#include <iocc2540.h>

void delay_ms(int ms)

#define timertick = ms

{   
    IEN0   = 0x80;    // alle interrupts enablen
    TIMIF  = 0x40;    // enable overflow interrupt
    T1CTL  = 0x40;    // divider einstellen 1/8
    T1CC0L = 0x60;    // low byte
    T1CC0H = 0xF0;    // high byte
    T1STAT = 0x20;    // wird gesetzt wenn wert erreicht
    T1IE   = 0x02;    // Timer 1 interrupt enable
    T1CTL  = 0x02;    // start in Modulo mode

    while(timertick > 0);       <-- here

}
 
    volatile unsigned char delay=0;

      #pragma vector=0x4b

      __interrupt void Timer1_overflow(void)

{
      if (timertick > 0);              <-- here
      timertick=--;                     <-- here
     }

i hope you can help us to let our love grow :-)

thanks mathias