Timer Callback problem - MC1321X

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Timer Callback problem - MC1321X

1,677 Views
bitasobhani
Contributor III

Hi all
I am working on Mc1321x.
I want to insert a dalay of for example 10 seconds inside the code. I did it as below:

#define mDelayTime_c     TmrSeconds(10)
.
.
.
TimeFlag=0;
TMR_StartSingleShotTimer(DelayTimerId,mDelayTime_c,DelayTimerCallBack);
while(TimeFlag==0){}
TimeFlag=0;
.
.
.

void DelayTimerCallBack
  (
  tmrTimerID_t  timerId
  )
{
  (void) timerId;
 
  TimeFlag=1; 
 
}

All variables are defined as global.
But this code does not work. The problem is that the while loop does not permit timer callback to occur.
what should I do.

Thanks a lot
 

Added p/n to subject.



Message Edited by NLFSJ on 2008-10-29 09:43 AM
Labels (1)
0 Kudos
4 Replies

523 Views
Spell
Contributor I
Hi bitasobhani,

you must allocate the DelayTimerId timer before you can use it.

DelayTimerId = TMR_AllocateTimer();

regards,
filippo
0 Kudos

523 Views
bitasobhani
Contributor III
Thanks for reply
No I didn't forget to allocate timer.
0 Kudos

523 Views
Lundin
Senior Contributor IV
To me it sounds like you forgot to make the variable volatile.
0 Kudos

523 Views
bitasobhani
Contributor III
Thanks for reply
Can you please expail what is volatile and how can I do this?
0 Kudos