Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18347

Re: delayMicroseconds large overhead?

$
0
0


Like JJY, I'm new to this world --- and also discovereding (by a
slightly different route) that it's apparently impossible to write any
code at all that occupies less than milliseconds...not what I naively
expected from a 400 MHz processor! For example, the following program
generates a square wave on my 'scope --- with a period of 4.5
milliseconds.
...................................................
/* Minimal Pin toggler */
void setup() {
  pinMode(8, OUTPUT);
}

 

void loop() {
   digitalWrite(8, LOW);
   digitalWrite(8, HIGH);
}
.......................................

 

Now 4.5 mS x 400 MHz = 1,800,000, unless I'm doing my arithmetic
completely wrong ... is is really true that this little loop consumes
nearly two million ticks?

 

In agreement with Len's comments, I find that the time cxonsumed in
this loop is not very stable: if I display even 4 cycles of the waveform of
my 'scope, there is considerable jitter -- maybe .5 mS --- at the end
of the 4th cycle.

 

It seems to me unlikely that there's any solution to this problem in
the context of Arduino/Galileo. Maybe Arduino alone, or bypass
Galileo's Arduino interface?

 

-- Homer


Viewing all articles
Browse latest Browse all 18347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>