I have a general question about ARDUINO programming: is there a way to directly access the micro controller's registers that are on the ARDUINO board using the ARDUINO IDE?
I mean that in general, and not just concerning the IO registers.
I would like at first to access the sleep register (MCUCR), but I believe I might need to access some other registers as I go on. Is there a general way to access these registers?
I have a general question about ARDUINO programming: is there a way to directly access the micro controller's registers that are on the ARDUINO board using the ARDUINO IDE?
I mean that in general, and not just concerning the IO registers.
Which Arduino board?
Which microcontroller?
When it comes to direct register programming each microcontroller is different.
And direct register programming with 32-bit conrollers is much more complicated than with 8-bit Atmega controllers.
I'm using the ARDUINO UNO board, but as I said my question is more general, as I'm used to programming microcontrollers that are not ARDUINO based - using IAR or Keil IDEs, there are usually examples and headers enabling write to MCU registers, here's an example to configuring register in IAR code:
udilevy:
I'm using the ARDUINO UNO board, but as I said my question is more general, as I'm used to programming microcontrollers that are not ARDUINO based - using IAR or Keil IDEs, there are usually examples and headers enabling write to MCU registers, here's an example to configuring register in IAR code:
The Arduino software is based on "AVR GCC", so all programming examples for Atmega controllers and AVR GCC should work directly in the Arduino IDE, too.
As a first step, perhaps have a look at:
Perhaps also look up the pin mapping between the PINx/PORTx and genuine Arduino pin numbering.
On the Arduino oard you find pins numbered 0, 1, 2, 3, 4, 5... but actually those pins belong to PORT register (i.e. PORTD on an UNO board with Atmega328) and each pin is mapped to a bit within the PORT register.
In general you can use any tutorial for Atmega controllers written for AVR GCC compiler learning about direct register programming, example code also works in the Arduino IDE.