Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
vvyogi
PostPosted: May 30, 2012 - 06:45 AM
Hangaround


Joined: Apr 04, 2010
Posts: 185
Location: india

Quote:
Have you read my tutorial on multitasking? It's in the tutorial section.

Aye aye sir.

_________________
- Will find's a Way.
 
 View user's profile Send private message  
Reply with quote Back to top
jayjay1974
PostPosted: May 30, 2012 - 12:49 PM
Raving lunatic


Joined: Oct 30, 2002
Posts: 5727
Location: The Netherlands

It would roughly look like this:

Code:

void nRF_poll_store_data(void)
{
 static uint8_t state,delay_counter;

 switch(state)
  {
  case 0:if (need_to_send)
         {
           mirf_set_TADDR((uint8_t *)T_add);
           mirf_set_RADDR((uint8_t *)T_add);
           mirf_send((uint8_t *)"Hello",8);
           hl_ack = 0;
           fl_data = 0;
           need_to_send=0;
           state=1;
         }
 
         break;

  case 1:if  (hl_ack == 1)
          {
          mirf_set_RADDR((uint8_t *)MyAdd);

          delay_counter=10;

          state=2;
          }
         break;

   case 2:delay_counter-=1;
     if (delay_counter==0)
          {
            state=3;
          }
          break;

   case 3:if (fl_data == 1)//if data arrived
          {           
             mirf_config_register(STATUS,(1<<RX_DR));
             mirf_get_data((uint8_t *)buffer);
             buffer[8] = '\0';
             store_block_eeprom((uint8_t *)buffer);

        state=0;
          }
          break;
   }
 
 View user's profile Send private message  
Reply with quote Back to top
vvyogi
PostPosted: May 30, 2012 - 01:51 PM
Hangaround


Joined: Apr 04, 2010
Posts: 185
Location: india

@jay
thankyou+++++ I will be back with results.
again thankyou+++++

_________________
- Will find's a Way.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits