Skip to main content
Knowledgebase
Home
Renesas Singapore - Knowledgebase

CC-RL compiler for RL78 devices: How to handle access to SFRs?

Latest Updated:04/24/2015

Question:

I am using the CC-RL compiler for RL78 devices. How should I handle access to SFRs?

Answer:

Include the iodefine.h file that is generated when you create a project in an IDE. SFRs that are addressable from the compiler in byte or word units and those SFRs having bits which are addressable in bit units (only those bit names corresponding to bit numbers enclosed in squares in the user's manual for the MCU) can be accessed by writing their names. In the case of bits for which the numbers are not enclosed in squares, use the reserved word with “_bit” appended for the name of the byte- or word-unit SFR defined in iodefine.h.

Example:
ADM2 = 0x12; /* Reserved word for a byte-unit SFR */
ADTYP = 1; /* Reserved word for a bit-unit SFR */
P0_bit.no2 = 1; /* There is no reserved word for this bit-unit SFR */

Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family