This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Access to register

Hi all,
i need a help to move my first pass into this world of programming. I use a Cortex-M0 and my question is: how can I access to register R0-R12.. in language C? it's possible?
I would save a variable into one register.
Thanks bye.

Parents
  • My intention was to save the specific variable into one register when the reset occurs, because now when reset occurs all variable return to value 0.

    That's not how it is done. You should use an ordinary static variable. After reset, you read it before the startup code clears it, or you use compiler facilities to suppress initialization of this particular register. The CPU reset itself does not alter the contents of RAM (unless it is SDRAM and refresh process is suspended for too long).

Reply
  • My intention was to save the specific variable into one register when the reset occurs, because now when reset occurs all variable return to value 0.

    That's not how it is done. You should use an ordinary static variable. After reset, you read it before the startup code clears it, or you use compiler facilities to suppress initialization of this particular register. The CPU reset itself does not alter the contents of RAM (unless it is SDRAM and refresh process is suspended for too long).

Children