Hello
I posted a similar question yesterday but after further research I have some more concrete questions
I have counted the number of CPU clock cycles by the code listed below.
I can see for serial.print 277 cycles is used. And for .println it takes 391 (this is of course dependent on the size of the data)
However, is there a faster way of getting values on to the PC?
I posted a similar question yesterday but after further research I have some more concrete questions
I have counted the number of CPU clock cycles by the code listed below.
I can see for serial.print 277 cycles is used. And for .println it takes 391 (this is of course dependent on the size of the data)
However, is there a faster way of getting values on to the PC?
Code:
volatile int cycles;
void setup() {
// put your setup code here, to run once:
while (!Serial);
delay(100);
ARM_DEMCR |= ARM_DEMCR_TRCENA;
ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
}
void loop() {
uint32_t startCycleCPU;
startCycleCPU = ARM_DWT_CYCCNT;
Serial.println(123);
cycles = (ARM_DWT_CYCCNT - startCycleCPU)-1;
//__enable_irq();
Serial.print("cycles: ");
Serial.println(cycles);
delay(1000);
}
Last edited: