I want to read the value of the register (8-bit). In particular I want to read the values of:
- The Timer/Counter - TCNT0 ( Adress 0x26 (0x46) )
- The output compare registers - OCR0A and OCR0B.
Is there a way to read them with the Arduino program?
1 Answer 1
To convert my comments to an answer:
You can use the register names directly. They are defined in the boards/chips core. To read them, simply use the names in your calculations. Write to the registers by setting the value of the registers name (like a variable: TCNT0 = 0;
). Be sure to look into the datasheet, to check the behavior of that register.
-
As noted, do check the datasheet -- some register flags are cleared (zeroed) by writing a 1 to them.jose can u c– jose can u c2019年05月01日 19:34:15 +00:00Commented May 1, 2019 at 19:34
Explore related questions
See similar questions with these tags.
millis()
and siblings. You can try it with a currently disabled timer.