Need to have interrupt enabled software delay - ZigBee

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

Need to have interrupt enabled software delay - ZigBee

1,203 Views
mou
Contributor III
Hi,
Can anyone help me out in the following regard?I want to write a software delay in SMAC where the interrupts are being enabled.I have written a software delay like this:-
My_Delay(int c){
 
  for(i=0;i<c;i++)
   for(j=0;j<c;j++);
}
 The interrupts are getting disabled while the program is executing the above delay.It cannot be enabled by forcefully enabling the interrupt (i.e. with the command EnableInterrupts in SMAC).Can anyone suggest a way of writing a simple software delay with interrupts enabled?
I am in urgent need of this.
Best Regards,
Mou
 
Added ZigBee to subject.


Message Edited by NLFSJ on 2007-12-10 11:53 AM
Labels (1)
0 Kudos
2 Replies

396 Views
AmZig
Contributor I
Hello mou,
In SMAC  already there is a software interrupt enabled delay function "delay(ms)".You can find this in PER_RX example. The files for this interrupts are timer.c , timer.h and in smac_per_rx.c. 
Currently i dont have beekit on this pc, otherwise i could send you the whole file.
And hope this will work for u.
 
Best Regards
AmZig. 
0 Kudos

396 Views
mou
Contributor III
Hi Amzig,
The delay function you have mentioned is a blocking delay. I want a non-blocking delay function.
I am describing the exact problem I have faced. I am using the MC1319X_XBEE target. My XBee module is supposed to receive two data packets at a time and transmit them with slight modification.But as soon as it tries to send the first received packet, it looses the 2nd packet, since there is no Collision Sense in SMAC.So, I want to put a non-blocking delay in between the two receptions.As soon as it receives the first packet, it will enter the delay state.Then, as soon as it will receive the 2nd packet, it will be interrupted in the middle of the delay and the 2nd packet will be received. So we have to Enable Interrupts within the delay function.
But, I have already used the delay function you have mentioned about. It is not solving my purpose.
Can you help me in this regard?
Thanking You,
Mou
0 Kudos