Quick Questions on clock "Arduino Uno"
i want know how time arduino uno atmega328 16mhz clock take complete program. have calculate number of instruction , apply formula?
for example how time take run blink led code shown below:
int led = 13;
// setup routine runs once when press reset:
void setup() {
// initialize digital pin output.
pinmode(led, output);
}
// loop routine runs on , on again forever:
void loop() {
digitalwrite(led, high); // turn led on (high voltage level)
delay(1000); // wait second
digitalwrite(led, low); // turn led off making voltage low
delay(1000); // wait second
}
2. , happen if clock lower 16mhz, micro-controller execute program slower?
3. how long take 1 instruction example digitalwrite executed? instruction take same amount if not can see how long instruction take executed?
4. how many instruction executed in 1 second? how can calculated amount of time take clock ticks, 1/16mhz=6.25*10^-8?
5. got website example of clock calculations?
for example how time take run blink led code shown below:
int led = 13;
// setup routine runs once when press reset:
void setup() {
// initialize digital pin output.
pinmode(led, output);
}
// loop routine runs on , on again forever:
void loop() {
digitalwrite(led, high); // turn led on (high voltage level)
delay(1000); // wait second
digitalwrite(led, low); // turn led off making voltage low
delay(1000); // wait second
}
2. , happen if clock lower 16mhz, micro-controller execute program slower?
3. how long take 1 instruction example digitalwrite executed? instruction take same amount if not can see how long instruction take executed?
4. how many instruction executed in 1 second? how can calculated amount of time take clock ticks, 1/16mhz=6.25*10^-8?
5. got website example of clock calculations?
you'll have dig out spec sheet chip (e.g., http://www.atmel.com/images/doc0856.pdf) , @ clock cycles each instruction generated compiler if need actual count. instructions take 1 clock cycle, while others may take 3 clock cycles. in short, there no simple answer question gives precise answer without plowing through generated assembler code. approximation timing several hundreds passes through loop , calculating average, if that's close enough.
Arduino Forum > Using Arduino > Programming Questions > Quick Questions on clock "Arduino Uno"
arduino
Comments
Post a Comment