Go to Post As a wise man from PA once said to me "Changing the culture is hard work." - RoboMom [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #23   Spotlight this post!  
Unread 23-02-2004, 17:06
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: sleep()

Quote:
Originally Posted by Astronouth7303
It's not that, it's that the main loop has different iteration times depending on what is executed.
Do you mean "execution times"? I take "iteration time" to be the time between iterations of the 26.2 ms loop area. I actually measured this with a scope on Saturday, it was very interesting:

Code:
  while (1)   /* This loop will repeat indefinitely. */
  {

    if (statusflag.NEW_SPI_DATA)      /* 26.2ms loop area */
    {                                 /* I'm slow!  I only execute every 26.2ms because */
                                      /* that's how fast the Master uP gives me data. */
      rc_dig_out17 = 1;   // take pin 17 high      
      Process_Data_From_Master_uP();  /* You edit this in user_routines.c */

      if (autonomous_mode)            /* DO NOT CHANGE! */
      {
        User_Autonomous_Code();        /* You edit this in user_routines_fast.c */
      }
    }
    Process_Data_From_Local_IO();     /* You edit this in user_routines_fast.c */
    rc_dig_out17 = 0;  // clear pin 17                                      /* I'm fast!  I execute during every loop.*/
  } /* while (1) */
This made a pulse of about 4 ms in duration (the "exectution time" of my code), with a (measured) cycle time ("iteration time") of about 26 ms. Hitting certain buttons would change the 4 ms to something else like 3 ms as my code changed modes, but the period remained 26 ms. It seemed pretty rock-solid. Except when very strange things were happening; see my earlier post on that. But that was something broken.

One reason a delay might be useful is to reduce the frequency of calls to Generate_Pwms(). See the reply from Kevin Watson to the post mentioned above.

-Norm
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How much sleep are you going to get??? ttedrow General Forum 34 11-01-2004 02:27
Sing me a SONG! Biggs717 Chit-Chat 78 09-05-2003 07:59
Sweet sweet sleep DavidAusTex General Forum 26 25-02-2003 00:38
LET ME SLEEP!!!!! archiver 2001 2 24-06-2002 01:08
Speaking of sleep and dew....see the pic... archiver 2001 3 24-06-2002 00:54


All times are GMT -5. The time now is 22:25.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi