When setting CTRLA for TCB1 I use:
TCB1.CTRLA = TCB_CLKSEL_CLKDIV1_gc | TCB_ENABLE_bm;
What stands the _gc and _bm for.
When setting CTRLA for TCB1 I use:
TCB1.CTRLA = TCB_CLKSEL_CLKDIV1_gc | TCB_ENABLE_bm;
What stands the _gc and _bm for.
What model Arduino is that?
I've only seen those _gc and _bm defines when coding for an Xmega MCUs and never for Attiny or Atmega's in Atmel Studio
Uno Wifi Rev2
Thx
So it's the Microchip ATmega4809 microcontroller. You will find lots of useful data in the processor datasheet:
https://ww1.microchip.com/downloads/en/DeviceDoc/ATmega4808-09-DataSheet-DS40002173C.pdf
Good evening all. I thought/hope that my question is OK for this thread about timers and counters.
When time is of the essense, I understand that it is better to avoid arythmetic based on long numbers (bytes are better than long or long long).
However the "millis()" function results an unsigned long.
If I want to calculate an elapsed time that I know will be around 1sec should I still use:
Unsigned long time_A = millis();
.....
Unsigned long time_B = millis();
.....
elapsedTime = time_B - time_A;
or can I get away with using "unint_16" to speed-up the calculations in the knowledge that the difference between time_A and time_B will only affect the least significant bits?
Thanks for your thoughts/inputs on this.
I think you mean "uint16_t".
I guess it will work for intervals up to 65535 milliseconds. The millis() function will still return 32 bits but the compiler will throw away the top 16.
Thanks John.
Indeed I meant "uint16_t".
I thought the same (The millis() function will still return 32 bits but the compiler will throw away the top 16) which in theory would then allow me to save time on all the calculations based on the variable " elapsedTime" there after.
Thanks
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.