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

Reading Individual Registers?

Howdy -- I'm starting with Cortex M processors, but I have lots of experience with 8bit MCUs.

I have been working on learning the STMicro PAL headers.

One thing, coming from an 8051, is that you can individually set/read pins. I didn't think this was significant, until I kind of started looking at the HAL headers and realized there doesn't seem to be similar functionality.

In 8051 with the Keil compiler, you do something like:

sbit LedOutput P2^5;

Is this not the Cortex M way to accomplish bit level reads like that?

Like I was taken aback that there is an BSRR and BRR registers. No such concepts on 8051s.

THERE IS AN EPIC THREAD ON THIS FROM 9 YEARS AGO: http://www.keil.com/forum/15029/direct-referrence-to-gpio-pins/

Near the end of this masterpiece post, there is some discussion of bit banding and reading individual bits in the works for M3's.

Did this ever come to fruition for M0's?

In the STHeaders, define all the individual registers, with shifts and masks. So it seems like bit level access is not the way this works in 2018.

If you want to read an individual register, is shifts and masks the most efficient way to get the job done on a Cortex M0?