Abstract
Microcontroller programming requires efficient techniques for register access. Registers are used to configure the CPU and peripheral hardware devices such as flash access, clocks, I/O ports, timers, communication interfaces (UART, SPITM, CAN [1]), etc. This chapter describes C++ methods that can be used to manipulate microcontroller registers. The focus of this chapter is placed on template methods that provide for efficient, scalable and nearly portable register access.
Notes
- 1.
Note, however, that a register’s width need not necessarily have the same type as its address. One often encounters registers with 8–bit width or 16–bit width on a 32–bit machine, etc.
- 2.
This example and the following one have been taken from code that I once wrote to initialize timer0 for a well-known 32–bit microcontroller.
References
ISO, ISO 11898–1:2003: Road Vehicles—Controller Area Network (CAN)—Part 1: Data Link Layer and Physical Signaling (International Organization for Standardization, Geneva, 2003)
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Kormanyos, C. (2013). Accessing Microcontroller Registers. In: Real-Time C++. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-34688-0_7
Download citation
DOI: https://doi.org/10.1007/978-3-642-34688-0_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-34687-3
Online ISBN: 978-3-642-34688-0
eBook Packages: Computer ScienceComputer Science (R0)